Skip to content
On this page

Conversations

Please note

client refers to you, the gigachat.ai client. user refers to the end user of your application.

Start a conversation

Conversations are started by sending a prompt to the API. Once gigachat receives a prompt, it will respond with a message. The client can then send the response back to the API, and the API will respond with another message. This process can be repeated using the same conversation_id.

Each prompt and response are stored individually and message hierarchy determined by timestamp.

If you want to inject a message into the history as the client (intercept a conversation), you can prefix the user_id property with client: and the message will be injected into the history WITHOUT prompting a contextual response from gigachat. e.g. client:support_staff_01. Read more on intercepting conversations.

URL: https://api.gigachat.ai/chatbots/{chatbot_id}/conversations

Method: POST

Request Body: JSON

PropertyDescriptionRequired
conversation_idClient defined unique identifier for the conversation. e.g. UUIDYes
user_idClient defined unique identifier for active user, e.g. email address, UUIDYes
promptInitial prompt to start the conversationYes
Sample payload
json
{
	"conversation_id": "12345",
	"user_id": "[email protected]",
	"prompt": "Hello"
}
Expected response 201
json
[
    {
        "id": "7c4e187d-27e4-4922-a54c-750d6a92d5a2",
        "chatbot_id": "8fb205e5-ff46-4bf6-9d7b-4d770935a486",
        "user_id": "4c4087f4-805f-4cf4-9957-0571faf82a4d",
        "name": "https://developers.cloudflare.com/workers/learning/how-kv-works/-0",
        "content": "DOCUMENT NAME: https://developers.cloudflare.com/workers/learning/how-kv/\n\n---\n\nHow KV works Workers KV is a global, low-latency, key-value data store. It stores data in a small number of centralized data centers, then caches that data in Cloudflare’s data centers after access. KV supports exceptionally high read volumes with low latency, making it possible to build highly dynamic APIs and websites that respond as quickly as a cached static file would. While reads are periodically revalidated in the background, requests which are not in cache and need to hit the centralized back end can see high latencies. ​​Write data to KV and read data from KV When you write to KV, your data is written to central data stores. It is not sent automatically to every location’s cache.",
        "metadata": {
            "loc": {
                "lines": {
                    "to": 1,
                    "from": 1
                }
            }
        },
        "embedding": "[0.005706016,0.014266768,0.011446592,-0.05322389,-0.008515823,0.028229399,-0.029860675..]",
        "created_at": "2023-06-16T18:18:38.88344+00:00",
        "updated_at": "2023-06-16T18:18:38.88344+00:00"
    }
]

Continue conversation

Intercepting conversations