Execute natural language queries with automatic domain detection, pipeline routing, and vector fallback. The query endpoints interface with MainOrchestrator to process queries through the three-pipeline architecture.
POST
/api/v1/query
Execute a natural language query with automatic domain detection and intelligent pipeline routing (Knowledge Graph, Text-to-SQL, or Vector Search).
In auto mode, the system analyzes query intent using keywords and patterns. SQL-related terms trigger Text-to-SQL, bulk retrieval terms use vector search, and complex reasoning queries route to KG-RAG.
POST
/api/v1/query/vector-bypass
Fast vector similarity search bypassing the full RAG pipeline. Ideal for bulk document retrieval and scenarios where you need rapid results without answer generation.
Request Parameters
Parameter
Type
Required
Description
query
string
Yes
Search query for semantic retrieval
top_k
integer
No
Number of results to return (1-100, default: 20)
include_reranking
boolean
No
Apply LLM re-ranking to results (default: true)
reranker_method
string
No
Re-ranking method: listwise or pointwise (default: listwise)
kg_names
string[]
No
Specific KGs to search
include_search_details
boolean
No
Include detailed search metadata (default: false)
Performance
Vector bypass is 3-5x faster than full RAG since it skips answer generation. Best for previews, bulk retrieval, or when you'll post-process results externally.
POST
/api/v1/query-sql
Convert natural language questions to SQL queries and execute them against the knowledge graph database. Ideal for structured data retrieval and analytical queries.
Request Parameters
Parameter
Type
Required
Description
query
string
Yes
Natural language query to convert to SQL
max_results
integer
No
Maximum SQL results (1-1000, default: 100)
include_explanation
boolean
No
Include SQL generation explanation (default: true)
include_execution_plan
boolean
No
Include SQL execution plan (default: false)
validate_query
boolean
No
Validate SQL before execution (default: true)
query_type
string
No
Type hint: auto, select, aggregate, join, subquery (default: auto)
table_hints
string[]
No
Suggested tables to query
SQL Safety
All generated SQL queries are validated before execution. Only SELECT statements are permitted - no data modification operations.