Foundation Models Text Generation API, gRPC: TextGenerationBatchService.Completion
A method for generating text completions in synchronous mode.
Note: Not implemented yet
gRPC request
rpc Completion (BatchCompletionRequest) returns (operation.Operation)
BatchCompletionRequest
{
"model_uri": "string",
"completion_options": {
"stream": "bool",
"temperature": "google.protobuf.DoubleValue",
"max_tokens": "google.protobuf.Int64Value",
"reasoning_options": {
"mode": "ReasoningMode"
}
},
// Includes only one of the fields `source_dataset_id`
"source_dataset_id": "string",
// end of the list of possible fields
// Includes only one of the fields `json_object`, `json_schema`
"json_object": "bool",
"json_schema": {
"schema": "google.protobuf.Struct"
}
// end of the list of possible fields
}
Request for the service to generate batch text completion.
|
Field |
Description |
|
model_uri |
string The ID of the model to be used for batch completion generation. |
|
completion_options |
Configuration options for completion generation. |
|
source_dataset_id |
string ID of the dataset containing the context for the completion model. Includes only one of the fields Specifies the format of the request. |
|
json_object |
bool When set to true, the model will respond with a valid JSON object. Includes only one of the fields Specifies the format of the model's response. |
|
json_schema |
Enforces a specific JSON structure for the model's response based on a provided schema. Includes only one of the fields Specifies the format of the model's response. |
CompletionOptions
Defines the options for completion generation.
|
Field |
Description |
|
stream |
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). |
|
max_tokens |
The limit on the number of tokens used for single completion generation. |
|
reasoning_options |
Configures reasoning capabilities for the model, allowing it to perform internal reasoning before responding. |
ReasoningOptions
Represents reasoning options that enable the model's ability to perform internal reasoning before generating a response.
|
Field |
Description |
|
mode |
enum ReasoningMode Specifies the reasoning mode to be used.
|
JsonSchema
Represents the expected structure of the model's response using a JSON Schema.
|
Field |
Description |
|
schema |
The JSON Schema that the model's output must conform to. |
operation.Operation
{
"id": "string",
"description": "string",
"created_at": "google.protobuf.Timestamp",
"created_by": "string",
"modified_at": "google.protobuf.Timestamp",
"done": "bool",
"metadata": {
"task_id": "string",
"task_status": "BatchInferenceTaskStatus",
"completed_batches": "int64",
"total_batches": "int64"
},
// Includes only one of the fields `error`, `response`
"error": "google.rpc.Status",
"response": {
"task_id": "string",
"task_status": "BatchInferenceTaskStatus",
"result_dataset_id": "string"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
|
Field |
Description |
|
id |
string ID of the operation. |
|
description |
string Description of the operation. 0-256 characters long. |
|
created_at |
Creation timestamp. |
|
created_by |
string ID of the user or service account who initiated the operation. |
|
modified_at |
The time when the Operation resource was last modified. |
|
done |
bool If the value is |
|
metadata |
Service-specific metadata associated with the operation. |
|
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
|
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
BatchCompletionMetadata
Metadata of the batch completion operation.
|
Field |
Description |
|
task_id |
string The ID of the batch completion task. |
|
task_status |
enum BatchInferenceTaskStatus The status of the batch completion task.
|
|
completed_batches |
int64 A number of currently completed batches of the completion task. |
|
total_batches |
int64 A number of total batches of the completion task. |
BatchCompletionResponse
Response containing information about completion task.
|
Field |
Description |
|
task_id |
string The ID of the batch completion task. |
|
task_status |
enum BatchInferenceTaskStatus The status of the batch completion task.
|
|
result_dataset_id |
string The ID of the dataset containing completion results. |