Full name: projects.locations.publishers.models.embedContent
Embed content with multimodal inputs.
Endpoint
posthttps://aiplatform.googleapis.com/v1/{model}:embedContent
Path parameters
model
string
Required. The name of the publisher model requested to serve the prediction. Format: projects/{project}/locations/{location}/publishers/*/models/*
Request body
The request body contains data with the following structure:
Required. Input content to be embedded. Required.
title
string
Optional. An optional title for the text.
Optional. The task type of the embedding.
outputDimensionality
integer
Optional. Optional reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end.
autoTruncate
boolean
Optional. Whether to silently truncate the input content if it's longer than the maximum sequence length.
Response body
Response message for PredictionService.EmbedContent
.
If successful, the response body contains data with the following structure:
The embedding generated from the input content.
metadata about the response(s).
truncated
boolean
Whether the input content was truncated before generating the embedding.
JSON representation |
---|
{ "embedding": { object ( |
EmbeddingTaskType
Represents a downstream task the embeddings will be used for.
Enums | |
---|---|
UNSPECIFIED |
Unset value, which will default to one of the other enum values. |
RETRIEVAL_QUERY |
Specifies the given text is a query in a search/retrieval setting. |
RETRIEVAL_DOCUMENT |
Specifies the given text is a document from the corpus being searched. |
SEMANTIC_SIMILARITY |
Specifies the given text will be used for STS. |
CLASSIFICATION |
Specifies that the given text will be classified. |
CLUSTERING |
Specifies that the embeddings will be used for clustering. |
QUESTION_ANSWERING |
Specifies that the embeddings will be used for question answering. |
FACT_VERIFICATION |
Specifies that the embeddings will be used for fact verification. |
CODE_RETRIEVAL_QUERY |
Specifies that the embeddings will be used for code retrieval. |
Embedding
A list of floats representing an embedding.
values[]
number
Embedding vector values.
JSON representation |
---|
{ "values": [ number ] } |
UsageMetadata
Usage metadata about the content generation request and response. This message provides a detailed breakdown of token usage and other relevant metrics.
promptTokenCount
integer
The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When cachedContent
is set, this also includes the number of tokens in the cached content.
candidatesTokenCount
integer
The total number of tokens in the generated candidates.
totalTokenCount
integer
The total number of tokens for the entire request. This is the sum of promptTokenCount
, candidatesTokenCount
, toolUsePromptTokenCount
, and thoughtsTokenCount
.
toolUsePromptTokenCount
integer
Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable.
thoughtsTokenCount
integer
Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable.
cachedContentTokenCount
integer
Output only. The number of tokens in the cached content that was used for this request.
Output only. A detailed breakdown of the token count for each modality in the prompt.
Output only. A detailed breakdown of the token count for each modality in the cached content.
Output only. A detailed breakdown of the token count for each modality in the generated candidates.
Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input.
Output only. The traffic type for this request.
JSON representation |
---|
{ "promptTokenCount": integer, "candidatesTokenCount": integer, "totalTokenCount": integer, "toolUsePromptTokenCount": integer, "thoughtsTokenCount": integer, "cachedContentTokenCount": integer, "promptTokensDetails": [ { object ( |
TrafficType
The type of traffic that this request was processed with, indicating which quota gets consumed.
Enums | |
---|---|
TRAFFIC_TYPE_UNSPECIFIED |
Unspecified request traffic type. |
ON_DEMAND |
type for Pay-As-You-Go traffic. |
PROVISIONED_THROUGHPUT |
type for Provisioned Throughput traffic. |