POST
/
chat
/
{assistant_name}
/
context
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant

from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")
assistant = pc.assistant.Assistant(assistant_name="example-assistant")

response = assistant.context(query="Who is the CFO of Netflix?")

for snippet in response.snippets:
    print(snippet)
{
    "snippets":
    [
        {
            "type":"text",
            "content":"EXHIBIT 31.3\nCERTIFICATION OF CHIEF FINANCIAL OFFICER\nPURSUANT TO SECTION 302 OF THE SARBANES-OXLEY ACT OF 2002\nI, Spencer Neumann, certify that: ...",
            "score":0.9960699,
            "reference":
            {
                "type":"pdf",
                "file":
                {
                    "status":"Available","id":"e6034e51-0bb9-4926-84c6-70597dbd07a7",
                    "name":"Netflix-10-K-01262024.pdf", 
                    "size":1073470,
                    "metadata":null,
                    "updated_on":"2024-11-21T22:59:10.426001030Z",
                    "created_on":"2024-11-21T22:58:35.879120257Z", 
                    "percent_done":1.0,
                    "signed_url":"https://storage.googleapis.com...",
                    "error_message":null
                    },
                "pages":[78]
            }
        },
{
    "type":"text",
    "content":"EXHIBIT 32.1\n..."
...
# To use the Python SDK, install the plugin:
# pip install --upgrade pinecone pinecone-plugin-assistant

from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")
assistant = pc.assistant.Assistant(assistant_name="example-assistant")

response = assistant.context(query="Who is the CFO of Netflix?")

for snippet in response.snippets:
    print(snippet)
{
    "snippets":
    [
        {
            "type":"text",
            "content":"EXHIBIT 31.3\nCERTIFICATION OF CHIEF FINANCIAL OFFICER\nPURSUANT TO SECTION 302 OF THE SARBANES-OXLEY ACT OF 2002\nI, Spencer Neumann, certify that: ...",
            "score":0.9960699,
            "reference":
            {
                "type":"pdf",
                "file":
                {
                    "status":"Available","id":"e6034e51-0bb9-4926-84c6-70597dbd07a7",
                    "name":"Netflix-10-K-01262024.pdf", 
                    "size":1073470,
                    "metadata":null,
                    "updated_on":"2024-11-21T22:59:10.426001030Z",
                    "created_on":"2024-11-21T22:58:35.879120257Z", 
                    "percent_done":1.0,
                    "signed_url":"https://storage.googleapis.com...",
                    "error_message":null
                    },
                "pages":[78]
            }
        },
{
    "type":"text",
    "content":"EXHIBIT 32.1\n..."
...

Authorizations

Api-Key
string
header
required

Pinecone API Key

Path Parameters

assistant_name
string
required

The name of the assistant to be described.

Body

application/json
The desired configuration to retrieve context from an assistant.

Parameters to retrieve context from an assistant.

query
string

The query that is used to generate the context. Exactly one of query or messages should be provided.

filter
object

Optionally filter which documents can be retrieved using the following metadata fields.

Example:
{ "genre": { "$ne": "documentary" } }
messages
object[]

The list of messages to use for generating the context. Exactly one of query or messages should be provided.

The MessageModel describes the format of a message in a chat.

top_k
integer

The number of context snippets to return. Default is 15.

Example:

20

Response

200
application/json
Context retrieval process successful.

The response format containing the context from an assistant.

snippets
object[]
required

The SnippetModel represents a part of a document that is relevant to the user query.

usage
object
required

The UsageModel describes the usage of a chat completion.

id
string