語義整理(Catalog)
按相似度而不只是按規則來決定該評審哪些智慧體軌跡。條目上的嵌入索引支援相似度檢索(“找出和這次失敗類似的軌跡”)以及動態切片:儲存下來的語義與後設資料過濾器,會自動納入新匹配的軌跡並把它們整理進資料集。
語義整理幫你按相似度找出該評審什麼,而不只是靠規則或不確定性。 條目上的嵌入索引支援相似度檢索(“找出和這次失敗類似的軌跡”),也支援動態切片:儲存下來的語義與後設資料過濾器,會自動納入新匹配的軌跡,並把它們整理進資料集。它是基於規則的分診和基於模型不確定性的主動學習的補充。
啟用
yaml
curation:
enabled: true
model_name: all-MiniLM-L6-v2 # any sentence-transformers model
embed_on_ingest: false # index runtime-ingested traces on arrival
text_key: task_description # which field to embed嵌入是惰性的:sentence-transformers 只在你構建索引時才匯入,啟動時不會載入,因此啟動依然很快。用 pip install sentence-transformers 安裝它,或者接入自定義的嵌入器。啟用後,管理面板會出現 Catalog 連結。
構建、檢索、切片
bash
# Build the index over current items
curl -X POST localhost:8000/admin/catalog/api/build -H "X-API-Key: <key>"
# Search by text query (or by an anchor instance to find neighbours)
curl -X POST localhost:8000/admin/catalog/api/search -H "X-API-Key: <key>" \
-H "Content-Type: application/json" -d '{"query": "tool call failed", "top_k": 10, "threshold": 0.3}'一個切片是儲存下來的過濾器,按需針對當前索引求值,因此儲存之後攝入的軌跡只要匹配就會自動被納入。它把一個可選的語義鄰域和一個後設資料過濾器組合在一起:
bash
curl -X POST localhost:8000/admin/catalog/api/slices -H "X-API-Key: <key>" \
-H "Content-Type: application/json" \
-d '{"name": "tool-errors", "query": "tool call failed", "threshold": 0.3,
"metadata_filter": [{"field": "metadata.outcome", "equals": "error"}]}'
# Curate the resolved instances straight into a dataset
curl -X POST localhost:8000/admin/catalog/api/slices/tool-errors/to_dataset \
-H "X-API-Key: <key>" -H "Content-Type: application/json" \
-d '{"dataset": "tool-errors-to-fix"}'相關內容
- Read the Docs 上的完整參考 —— 完整的切片/嵌入 API,與版本匹配
- 資料集與實驗 —— 切片整理的目標
- 自動化規則 —— 基於規則的路由(共享同一套條件語法)
- 分診佇列 —— 基於訊號的優先順序排序