Queries

Top Snippets

Get the top K snippets that match the given query.

You may choose between coarse and precise snippets. Precise snippets will average ~200 characters, while coarse snippets will average ~2000 characters. The default is coarse snippets. Use the precise_responses parameter to adjust.

post/queries/top-snippets

Request body

collection_namestring required

The name of the collection.

querystring required

The natural language query to search with. This cannot exceed 4096 characters (A single UTF-8 codepoint, is considered to be 1 character).

kinteger required

The number of snippets to return. If there are not enough snippets matching your filters, then fewer may be returned. This number must be between 1 and 128, inclusive.

rerankerstring nullable

The reranker to use after initial retrieval. The default is null. You can find available model ids, along with more information, at /models/rerank.

filterStrJson
precise_responsesboolean

Enable precise responses. Precise responses will have higher latency, but provide much more precise snippets. When precise_responses is set to true, the responses will average 200 characters. If set to false, the responses will average 2000 characters. The default is false.

include_document_metadataboolean

If true, the document_results returns will additionally contain document metadata. This is false by default, as returning metadata can add overhead if the amount of data to return is large.

Response

Successful Response

Changes