retrieveFactsFromHistory

suspend fun AIAgentLLMWriteSession.retrieveFactsFromHistory(concept: Concept, clock: Clock = Clock.System): Fact(source)

Extracts facts about a specific concept from the LLM chat history.

This internal function:

  1. Adds a prompt to the LLM asking it to extract facts about the concept

  2. Processes the LLM's response into a structured Fact object

  3. Optionally removes the extraction messages from the chat history

The function handles both single and multiple facts based on the concept's factType.

Return

A Fact object (either SingleFact or MultipleFacts) containing the extracted information

Parameters

concept

The concept to extract facts about