v2
latestOpenAPI 3.1.02026-08-0382170235.8 KBquery
query
Unified query with automatic routing
Execute a unified query against a POT with automatic strategy selection.
How it works:
- Classifies query (factual → CAG, semantic → RAG, relational → GraphRAG)
- Executes optimal strategy first
- Automatically falls back to RAG if CAG insufficient
- Returns results with routing metadata
Strategies:
- auto (default): Automatic selection based on query classification
- cag: Force CAG-only (fast, keyword-based)
- rag: Force RAG-only (semantic search with embeddings)
- graph_rag: Force GraphRAG (graph traversal for relational queries)
Fallback Logic: When enable_fallback=true and strategy=auto:
- If CAG returns suggestion != "sufficient", executes RAG
- If classification confidence is low, prefers RAG
- Metadata shows which strategy was actually used
Latency:
- CAG-only: ~50ms
- RAG: ~500ms
- CAG with fallback: ~550ms
- GraphRAG: ~200-800ms (depends on graph density)
post/pots/{pot_id}/query
Path parameters
pot_idstring required
POT identifier (UUID or slug)
POT identifier (UUID or slug)
Request body
Example request
{
"enable_fallback": true,
"filters": {
"domain": "architecture",
"levels": [
"CONSTITUTION",
"VERIFIED"
],
"tags": [
"core"
]
},
"query": "What is POT Index?",
"strategy": "auto",
"top_k": 5
}Response
Successful query
Example response
{
"data": {
"results": [
{
"content": "POT Index es el sistema de scoring...",
"domain": "architecture",
"fact_id": "01234567-89ab-cdef-0123-456789abcdef",
"level": "VERIFIED",
"match_details": {
"keyword_score": 0.95,
"matched_keywords": [
"POT",
"Index"
]
},
"pot_score": 0.85,
"score": 0.92,
"source": "cag",
"tags": [
"core",
"scoring"
]
}
],
"total_results": 1
},
"gap_signal": {
"average_score": 0.85,
"confidence": 0.85,
"high_certainty_facts": 1,
"is_knowledge_gap": false,
"reasons": [
"1_high_certainty_facts"
],
"threshold": 0.45,
"total_facts": 1,
"version": "v2"
},
"is_knowledge_gap": false,
"metadata": {
"cag_attempted": true,
"cag_duration_ms": 42,
"cag_results_count": 1,
"cag_suggestion": "sufficient",
"classification": {
"category": "factual",
"confidence": 0.9,
"reasoning": [
"What-question pattern detected"
],
"suggested_strategy": "cag"
},
"fallback_triggered": false,
"rag_duration_ms": 0,
"strategy_used": "cag",
"total_duration_ms": 45
}
}