saveFactsFromHistory
suspend fun saveFactsFromHistory(concept: Concept, subject: MemorySubject, scope: MemoryScope, preserveQuestionsInLLMChat: Boolean = false)(source)
Extracts and saves facts from the LLM chat history based on the provided concept.
This method:
Asks the LLM to extract facts about the specified concept from the conversation history
Formats the response as a Fact object (SingleFact or MultipleFacts)
Saves the fact to memory with the specified subject and scope
Example usage:
// Extract and save project dependencies from the conversation
memory.saveFactsFromHistory(
concept = Concept("project-dependencies", "Project build dependencies", FactType.MULTIPLE),
subject = MemorySubjects.Project,
scope = MemoryScope.Product("my-ide")
)
Content copied to clipboard
Parameters
concept
The concept to extract facts about
subject
The subject categorization for the facts (e.g., User, Project)
scope
The visibility scope for the facts (e.g., Agent, Feature, Product)
preserveQuestionsInLLMChat
If true, keeps the fact extraction messages in the chat history