fleet-memory/hindsight-api/tests/test_think.py
Nicolò Boschi ab5e31f203
chore: remove dead code (#245)
* chore: remove dead code

* chore: remove extract_opinions from test and regenerate openapi

- Remove extract_opinions parameter from test_fact_extraction_analysis
- Regenerate OpenAPI spec after removing entity observations code

* chore: update generated files and apply formatting

- Regenerate Python and TypeScript client SDKs after main merge
- Apply ruff formatting to llm_wrapper.py

* fix: accept and filter deprecated 'opinion' fact type in recall

The dead code removal eliminated support for the 'opinion' fact type,
but existing clients may still pass it. Instead of rejecting it with
a ValueError, silently filter it out before validation to maintain
backward compatibility.
2026-01-30 09:16:32 +01:00

31 lines
975 B
Python

"""
Test reflect (think) function.
"""
import pytest
from datetime import datetime, timezone
from hindsight_api.engine.memory_engine import Budget
from hindsight_api import RequestContext
@pytest.mark.asyncio
async def test_think_without_prior_context(memory, request_context):
"""
Test that think function handles queries when there's no relevant context.
"""
bank_id = f"test_think_no_context_{datetime.now(timezone.utc).timestamp()}"
# Call think without storing any prior facts
result = await memory.reflect_async(
bank_id=bank_id,
query="What is the capital of France?",
budget=Budget.LOW,
request_context=request_context,
)
print(f"\n=== Think Without Context ===")
print(f"Answer: {result.text}")
# Should still return an answer (even if it says it doesn't have enough info)
assert result.text, "Should return some answer"
assert result.based_on, "Should return based_on structure"