Skip to main content
POST

Process Query

Main endpoint for querying the RAG system. Performs semantic search in your documents and generates an intelligent response based on the found context.

Endpoint

Request Body

string
required
The user’s question or query
string
ID of the collection to query (default: all collections)
integer
default:"5"
Maximum number of source documents to retrieve (1-20)
boolean
default:"true"
Use the LLM to generate a response. If false, returns only relevant sources.
object
Metadata filters to refine the search

Response

string
Unique query identifier
string
Response generated by the LLM (null if use_llm=false)
array
List of source documents used
integer
Execution time in milliseconds
string
ISO 8601 query timestamp

Examples

Error Codes

Bad Request
Invalid request (missing or incorrect parameters)
Internal Server Error
Server error (LLM unavailable, processing error)
Gateway Timeout
Request timeout (>60 seconds)

Best Practices

  • Adjust max_results according to your needs (less = faster)
  • Use use_llm=false for pure search without generation
  • Add metadata filters to refine the search
  • Formulate clear and precise questions
  • Use terms specific to your domain
  • Increase max_results for more context (5-10)

Limitations

  • Timeout: 60 seconds maximum per query
  • Query length: 1000 characters maximum
  • LLM context: Limited by model’s context window (~2048-4096 tokens)

Technical Notes

Search Process

  1. Query embedding: Conversion to vector (384 dimensions)
  2. Vector search: K-nearest neighbors search in Qdrant (cosine similarity)
  3. Filtering: Application of metadata filters if provided
  4. Relevance threshold: Only results with score > 0.7 are kept
  5. Content retrieval: Getting full text of chunks
  6. LLM generation: Prompt construction and response generation

LLM Prompt Format

See Also

Upload Documents

Add documents to the system

Collections

Organize your documents