Class NullMemory
- java.lang.Object
-
- com.microsoft.semantickernel.memory.NullMemory
-
- All Implemented Interfaces:
SemanticTextMemory
public final class NullMemory extends Object implements SemanticTextMemory
Implementation ofSemanticTextMemorythat stores nothing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.microsoft.semantickernel.memory.SemanticTextMemory
SemanticTextMemory.Builder
-
-
Constructor Summary
Constructors Constructor Description NullMemory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SemanticTextMemorycopy()reactor.core.publisher.Mono<MemoryQueryResult>getAsync(String collection, String key, boolean withEmbedding)Fetch a memory by key.reactor.core.publisher.Mono<List<String>>getCollectionsAsync()Gets a group of all available collection names.static NullMemorygetInstance()Gets the singleton instance of NullMemory}.reactor.core.publisher.Mono<Void>removeAsync(String collection, String key)Remove a memory by key.reactor.core.publisher.Mono<String>saveInformationAsync(String collection, String text, String externalId, String description, String additionalMetadata)Save some information into the semantic memory, keeping a copy of the source information.reactor.core.publisher.Mono<String>saveReferenceAsync(String collection, String text, String externalId, String externalSourceName, String description, String additionalMetadata)Save some information into the semantic memory, keeping only a reference to the source information.reactor.core.publisher.Mono<List<MemoryQueryResult>>searchAsync(String collection, String query, int limit, double minRelevanceScore, boolean withEmbeddings)Find some information in memory
-
-
-
Method Detail
-
getInstance
public static NullMemory getInstance()
Gets the singleton instance of NullMemory}.- Returns:
- The singleton instance of
NullMemory.
-
copy
@CheckReturnValue public SemanticTextMemory copy()
- Specified by:
copyin interfaceSemanticTextMemory
-
saveInformationAsync
public reactor.core.publisher.Mono<String> saveInformationAsync(@Nonnull String collection, @Nonnull String text, @Nonnull String externalId, @Nullable String description, @Nullable String additionalMetadata)
Description copied from interface:SemanticTextMemorySave some information into the semantic memory, keeping a copy of the source information.- Specified by:
saveInformationAsyncin interfaceSemanticTextMemory- Parameters:
collection- Collection where to save the information.text- Information to save.externalId- Unique identifier, e.g. URL or GUID to the original source.description- Optional description.additionalMetadata- Optional string for saving custom metadata.- Returns:
- Unique identifier of the saved memory record.
-
saveReferenceAsync
public reactor.core.publisher.Mono<String> saveReferenceAsync(@Nonnull String collection, @Nonnull String text, @Nonnull String externalId, @Nonnull String externalSourceName, @Nullable String description, @Nullable String additionalMetadata)
Description copied from interface:SemanticTextMemorySave some information into the semantic memory, keeping only a reference to the source information.- Specified by:
saveReferenceAsyncin interfaceSemanticTextMemory- Parameters:
collection- Collection where to save the information.text- Information to save.externalId- Unique identifier, e.g. URL or GUID to the original source.externalSourceName- Name of the external service, e.g. "MSTeams", "GitHub", "WebSite", "Outlook IMAP", etc.description- Optional description.additionalMetadata- Optional string for saving custom metadata.- Returns:
- Unique identifier of the saved memory record.
-
getAsync
public reactor.core.publisher.Mono<MemoryQueryResult> getAsync(String collection, String key, boolean withEmbedding)
Description copied from interface:SemanticTextMemoryFetch a memory by key. For local memories the key is the "id" used when saving the record. For external reference, the key is the "URI" used when saving the record.- Specified by:
getAsyncin interfaceSemanticTextMemory- Parameters:
collection- Collection to search.key- Unique memory record identifier.withEmbedding- Whether to return the embedding of the memory found.- Returns:
- Memory record, or null when nothing is found
-
removeAsync
public reactor.core.publisher.Mono<Void> removeAsync(@Nonnull String collection, @Nonnull String key)
Description copied from interface:SemanticTextMemoryRemove a memory by key. For local memories the key is the "id" used when saving the record. For external reference, the key is the "URI" used when saving the record.- Specified by:
removeAsyncin interfaceSemanticTextMemory- Parameters:
collection- Collection to search.key- Unique memory record identifier.- Returns:
- Mono completion.
-
searchAsync
public reactor.core.publisher.Mono<List<MemoryQueryResult>> searchAsync(@Nonnull String collection, @Nonnull String query, int limit, double minRelevanceScore, boolean withEmbeddings)
Description copied from interface:SemanticTextMemoryFind some information in memory- Specified by:
searchAsyncin interfaceSemanticTextMemory- Parameters:
collection- Collection to searchquery- What to search forlimit- How many results to returnminRelevanceScore- Minimum relevance score, from 0 to 1, where 1 means exact match.withEmbeddings- Whether to return the embeddings of the memories found.- Returns:
- Memories found
-
getCollectionsAsync
public reactor.core.publisher.Mono<List<String>> getCollectionsAsync()
Description copied from interface:SemanticTextMemoryGets a group of all available collection names.- Specified by:
getCollectionsAsyncin interfaceSemanticTextMemory- Returns:
- A group of collection names.
-
-