Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions hindsight-api-slim/tests/test_load_large_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

logger = logging.getLogger(__name__)

pytestmark = pytest.mark.xdist_group("load_batch_tests")


def generate_content(char_count: int) -> str:
"""Generate realistic content of approximately char_count characters."""
Expand Down Expand Up @@ -117,9 +119,18 @@ async def memory_with_mock_llm(self, pg0_db_url, embeddings, cross_encoder, quer
except Exception:
pass

@pytest.fixture
def disable_observations(self):
from hindsight_api.config import _get_raw_config
config = _get_raw_config()
original = config.enable_observations
config.enable_observations = False
yield
config.enable_observations = original

@pytest.mark.asyncio
@pytest.mark.timeout(300) # 5 minute timeout
async def test_large_batch_500k_chars_20_items(self, memory_with_mock_llm, request_context):
async def test_large_batch_500k_chars_20_items(self, memory_with_mock_llm, request_context, disable_observations):
"""
Test retaining a batch of 20 content items totaling ~500k chars.

Expand Down Expand Up @@ -283,7 +294,7 @@ async def mock_llm_call(*args, **kwargs):

@pytest.mark.asyncio
@pytest.mark.timeout(60)
async def test_db_connection_pool_under_load(self, memory_with_mock_llm, request_context):
async def test_db_connection_pool_under_load(self, memory_with_mock_llm, request_context, disable_observations):
"""
Test that DB connection pool handles concurrent operations.

Expand Down
2 changes: 2 additions & 0 deletions hindsight-api-slim/tests/test_retain.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ async def test_mentioned_at_vs_occurred(memory, request_context):
content="Alice graduated from MIT in March 2020.",
context="education history",
event_date=conversation_date, # When this conversation happened
fact_type_override="world",
request_context=request_context,
)

Expand Down Expand Up @@ -1149,6 +1150,7 @@ async def test_chunk_fact_mapping(memory, request_context):
content=content,
context="technical documentation",
document_id=document_id,
fact_type_override="world",
request_context=request_context,
)

Expand Down
Loading