hindsight-api 0.1.7__tar.gz → 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/PKG-INFO +1 -1
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/api/http.py +16 -12
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/memory_engine.py +3 -3
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/pyproject.toml +1 -1
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/.gitignore +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/README.md +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/__init__.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/README +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/env.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/script.py.mako +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/5a366d414dce_initial_schema.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/b7c4d8e9f1a2_add_chunks_table.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/c8e5f2a3b4d1_add_retain_params_to_documents.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/d9f6a3b4c5e2_rename_bank_to_interactions.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/e0a1b2c3d4e5_disposition_to_3_traits.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/alembic/versions/rename_personality_to_disposition.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/api/__init__.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/api/mcp.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/banner.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/config.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/__init__.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/cross_encoder.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/db_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/embeddings.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/entity_resolver.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/llm_wrapper.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/query_analyzer.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/response_models.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/__init__.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/bank_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/chunk_storage.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/deduplication.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/embedding_processing.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/embedding_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/entity_processing.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/fact_extraction.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/fact_storage.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/link_creation.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/link_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/observation_regeneration.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/orchestrator.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/types.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/__init__.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/fusion.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/graph_retrieval.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/mpfp_retrieval.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/observation_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/reranking.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/retrieval.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/scoring.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/temporal_extraction.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/think_utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/trace.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/tracer.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/types.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/task_backend.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/utils.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/main.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/mcp_local.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/metrics.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/migrations.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/models.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/pg0.py +0 -0
- {hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/server.py +0 -0
|
@@ -506,9 +506,9 @@ class BankListItem(BaseModel):
|
|
|
506
506
|
"""Bank list item with profile summary."""
|
|
507
507
|
|
|
508
508
|
bank_id: str
|
|
509
|
-
name: str
|
|
509
|
+
name: str | None = None
|
|
510
510
|
disposition: DispositionTraits
|
|
511
|
-
background: str
|
|
511
|
+
background: str | None = None
|
|
512
512
|
created_at: str | None = None
|
|
513
513
|
updated_at: str | None = None
|
|
514
514
|
|
|
@@ -1452,18 +1452,22 @@ def _register_routes(app: FastAPI):
|
|
|
1452
1452
|
bank_id,
|
|
1453
1453
|
)
|
|
1454
1454
|
|
|
1455
|
+
def parse_metadata(metadata):
|
|
1456
|
+
"""Parse result_metadata which may be a string or dict."""
|
|
1457
|
+
if metadata is None:
|
|
1458
|
+
return {}
|
|
1459
|
+
if isinstance(metadata, str):
|
|
1460
|
+
return json.loads(metadata)
|
|
1461
|
+
return metadata
|
|
1462
|
+
|
|
1455
1463
|
return {
|
|
1456
1464
|
"bank_id": bank_id,
|
|
1457
1465
|
"operations": [
|
|
1458
1466
|
{
|
|
1459
1467
|
"id": str(row["operation_id"]),
|
|
1460
1468
|
"task_type": row["operation_type"],
|
|
1461
|
-
"items_count": row["result_metadata"].get("items_count", 0)
|
|
1462
|
-
|
|
1463
|
-
else 0,
|
|
1464
|
-
"document_id": row["result_metadata"].get("document_id")
|
|
1465
|
-
if row["result_metadata"]
|
|
1466
|
-
else None,
|
|
1469
|
+
"items_count": parse_metadata(row["result_metadata"]).get("items_count", 0),
|
|
1470
|
+
"document_id": parse_metadata(row["result_metadata"]).get("document_id"),
|
|
1467
1471
|
"created_at": row["created_at"].isoformat(),
|
|
1468
1472
|
"status": row["status"],
|
|
1469
1473
|
"error_message": row["error_message"],
|
|
@@ -1499,7 +1503,7 @@ def _register_routes(app: FastAPI):
|
|
|
1499
1503
|
async with acquire_with_retry(pool) as conn:
|
|
1500
1504
|
# Check if operation exists and belongs to this memory bank
|
|
1501
1505
|
result = await conn.fetchrow(
|
|
1502
|
-
"SELECT bank_id FROM async_operations WHERE
|
|
1506
|
+
"SELECT bank_id FROM async_operations WHERE operation_id = $1 AND bank_id = $2", op_uuid, bank_id
|
|
1503
1507
|
)
|
|
1504
1508
|
|
|
1505
1509
|
if not result:
|
|
@@ -1508,7 +1512,7 @@ def _register_routes(app: FastAPI):
|
|
|
1508
1512
|
)
|
|
1509
1513
|
|
|
1510
1514
|
# Delete the operation
|
|
1511
|
-
await conn.execute("DELETE FROM async_operations WHERE
|
|
1515
|
+
await conn.execute("DELETE FROM async_operations WHERE operation_id = $1", op_uuid)
|
|
1512
1516
|
|
|
1513
1517
|
return {
|
|
1514
1518
|
"success": True,
|
|
@@ -1769,13 +1773,13 @@ def _register_routes(app: FastAPI):
|
|
|
1769
1773
|
async with acquire_with_retry(pool) as conn:
|
|
1770
1774
|
await conn.execute(
|
|
1771
1775
|
"""
|
|
1772
|
-
INSERT INTO async_operations (
|
|
1776
|
+
INSERT INTO async_operations (operation_id, bank_id, operation_type, result_metadata)
|
|
1773
1777
|
VALUES ($1, $2, $3, $4)
|
|
1774
1778
|
""",
|
|
1775
1779
|
operation_id,
|
|
1776
1780
|
bank_id,
|
|
1777
1781
|
"retain",
|
|
1778
|
-
len(contents),
|
|
1782
|
+
json.dumps({"items_count": len(contents)}),
|
|
1779
1783
|
)
|
|
1780
1784
|
|
|
1781
1785
|
# Submit task to background queue
|
|
@@ -311,7 +311,7 @@ class MemoryEngine:
|
|
|
311
311
|
pool = await self._get_pool()
|
|
312
312
|
async with acquire_with_retry(pool) as conn:
|
|
313
313
|
result = await conn.fetchrow(
|
|
314
|
-
"SELECT
|
|
314
|
+
"SELECT operation_id FROM async_operations WHERE operation_id = $1", uuid.UUID(operation_id)
|
|
315
315
|
)
|
|
316
316
|
if not result:
|
|
317
317
|
# Operation was cancelled, skip processing
|
|
@@ -369,7 +369,7 @@ class MemoryEngine:
|
|
|
369
369
|
try:
|
|
370
370
|
pool = await self._get_pool()
|
|
371
371
|
async with acquire_with_retry(pool) as conn:
|
|
372
|
-
await conn.execute("DELETE FROM async_operations WHERE
|
|
372
|
+
await conn.execute("DELETE FROM async_operations WHERE operation_id = $1", uuid.UUID(operation_id))
|
|
373
373
|
except Exception as e:
|
|
374
374
|
logger.error(f"Failed to delete async operation record {operation_id}: {e}")
|
|
375
375
|
|
|
@@ -386,7 +386,7 @@ class MemoryEngine:
|
|
|
386
386
|
"""
|
|
387
387
|
UPDATE async_operations
|
|
388
388
|
SET status = 'failed', error_message = $2
|
|
389
|
-
WHERE
|
|
389
|
+
WHERE operation_id = $1
|
|
390
390
|
""",
|
|
391
391
|
uuid.UUID(operation_id),
|
|
392
392
|
truncated_error,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/embedding_processing.py
RENAMED
|
File without changes
|
|
File without changes
|
{hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/entity_processing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/retain/observation_regeneration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/observation_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hindsight_api-0.1.7 → hindsight_api-0.1.8}/hindsight_api/engine/search/temporal_extraction.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|