Chat with an assistant
The OpenAI-compatible chat interface can return responses in two different formats:- Default response: The assistant returns a response in a single string field, which includes citation information.
- Streaming response: The assistant returns the response as a text stream.
Default response
The following example sends a message and requests a response in the default format:The
content parameter in the request cannot be empty.Streaming response
Streaming responses can improve perceived latency by allowing users to see content as it’s generated, rather than waiting for the complete response. This creates a more responsive chat experience, especially for longer responses. The following example sends a message and requests a streaming response:The
content parameter in the request cannot be empty.- Message start: Includes
"role":"assistant", which indicates that the assistant is responding to the user’s message. - Content: Includes a value in the
contentfield (e.g.,"content":"The"), which is part of the assistant’s streamed response to the user’s message. - Message end: Includes
"finish_reason":"stop", which indicates that the assistant has finished responding to the user’s message.
Extract the response content
In the assistant’s response, the message string is contained in the following JSON object:choices.[0].message.contentfor the default chat responsechoices[0].delta.contentfor the streaming chat response
- Default response
- Streaming response
Choose a model
Pinecone Assistant supports the following models:gpt-4o(default)gpt-4.1gpt-5o4-miniclaude-sonnet-4-5gemini-2.5-pro
Anthropic has deprecated the Claude 3.5 Sonnet and Claude 3.7 Sonnet models. Assistant automatically routes chat requests that specify
claude-3-5-sonnet or claude-3-7-sonnet to claude-sonnet-4-5 at the same price.model parameter in the request:
Filter chat with metadata
You can filter which documents to use for chat completions. The following example filters the responses to use only documents that include the metadata"resource": "encyclopedia".
Set the sampling temperature
This is available in API versions
2025-04 and later.temperarture parameter in the request. If a model does not support a temperature parameter, the parameter is ignored.