Skip to main content
Retrieve context snippets and citations from an assistant to use with your own LLM, RAG application, or agentic workflow.
To try this in your browser, use the Pinecone Assistant - Context colab notebook.

Retrieve snippets with the API or an SDK

To retrieve context snippets from an assistant, call context:
The example above returns a response like the following:
Response
signed_url provides temporary, read-only access to the relevant file. Anyone with the link can access the file, so treat it as sensitive data. Expires in one hour.

Control the snippets retrieved

This is available in API versions 2025-04 and later.
You can limit token usage by tuning top_k * snippet_size:
  • snippet_size: Controls the max size of a snippet, from 512 to 8192 tokens (default 2048). Note that snippet size can vary and, in rare cases, may be bigger than the set snippet_size. Snippet size controls the amount of context given for each chunk of text.
  • top_k: Controls the max number of context snippets retrieved, up to 64 (default 16). top_k controls the diversity of information received in the returned snippets.
While additional tokens will be used for other parameters, adjusting the top_k and snippet_size can help manage token consumption.