YandexGPT API, gRPC: TextGenerationAsyncService
Статья создана
Обновлена 21 февраля 2024 г.
Service for asynchronous text generation.
Call | Description |
---|---|
Instruct | RPC method for instructing the model to generate text. |
Calls TextGenerationAsyncService
Instruct
RPC method for instructing the model to generate text.
rpc Instruct (InstructRequest) returns (operation.Operation)
Response of Operation:
Operation.response:InstructResponse
InstructRequest
Field | Description |
---|---|
model | string The name or identifier of the model to be used for text generation. Possible value for now: general . The maximum string length in characters is 50. |
generation_options | GenerationOptions Configuration options for text generation. |
Instruction | oneof: instruction_text or instruction_uri Text precondition or context of the request. For example, if the instruction is "You are the youngest Nobel laureate", the request text might be "Tell us about your daily routine". |
instruction_text | string The text-based instruction for text generation. |
instruction_uri | string A URI containing instructions for text generation. |
Request | oneof: request_text Request for text generation. |
request_text | string The text-based request for text generation. |
GenerationOptions
Field | Description |
---|---|
partial_results | bool Enables streaming of partially generated text. |
temperature | google.protobuf.DoubleValue 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. |
max_tokens | google.protobuf.Int64Value 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. |
Operation
Field | Description |
---|---|
id | string ID of the operation. |
description | string Description of the operation. 0-256 characters long. |
created_at | google.protobuf.Timestamp Creation timestamp. |
created_by | string ID of the user or service account who initiated the operation. |
modified_at | google.protobuf.Timestamp The time when the Operation resource was last modified. |
done | bool If the value is false , it means the operation is still in progress. If true , the operation is completed, and either error or response is available. |
metadata | google.protobuf.Any Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any. |
result | oneof: error or response The operation result. If done == false and there was no failure detected, neither error nor response is set. If done == false and there was a failure detected, error is set. If done == true , exactly one of error or response is set. |
error | google.rpc.Status The error result of the operation in case of failure or cancellation. |
response | google.protobuf.Any if operation finished successfully. |
InstructResponse
Field | Description |
---|---|
alternatives[] | Alternative A list of alternative text responses. |
num_prompt_tokens | int64 The number of tokens used in the prompt, including both the [instruction_text] and [request_text]. |
Alternative
Field | Description |
---|---|
text | string The generated text response. |
score | double The score or confidence of the generated text. |
num_tokens | int64 The number of tokens in the generated response. |