# Chat with an assistant

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](/guides/chat-with-an-assistant-chat-with-assistant).

:::code-group
```bash curl | Default
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"

curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "What is the inciting incident of Pride and Prejudice?"
    }
  ],
  "stream": false,
  "model": "gpt-4o"
}'
```

```bash curl | Streaming
PINECONE_API_KEY="YOUR_API_KEY"
ASSISTANT_NAME="example-assistant"

curl "https://prod-1-data.ke.pinecone.io/assistant/chat/$ASSISTANT_NAME" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Pinecone-Api-Version: 2025-10" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "What is the inciting incident of Pride and Prejudice?"
    }
  ],
  "stream": true,
  "model": "gpt-4o"
}'
```
:::

:::code-group
```json Default response
{
  "finish_reason": "stop",
  "message": {
    "role": "assistant",
    "content": "The inciting incident of \"Pride and Prejudice\" occurs when Mrs. Bennet informs Mr. Bennet that Netherfield Park has been let at last, and she is eager to share the news about the new tenant, Mr. Bingley, who is wealthy and single. This sets the stage for the subsequent events of the story, including the introduction of Mr. Bingley and Mr. Darcy to the Bennet family and the ensuing romantic entanglements."
  },
  "id": "00000000000000004ac3add5961aa757",
  "model": "gpt-4o-2024-05-13",
  "usage": {
    "prompt_tokens": 9736,
    "completion_tokens": 105,
    "total_tokens": 9841
  },
  "citations": [
    {
      "position": 406,
      "references": [
        {
          "file": {
            "status": "Available",
            "id": "ae79e447-b89e-4994-994b-3232ca52a654",
            "name": "Pride-and-Prejudice.pdf",
            "size": 2973077,
            "metadata": null,
            "updated_on": "2024-06-14T15:01:57.385425746Z",
            "created_on": "2024-06-14T15:01:02.910452398Z",
            "percent_done": 0,
            "signed_url": "https://storage.googleapis.com/...",
            "error_message": null
          },
          "pages": [
            1
          ]
        }
      ]
    }
  ]
}

```

```text Streaming response
data:{
  "type":"message_start",
  "id":"0000000000000000111b35de85e8a8f9",
  "model":"gpt-4o-2024-05-13",
  "role":"assistant"
}

data:
{
  "type":"content_chunk",
  "id":"0000000000000000111b35de85e8a8f9",
  "model":"gpt-4o-2024-05-13",
  "delta":
  {
    "content":"The"
    }
}

...

data:
{
  "type":"citation",
  "id":"0000000000000000111b35de85e8a8f9",
  "model":"gpt-4o-2024-05-13",
  "citation":
  {
    "position":406,
    "references":
    [
      {
        "file":{
          "status":"Available",
          "id":"ae79e447-b89e-4994-994b-3232ca52a654",
          "name":"Pride-and-Prejudice.pdf",
          "size":2973077,
          "metadata":null,
          "updated_on":"2024-06-14T15:01:57.385425746Z", 
          "created_on":"2024-06-14T15:01:02.910452398Z",
          "percent_done":0.0,
          "signed_url":"https://storage.googleapis.com/...",
          "error_message":null
          }, 
      "pages":[1]
      }
    ]
  }
}

data:
{
  "type":"message_end",
  "id":"0000000000000000111b35de85e8a8f9",
  "model":"gpt-4o-2024-05-13",
  "finish_reason":"stop",
  "usage":
  {
    "prompt_tokens":9736,
    "completion_tokens":102,
    "total_tokens":9838
    }
}
```
:::

`POST /chat/{assistant_name}`

#### Authorizations

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `Api-Key` | `string` | - | Pinecone API Key |

#### Headers

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `X-Pinecone-Api-Version` | `string` | `2025-10` | Required date-based version header |

#### Path Parameters

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `assistant_name` | `string` | - | The name of the assistant to be described. |

#### Body

The desired configuration to chat an assistant.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `messages` | `object[]` | - |  |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `role?` | `string` | - | Role of the message such as 'user' or 'assistant' |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `content?` | `string` | - | Content of the message |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `stream?` | `boolean` | `false` | If false, the assistant will return a single JSON response. If true, the assistant will return a stream of responses. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `model?` | `string` | `gpt-4o` | The large language model to use for answer generation |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `temperature?` | `number` | `0` | 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. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `filter?` | `object` | - | Optionally filter which documents can be retrieved using the following metadata fields. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `json_response?` | `boolean` | `false` | If true, the assistant will be instructed to return a JSON response. Cannot be used with streaming. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `include_highlights?` | `boolean` | `false` | If true, the assistant will be instructed to return highlights from the referenced documents that support its response. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `context_options?` | `object` | - | Controls the context snippets sent to the LLM. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `top_k?` | `integer` | - | The maximum number of context snippets to use. Default is 16. Maximum is 64. Example: 20 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `snippet_size?` | `integer` | - | The maximum context snippet size. Default is 2048 tokens. Minimum is 512 tokens. Maximum is 8192 tokens. Example: 4096 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `multimodal?` | `boolean` | `true` | Whether or not to send image-related context snippets to the LLM. If false, only text context snippets are sent. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `include_binary_content?` | `boolean` | `true` | 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.

Describes the response format of a chat request from the citation API.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id?` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `finish_reason?` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `message?` | `object` | - | Describes the format of a message in a chat. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `role?` | `string` | - | Role of the message such as 'user' or 'assistant' |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `content?` | `string` | - | Content of the message |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `model?` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `citations?` | `object[]` | - |  |

:::::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `position?` | `integer` | - | The index position of the citation in the complete text response. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `references?` | `object[]` | - |  |

::::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `file?` | `object` | - | The response format for a successful file upload request. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `name` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `metadata?` | `object \| null` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `created_on?` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `updated_on?` | `string` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `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. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `percent_done?` | `number \| null` | - | The percentage of the file that has been processed |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `signed_url?` | `string \| null` | - | Example: https://storage.googleapis.com/bucket/file.pdf?... |

A [signed URL](https://cloud.google.com/storage/docs/access-control/signed-urls) that provides temporary, read-only access to the underlying file. Anyone with the link can access the file, so treat it as sensitive data. Expires after a short time.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `error_message?` | `string \| null` | - | A message describing any error during file processing. Provided only if an error occurs. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `multimodal?` | `boolean` | - | Indicates whether the file was processed as multimodal. |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `pages?` | `integer[]` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `highlight?` | `object \| null` | - | Represents a portion of a referenced document that directly supports or is relevant to the response. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `type` | `string` | - | The type of the highlight. Currently it is always text. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `content` | `string` | - |  |
:::
::::
:::::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `usage?` | `object` | - | Describes the usage of a chat completion. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `prompt_tokens?` | `integer` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `completion_tokens?` | `integer` | - |  |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `total_tokens?` | `integer` | - |  |
:::

## Related pages

- [Account management](./account-management-index.md)
- [Admin](./admin-2-index.md)
- [Admin](./admin-index.md)
- [APIs](./apis-index.md)
- [Architecture](./architecture-index.md)
- [Bring Your Own Cloud](./bring-your-own-cloud-index.md)
- [Build an assistant](./build-an-assistant-index.md)
- [Build an integration](./build-an-integration-index.md)
- [Changelog](./changelog-index.md)
- [Changelog](../changelog.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
