- searches those indexes for the user’s question,
- adds the hits to the prompt,
- sends the prompt to the model, which answers.
Choose indexes
Name the indexes to search inindexes in the Moss SDKs. With curl or an OpenAI client, send the X-Moss-Indexes header.
X-Moss-Indexes: faq,policies.
- One request searches at most 32 indexes. More than 32 names returns
400. - An index outside this project returns
403.
Turn it off
To skip the search, name no index. The model then answers frominput alone.
To skip it on a call that still names indexes, set retrieve to False in Python or false in JavaScript, or send X-Moss-Retrieve: off.
Check what it costs
Each request that searches your indexes is one retrieval, however many indexes it names. The price is $0.50 / 1k retrievals.- The fee is the same on every model, and with your own vendor key.
- A request that names no index, or has the search off, is not a retrieval.
- A reply-cache hit is not a retrieval.
usage.input_tokens on Responses and usage.prompt_tokens on Chat Completions include them. See Pricing.
See how long it took
The reply headerX-Moss-Retrieve-Ms holds how long the search took, in milliseconds. This call prints it:
Get better answers
- Keep
instructionsshort and on one job, such as “You are the support agent for Acme.” - Name only the indexes a use case needs. Hits from unrelated documents then stay out of the prompt.
- On
moss/fastlane-1, the prompt, the retrieved facts and the reply share 262,144 tokens. Leave room formax_output_tokens. See Models. - Keep your indexes current. To create and update them, see Indexing data.