Interface SemanticTextMemory

  • All Superinterfaces:
    Buildable
    All Known Implementing Classes:
    NullMemory

    public interface SemanticTextMemory
    extends Buildable
    An interface for semantic memory that creates and recalls memories associated with text.
    • Method Detail

      • 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,
                                                                         float minRelevanceScore,
                                                                         boolean withEmbeddings)
        Find some information in memory
        Parameters:
        collection - Collection to search
        query - What to search for
        limit - How many results to return
        minRelevanceScore - 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

        reactor.core.publisher.Mono<List<String>> getCollectionsAsync()
        Gets a group of all available collection names.
        Returns:
        A group of collection names.