Google Cloud TextCompletion

Google Cloud TextCompletion

Certified

Generate text with Vertex AI

Creates text completions using the configured Vertex model and generation parameters.

yaml
type: io.kestra.plugin.gcp.vertexai.TextCompletion

Text completion using the Vertex AI Gemini API

yaml
id: gcp_vertexai_text_completion
namespace: company.team

tasks:
  - id: text_completion
    type: io.kestra.plugin.gcp.vertexai.TextCompletion
    region: us-central1
    projectId: my-project
    prompt: Please tell me a joke
Properties

Text input to generate model response

Prompts can include preamble, questions, suggestions, instructions, or examples.

Region

Vertex AI region used for the API endpoint

The GCP service account to impersonate

Defaultgemini-pro

Model ID

Vertex model name (e.g., gemini-1.5-flash); defaults to gemini-pro

Default{ "temperature": 0.2, "maxOutputTokens": 128, "topK": 40, "topP": 0.95 }

Model parameters

Temperature/topK/topP/maxOutputTokens generation settings

Definitions
maxOutputTokensinteger
Default128
Minimum>= 1
Maximum<= 1024

Maximum number of tokens that can be generated in the response

Specify a lower value for shorter responses and a higher value for longer responses. A token may be smaller than a word. A token is approximately four characters. 100 tokens correspond to roughly 60-80 words.

temperaturenumber
Default0.2
Minimum>
Maximum<= 1

Temperature used for sampling during the response generation, which occurs when topP and topK are applied

Temperature controls the degree of randomness in token selection. Lower temperatures are good for prompts that require a more deterministic and less open-ended or creative response, while higher temperatures can lead to more diverse or creative results. A temperature close to 0 is nearly deterministic: the highest probability response is almost always selected. For most use cases, try starting with a temperature of 0.2.

topKinteger
Default40
Minimum>= 1
Maximum<= 40

Top-k changes how the model selects tokens for output

A top-k of 1 means the selected token is the most probable among all tokens in the model's vocabulary (also called greedy decoding), while a top-k of 3 means that the next token is selected from among the 3 most probable tokens (using temperature). For each token selection step, the top K tokens with the highest probabilities are sampled. Then tokens are further filtered based on topP with the final token selected using temperature sampling. Specify a lower value for less random responses and a higher value for more random responses.

topPnumber
Default0.95
Minimum>
Maximum<= 1

Top-p changes how the model selects tokens for output

Tokens are selected from most K (see topK parameter) probable to least until the sum of their probabilities equals the top-p value. For example, if tokens A, B, and C have a probability of 0.3, 0.2, and 0.1 and the top-p value is 0.5, then the model will select either A or B as the next token (using temperature) and doesn't consider C. The default top-p value is 0.95. Specify a lower value for less random responses and a higher value for more random responses.

Reference (ref) of the pluginDefaults to apply to this task.

The GCP project ID

SubTypestring
Default["https://www.googleapis.com/auth/cloud-platform"]

The GCP scopes to be used

The GCP service account

List of text predictions made by the model

Definitions
citationMetadata
citationsarray
citationsarray
SubTypestring
contentstring
safetyAttributes
blockedboolean
categoriesarray
SubTypestring
scoresarray
SubTypenumber

Number of tokens in the candidate response.

Number of tokens in the prompt.

Unitbytes

Size of the serialized metadata.

Total number of tokens (prompt + candidate).