Prepare documents
Clean and split documents, retaining stable IDs, source URLs and access metadata. Send batches toPOST https://infistar.ai/v1/embeddings with your Bearer key:
data[index].embedding alongside the corresponding source passage. Query and document vectors must use the same model and preprocessing. Re-embed documents when changing embedding models.
Retrieve and rerank
Embed the user’s query and retrieve candidates from your own vector database. Apply tenant and document permissions before sending candidates to another API. Keep the original candidate order. SendPOST https://infistar.ai/v1/rerank:
results, and use each result’s index to retrieve the original passage and source. Do not use the result’s array position as the source index. Choose candidate counts and relevance thresholds using representative questions; scores are not interchangeable across models.
Generate an answer
Put the selected passages intomessages for Chat Completions or input for Responses. Limit context to the model’s capacity. Keep source IDs and URLs yourself so displayed citations correspond to real documents.
Validate before release
- Keep keys on your server and filter unauthorized passages before retrieval results leave it.
- Test index-to-source mapping and separately handle authentication, permission, rate-limit and server errors.
- Compare retrieval alone with retrieval plus reranking for quality, latency and cost using your own data.
- Record the public model ID, endpoint, request time and source IDs needed to reproduce an answer.