Keeping Chat History
Last updated on October 11, 2023
Sending chat history enables GigaChat to work with your previous requests. When you use web interface to interact with AI, it automatically considers your chat history.
If you use GigaChat API to exchange messages, send the chat history explicitly using the messages
field of the POST /chat/completions
request.
Request example:
curl https://gigachat.devices.sberbank.ru/api/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer Token ***' \
-d '{
"model": "GigaChat:latest",
"messages": [
{
"role": "user",
"content": "When will the AI take over the world?"
},
{
"role": "assistant",
"content": "So far, this has not been an inevitable menace. Although AI is rapidly developing and is able to complete tricky tasks more and more effectively, it still has limited capabilities and cannot replace a human being in all areas. Also, there are AI-related ethic and legal constratins that are considered in its development and integration."
},
{
"role": "user",
"content": "Do you think we have a chance?"
}
],
"temperature": 0.7
}'