YandexGPT API, REST: TextGeneration.chat
RPC method for engaging in a chat conversation with the model.
HTTP request
POST https://llm.api.cloud.yandex.net/llm/v1alpha/chat
Body parameters
{
"model": "string",
"generationOptions": {
"partialResults": true,
"temperature": "number",
"maxTokens": "integer"
},
"messages": [
{
"role": "string",
"text": "string"
}
],
"instructionText": "string"
}
Request to engage in a chat conversation with a text generation model.
Field | Description |
---|---|
model | string The name or identifier of the model to be used for the chat. Possible value for now: The maximum string length in characters is 50. |
generationOptions | object Configuration options for text generation. |
generationOptions. partialResults |
boolean (boolean) Enables streaming of partially generated text. |
generationOptions. temperature |
number (double) Affects creativity and randomness of responses. Should be a double number between 0 (inclusive) and 1 (inclusive). Lower values produce more straightforward responses, while higher values lead to increased creativity and randomness. |
generationOptions. maxTokens |
integer (int64) Sets the maximum limit on the total number of tokens used for both the input prompt and the generated response. Must be greater than zero and not exceed 7400 tokens. |
messages[] | object A list of messages in the conversation. |
messages[]. role |
string Identifies the sender of the message. |
messages[]. text |
string The text content of the message. |
instructionText | string The text-based instruction for the conversation. |
Response
HTTP Code: 200 - OK
{
"message": {
"role": "string",
"text": "string"
},
"numTokens": "string"
}
Contains a model-generated response for a chat query.
Field | Description |
---|---|
message | object The assistant's message in the chat conversation. Represents a message within a chat. |
message. role |
string Identifies the sender of the message. |
message. text |
string The text content of the message. |
numTokens | string (int64) Total number of tokens used in both the chat request and chat response. |