Documentation Index
Fetch the complete documentation index at: https://mintlify.com/intuit-ai-research/REMem/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheTemporalStrategy is designed for temporal knowledge extraction and retrieval, where facts include time qualifiers. It’s ideal for time-sensitive information, historical data, and event-based applications.
Class Definition
Methods
index()
Index documents using temporal extraction with time-qualified facts.docs(List): List of documents to index
-
Temporal Extraction: Extracts facts with temporal qualifiers:
- Subject-predicate-object triples
- Time qualifiers (dates, time periods, temporal expressions)
- Additional qualifiers (location, context, etc.)
-
Graph Construction: Builds a temporal knowledge graph:
- Verbatim nodes (original text)
- Fact nodes (temporal facts with qualifiers)
- Entity nodes (subjects and objects)
- Time entity nodes (temporal expressions)
- Incremental Updates: Only processes new documents if existing components exist
rag_for_qa()
Run question-answering evaluation using agent-based retrieval for temporal data.queries: Input queries (strings or QuerySolution objects)num_to_retrieve(int): Number of documents to retrieve per query (default: 5)gold_answers(optional): Gold standard answers for evaluationgold_docs(optional): Gold standard documents for evaluationmetrics(tuple): Evaluation metrics to computequestion_metadata(optional): Additional metadata for questions**kwargs: Additional parameters
- Tuple containing:
List[QuerySolution]: Query solutions with retrieved documents and answersList[str]: Response messagesList[Dict]: MetadataDict: Retrieval metricsDict: QA metrics
- Uses agent-based retrieval with temporal reasoning
- Traverses the temporal knowledge graph
- Considers time qualifiers in retrieval and ranking
- Returns verbatim content by default
retrieve_each_query()
Retrieve documents for a single query using temporal graph traversal.query(str): Input queryreturn_chunk(optional): Type of chunk to return ("verbatim"or"facts")
- Retrieved chunk IDs, similarity scores, and agent result
- Uses GraphAgent for multi-turn reasoning over temporal graph
- Considers temporal relationships in retrieval
- Can return verbatim content or temporal facts
Temporal Graph Structure
The temporal strategy creates a graph with temporal relationships:- Verbatim → Fact: “contains_fact”
- Fact → Entity: Extracted from subject/object
- Fact → Time Entity: Temporal qualifiers
- Entity → Entity: Relationships from facts
Use Cases
TheTemporalStrategy is ideal for:
- Historical QA: Answering questions about historical events
- Time-Sensitive Information: Retrieving facts valid at specific times
- Event Timelines: Building and querying event sequences
- Temporal Reasoning: Understanding when events occurred relative to each other
- Change Tracking: Tracking how facts change over time
- Historical knowledge bases
- News article archives
- Scientific literature with publication dates
- Legal documents with effective dates
- Medical records with timestamps
Configuration Example
Helper Methods
_get_graph_info()
Get information about the temporal graph structure.- Dictionary containing:
num_verbatim_nodes: Number of verbatim nodesnum_entity_nodes: Number of entity nodesnum_temporal_fact_nodes: Number of temporal fact nodesnum_total_nodes: Total number of nodesnum_edges: Total number of edgesigraph_vertex_count: Number of vertices in the graph