Query Chunks
Retrieves relevant chunks from a specific knowledgebase based on a semantic search query.Endpoint
Path Parameters
The unique identifier of the knowledgebase to query
Headers
Your project API key for authentication
Query Parameters
The search query to match against the knowledgebase content
Maximum number of results to return. Defaults to 5
Minimum relevance score for chunks to be included. Defaults to 0.3
Response
Returns an array of chunks that match the query, ordered by relevance.Unique identifier for the chunk
The content of the chunk
Length of the chunk content
Whether the chunk is enabled for search
Error Responses
Status Code | Description |
---|---|
400 | Invalid query parameters or missing knowledgebase ID |
401 | Invalid API key |
404 | Knowledgebase not found or access denied |
500 | Internal server error |
How It Works
- The knowledgebase is validated to ensure it exists and belongs to your project
- The query text is converted into embeddings using the same model as the knowledgebase
- The embeddings are used to perform semantic similarity search against stored chunks
- The most relevant chunks are returned, ordered by similarity score
- Results are limited to the specified topK parameter
Usage Notes
- Queries are processed using semantic search, not exact text matching
- Results are returned in order of relevance to the query
- The response includes the most relevant chunks from the specified knowledgebase only
- Use the topK parameter to control the number of results returned
- Consider the context when formulating queries for best results
- The knowledgebase must belong to the project associated with your API key