Implementation:24kchengYe MemoMind Core Response Models
| Knowledge Sources | |
|---|---|
| Domains | Memory_System, Data_Models |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
Core Pydantic response models for memory operations — defines shared data structures used across the engine, API, and reflect agent including the fact type taxonomy.
Description
The response_models.py module defines `RecallResult`, `ReflectResult`, `MemoryFact`, `TokenUsage`, `LLMToolCall`, `ToolCallTrace`, `LLMCallTrace`, `EntityObservation`, `ObservationRef`, `DirectiveRef`, `DispositionTraits`, and `VALID_RECALL_FACT_TYPES` constant (world, experience, observation). These are internal models separate from API response models for stability — the core engine uses these, and the API layer converts from them.
Usage
Import these models when working with engine-level responses, building API serializers, or the reflect agent. The fact type taxonomy (world/experience/observation) is central to the memory architecture.
Code Reference
Source Location
- Repository: MemoMind
- File: engine/hindsight_api/engine/response_models.py
- Lines: L1-376
Signature
VALID_RECALL_FACT_TYPES = frozenset(["world", "experience", "observation"])
class LLMToolCall(BaseModel):
id: str
name: str
arguments: dict[str, Any]
class LLMToolCallResult(BaseModel):
content: str | None
tool_calls: list[LLMToolCall]
finish_reason: str | None
input_tokens: int
output_tokens: int
class TokenUsage(BaseModel):
input_tokens: int
output_tokens: int
class DispositionTraits(BaseModel):
skepticism: int # 1-5
literalism: int # 1-5
empathy: int # 1-5
class MemoryFact(BaseModel):
text: str
fact_type: str
# ... temporal fields, metadata
class RecallResult(BaseModel): ...
class ReflectResult(BaseModel): ...
Import
from hindsight_api.engine.response_models import (
RecallResult, ReflectResult, MemoryFact, TokenUsage,
LLMToolCall, LLMToolCallResult, DispositionTraits,
VALID_RECALL_FACT_TYPES,
)
I/O Contract
Outputs
| Name | Type | Description |
|---|---|---|
| VALID_RECALL_FACT_TYPES | frozenset | {"world", "experience", "observation"} |
| RecallResult | BaseModel | Search results with facts and metadata |
| ReflectResult | BaseModel | Reflection output with observations |
Usage Examples
Using Response Models
from hindsight_api.engine.response_models import (
RecallResult, VALID_RECALL_FACT_TYPES, DispositionTraits,
)
# Check valid fact types
assert "world" in VALID_RECALL_FACT_TYPES
assert "opinion" not in VALID_RECALL_FACT_TYPES # deprecated
# Create disposition traits
traits = DispositionTraits(skepticism=3, literalism=4, empathy=2)