Interface SemanticTextMemory
-
- All Known Implementing Classes:
NullMemory
public interface SemanticTextMemoryAn interface for semantic memory that creates and recalls memories associated with text.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceSemanticTextMemory.Builder
-
Method Summary
All Methods Instance Methods Abstract 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.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
-
copy
@CheckReturnValue SemanticTextMemory copy()
-
saveInformationAsync
reactor.core.publisher.Mono<String> saveInformationAsync(String collection, String text, String externalId, @Nullable String description, @Nullable String additionalMetadata)
Save some information into the semantic memory, keeping a copy of the source information.- 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
reactor.core.publisher.Mono<String> saveReferenceAsync(String collection, String text, String externalId, String externalSourceName, @Nullable String description, @Nullable String additionalMetadata)
Save some information into the semantic memory, keeping only a reference to the source information.- 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
reactor.core.publisher.Mono<MemoryQueryResult> getAsync(String collection, String key, boolean withEmbedding)
Fetch 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.- 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
reactor.core.publisher.Mono<Void> removeAsync(String collection, String key)
Remove 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.- Parameters:
collection- Collection to search.key- Unique memory record identifier.- Returns:
- Mono completion.
-
searchAsync
reactor.core.publisher.Mono<List<MemoryQueryResult>> searchAsync(String collection, String query, int limit, double minRelevanceScore, boolean withEmbeddings)
Find some information in memory- 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
-
-