YandexGPT API, gRPC: TextGenerationService.Chat
RPC method for engaging in a chat conversation with the model.
gRPC request
rpc Chat (ChatRequest) returns (stream ChatResponse)
ChatRequest
{
"model": "string",
"generationOptions": {
"partialResults": "bool",
"temperature": "google.protobuf.DoubleValue",
"maxTokens": "google.protobuf.Int64Value"
},
// Includes only one of the fields `instructionText`
"instructionText": "string",
// end of the list of possible fields
"messages": [
{
"role": "string",
"text": "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. |
generationOptions |
Configuration options for text generation. |
instructionText |
string The text-based instruction for the conversation. Includes only one of the fields Text precondition or context of the request. |
messages[] |
A list of messages in the conversation. |
GenerationOptions
Defines the options for text generation.
Field |
Description |
partialResults |
bool Enables streaming of partially generated text. |
temperature |
Affects creativity and randomness of responses. Should be a double number between 0 (inclusive) and 1 (inclusive). |
maxTokens |
Sets the maximum limit on the total number of tokens used for both the input prompt and the generated response. |
Message
Represents a message within a chat.
Field |
Description |
role |
string Identifies the sender of the message. |
text |
string The text content of the message. |
ChatResponse
{
"message": {
"role": "string",
"text": "string"
},
"numTokens": "int64"
}
Contains a model-generated response for a chat query.
Field |
Description |
message |
The assistant's message in the chat conversation. |
numTokens |
int64 Total number of tokens used in both the chat request and chat response. |
Message
Represents a message within a chat.
Field |
Description |
role |
string Identifies the sender of the message. |
text |
string The text content of the message. |