---
title: "Chat with an assistant"
method: POST
path: "/chat/{assistant_name}"
tags: ["Manage Assistants"]
---

# Chat with an assistant

`POST /chat/{assistant_name}`

Chat with an assistant and get back citations in structured form. 

This is the recommended way to chat with an assistant, as it offers more functionality and control over the assistant's responses and references than the OpenAI-compatible chat interface.

For guidance and examples, see [Chat with an assistant](https://docs.pinecone.io/guides/assistant/chat-with-assistant).

## Path parameters

- `assistant_name` string, required

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- AssistantDataChatRequest — Represents a request to chat with an assistant.
  - `messages` AssistantDataMessageModel[], required — The list of messages sent to the assistant, used for context retrieval and generating response with the LLM.
    - `role` string — The role of the message author, it can be `user`, `assistant`, or `system`.
    - `content` string — The textual content of this partial message.
  - `stream` boolean — If `false`, the assistant returns a single JSON response. If `true`, the assistant returns a stream of responses.
  - `model` string — The large language model used to generate responses.
  - `temperature` number, float — Controls the randomness of the model's output: lower values make responses more deterministic, while higher values increase creativity and variability. If the model does not support a temperature parameter, the parameter will be ignored.
  - `filter` object — Optional metadata-based filter to restrict which documents are retrieved for the assistant's response context.
  - `json_response` boolean — If `true`, instructs the assistant to return a JSON-formatted response. Cannot be used together with streaming mode.
  - `include_highlights` boolean — If `true`, instructs the assistant to include highlights from the referenced documents that support its response.
  - `context_options` AssistantDataContextOptionsModel — Controls the context snippets sent to the LLM.
    - `top_k` integer — The maximum number of context snippets to use. Default is 16. Maximum is 64.
    - `snippet_size` integer — The maximum context snippet size. Default is 2048 tokens. Minimum is 512 tokens. Maximum is 8192 tokens.
    - `multimodal` boolean — Whether or not to send image-related context snippets to the LLM. If `false`, only text context snippets are sent.
    - `include_binary_content` boolean — If image-related context snippets are sent to the LLM, this field determines whether or not they should include base64 image data. If `false`, only the image caption is sent. Only available when `multimodal=true`.

## Response `200`

Search request successful.

- AssistantDataChatModel — Describes the response format of a chat request.
  - `id` string — A unique identifier for this chat response.
  - `finish_reason` string — Indicates why the chat response generation stopped. This signals the end of the response. - `stop`: The model finished generating the response. - `length`: Generation was cut off because the maximum number of tokens allowed was reached. - `content_filter`: Generation stopped because content was blocked by content filtering rules. (for example, content that contains hate speech or violent material). - `tool_calls`: Generation stopped because a tool call was triggered.
  - `message` AssistantDataMessageModel — Describes the format of a message in a chat.
    - `role` string — The role of the message author, it can be `user`, `assistant`, or `system`.
    - `content` string — The textual content of this partial message.
  - `model` string — The name or identifier of the model used to generate this chat response.
  - `citations` AssistantDataCitationModel[] — Citations supporting the information in the response.
    - `position` integer — The index position of the citation in the complete text response.
    - `references` AssistantDataReferenceModel[] — A list of file references that this citation points to.
      - `file` AssistantDataAssistantFileModel — The response format for a successful file upload request.
        - `name` string, required — The name of the uploaded file.
        - `id` string, required — The unique identifier for the uploaded file. This may be a user-provided identifier or a system-generated ID.
        - `size` integer — The size of the uploaded file, in bytes.
        - `metadata` object, nullable — Optional metadata associated with the file. This metadata can be used to filter files when listing them or to restrict search results when querying the assistant.
        - `created_on` string, date-time — The timestamp when the file was uploaded, in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`).
        - `updated_on` string, date-time — The timestamp of the most recent update to the file, in ISO 8601 format (`YYYY-MM-DDTHH:MM:SSZ`).
        - `status` string — The current state of the uploaded file. Possible values: - `Processing`: File is being processed (parsed, chunked, embedded) - `Available`: Processing completed successfully; file is ready for use - `Deleting`: Deletion has been initiated but not yet completed - `ProcessingFailed`: Processing failed with an error Note: Once a file is deleted, the API returns 404 Not Found instead of a file object.
        - `signed_url` string, nullable — A [signed URL](https://cloud.google.com/storage/docs/access-control/signed-urls) that provides temporary, read-only access to the file. Anyone with the link can access the file, so treat it as sensitive data. Expires after a short time.
        - `multimodal` boolean — Indicates whether the file was processed as multimodal.
      - `pages` integer[] — A list of page numbers in the referenced document that contain the relevant content.
      - `highlight` AssistantDataHighlightModel, nullable — Represents a portion of a referenced document that directly supports or is relevant to the response.
        - `type` string, required — The type of the highlight. Only `text` is supported.
        - `content` string, required — The text content of the highlighted portion from the referenced document.
  - `usage` AssistantDataUsageModel — Describes the token usage associated with interactions with an assistant.
    - `prompt_tokens` integer — For chat interactions, the number of tokens in the LLM request (message, context snippets, and system prompt). For context retrieval, the number of tokens in the LLM request used to generate search queries from the messages, plus the tokens in the retrieved context snippets.
    - `completion_tokens` integer — For chat interactions, the number of tokens in the assistant's response. For context retrieval, this is always 0.
    - `total_tokens` integer — The total number of tokens used, equal to the sum of `prompt_tokens` and `completion_tokens`.
  - `context_snippet_count` integer — The number of context snippets provided to the model to generate the response. This indicates how much retrieved information was available for the generation, allowing for logic to be applied if no context was found (count is 0).
  - `content_filter_results` AssistantDataContentFilterResults — Content filter results provided by the LLM, describing safety-related classifications applied to the content. The structure may vary depending on the model and the content being filtered. The `spec` field identifies the provider, and determines the structure of `results`.
    - `spec` string — Identifier of the model provider.
    - `results` unknown

## Other responses

- `400` — Bad request. The request body included invalid request parameters.
- `401` — Unauthorized. Possible causes: Invalid API key.
- `404` — Assistant not found.
- `500` — Internal server error.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/versions/35876583485d/schema)
