@pentatonic-ai/ai-agent-sdk 0.7.5 → 0.7.6
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pentatonic-ai/ai-agent-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "TES SDK — LLM observability and lifecycle tracking via Pentatonic Thing Event System. Track token usage, tool calls, and conversations. Manage things through event-sourced lifecycle stages with AI enrichment and vector search.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -420,12 +420,19 @@ async def health():
|
|
|
420
420
|
if failures:
|
|
421
421
|
out["status"] = "degraded" if failures < 3 else "down"
|
|
422
422
|
|
|
423
|
-
# Memory count: query L6 doc-store as authoritative.
|
|
423
|
+
# Memory count: query L6 doc-store as authoritative. L6 /stats
|
|
424
|
+
# returns vector_chunks (Milvus) and fts_chunks (sqlite content
|
|
425
|
+
# table). Under healthy operation they're equal — take the max so
|
|
426
|
+
# the count is honest if one side is mid-rebuild.
|
|
424
427
|
try:
|
|
425
428
|
r = await _client().get(f"{L6_DOC_URL}/stats", timeout=3.0)
|
|
426
429
|
if r.status_code == 200:
|
|
427
430
|
stats = r.json()
|
|
428
|
-
out["memories"] =
|
|
431
|
+
out["memories"] = max(
|
|
432
|
+
int(stats.get("vector_chunks") or 0),
|
|
433
|
+
int(stats.get("fts_chunks") or 0),
|
|
434
|
+
int(stats.get("total_chunks") or 0),
|
|
435
|
+
)
|
|
429
436
|
except Exception:
|
|
430
437
|
out["memories"] = None
|
|
431
438
|
return out
|
|
@@ -29,20 +29,26 @@ services:
|
|
|
29
29
|
retries: 20
|
|
30
30
|
start_period: 5s
|
|
31
31
|
|
|
32
|
+
# Pin the embedding dim explicitly across layers, independent of any
|
|
33
|
+
# developer-local .env (which may set EMBED_DIM=768 for Ollama-based
|
|
34
|
+
# local dev). The stub returns 4096; layers must agree.
|
|
32
35
|
l4:
|
|
33
36
|
environment:
|
|
34
37
|
L4_NV_EMBED_URL: http://embed-stub:8041/v1/embeddings
|
|
35
38
|
L4_EMBED_API_KEY: ""
|
|
39
|
+
L4_EMBED_DIM: "4096"
|
|
36
40
|
|
|
37
41
|
l5:
|
|
38
42
|
environment:
|
|
39
43
|
L5_NV_EMBED_URL: http://embed-stub:8041/v1/embeddings
|
|
40
44
|
L5_EMBED_API_KEY: ""
|
|
45
|
+
L5_EMBED_DIM: "4096"
|
|
41
46
|
|
|
42
47
|
l6:
|
|
43
48
|
environment:
|
|
44
49
|
L6_NV_EMBED_URL: http://embed-stub:8041/v1/embeddings
|
|
45
50
|
L6_EMBED_API_KEY: ""
|
|
51
|
+
L6_EMBED_DIM: "4096"
|
|
46
52
|
|
|
47
53
|
l2:
|
|
48
54
|
environment:
|
|
@@ -911,16 +911,34 @@ def serve(port: int = DEFAULT_PORT):
|
|
|
911
911
|
milvus.insert(collection_name=COLLECTION_NAME, data=rows)
|
|
912
912
|
insert_ms = (_time.time() - t1) * 1000.0
|
|
913
913
|
|
|
914
|
-
# Single FTS write
|
|
914
|
+
# Single FTS write — into the `chunks` content table; the
|
|
915
|
+
# AFTER INSERT trigger replicates rows into the chunks_fts
|
|
916
|
+
# virtual table so BM25 search (which JOINs chunks ON rowid)
|
|
917
|
+
# actually finds them. Earlier versions wrote directly to
|
|
918
|
+
# chunks_fts, leaving `chunks` empty — which made BM25 return
|
|
919
|
+
# zero hits AND broke the /stats fts_chunks counter.
|
|
915
920
|
try:
|
|
916
921
|
fts_conn = get_fts_db()
|
|
917
922
|
for r, txt in zip(records, texts):
|
|
918
923
|
rid = r.get("id") or _hashlib.sha1(txt.encode("utf-8")).hexdigest()[:32]
|
|
924
|
+
chunk_id = f"l6:{rid}:0"[:63]
|
|
919
925
|
fts_conn.execute(
|
|
920
|
-
"INSERT
|
|
921
|
-
"
|
|
922
|
-
|
|
923
|
-
|
|
926
|
+
"INSERT OR REPLACE INTO chunks "
|
|
927
|
+
"(id, text, source_file, arena, doc_type, heading, "
|
|
928
|
+
" chunk_index, content_hash, entities_json, indexed_at) "
|
|
929
|
+
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
930
|
+
(
|
|
931
|
+
chunk_id,
|
|
932
|
+
txt,
|
|
933
|
+
(r.get("source_file") or f"{rid}.md"),
|
|
934
|
+
arena,
|
|
935
|
+
(r.get("doc_type") or "general"),
|
|
936
|
+
(r.get("heading") or ""),
|
|
937
|
+
0,
|
|
938
|
+
_hashlib.sha1(txt.encode("utf-8")).hexdigest()[:20],
|
|
939
|
+
"[]",
|
|
940
|
+
now,
|
|
941
|
+
),
|
|
924
942
|
)
|
|
925
943
|
fts_conn.commit()
|
|
926
944
|
fts_conn.close()
|