# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
response = pc.assistants.context(
assistant_name="example-assistant",
query="Who is the CFO of Netflix?",
)
for snippet in response.snippets:
print(snippet.score, snippet.content)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const response = await assistant.context({
query: 'Who is the CFO of Netflix?',
});
console.log(response.snippets);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/context" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Pinecone-Api-Version: 2026-07" \
-d '{
"query": "Who is the CFO of Netflix?"
}'
{
"snippets": [
{
"type": "<string>",
"content": "<string>",
"score": 123,
"reference": {
"type": "<string>",
"file": {
"name": "<string>",
"id": "<string>",
"size": 1048576,
"metadata": {
"created_by": "Jane Doe",
"published": "2025-10-01T00:00:00.000Z",
"tags": [
"report",
"Q4",
"analytics"
]
},
"created_on": "2025-10-01T12:30:00.000Z",
"updated_on": "2025-10-01T12:45:00.000Z",
"status": "<string>",
"signed_url": "https://storage.googleapis.com/bucket/file.pdf?...",
"multimodal": true
}
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"id": "<string>"
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Uploaded file can only currently be either a pdf or txt file"
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "NOT_FOUND",
"message": "Assistant \"example-assistant\" not found."
},
"status": 404
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}Context snippets
Retrieve context from an assistant
Retrieve context snippets from an assistant to use as part of RAG or any agentic flow.
For guidance and examples, see Retrieve context snippets.
POST
/
chat
/
{assistant_name}
/
context
# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
response = pc.assistants.context(
assistant_name="example-assistant",
query="Who is the CFO of Netflix?",
)
for snippet in response.snippets:
print(snippet.score, snippet.content)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const response = await assistant.context({
query: 'Who is the CFO of Netflix?',
});
console.log(response.snippets);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/context" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Pinecone-Api-Version: 2026-07" \
-d '{
"query": "Who is the CFO of Netflix?"
}'
{
"snippets": [
{
"type": "<string>",
"content": "<string>",
"score": 123,
"reference": {
"type": "<string>",
"file": {
"name": "<string>",
"id": "<string>",
"size": 1048576,
"metadata": {
"created_by": "Jane Doe",
"published": "2025-10-01T00:00:00.000Z",
"tags": [
"report",
"Q4",
"analytics"
]
},
"created_on": "2025-10-01T12:30:00.000Z",
"updated_on": "2025-10-01T12:45:00.000Z",
"status": "<string>",
"signed_url": "https://storage.googleapis.com/bucket/file.pdf?...",
"multimodal": true
}
}
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
},
"id": "<string>"
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Uploaded file can only currently be either a pdf or txt file"
},
"status": 400
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Invalid API key."
},
"status": 401
}{
"error": {
"code": "NOT_FOUND",
"message": "Assistant \"example-assistant\" not found."
},
"status": 404
}{
"error": {
"code": "UNKNOWN",
"message": "Internal server error"
},
"status": 500
}# pip install --upgrade pinecone
import os
from pinecone import Pinecone
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
response = pc.assistants.context(
assistant_name="example-assistant",
query="Who is the CFO of Netflix?",
)
for snippet in response.snippets:
print(snippet.score, snippet.content)
// npm install @pinecone-database/pinecone
import { Pinecone } from '@pinecone-database/pinecone';
// Reads PINECONE_API_KEY from the environment
const pc = new Pinecone();
const assistant = pc.assistant({ name: 'example-assistant' });
const response = await assistant.context({
query: 'Who is the CFO of Netflix?',
});
console.log(response.snippets);
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"
curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME/context" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Pinecone-Api-Version: 2026-07" \
-d '{
"query": "Who is the CFO of Netflix?"
}'
Body
application/json
The desired configuration to retrieve context from an assistant.
Parameters to retrieve context from an assistant.
Response
Context retrieval process successful.
Describes the context returned by an assistant in response to a query.
Was this page helpful?