Generates multiple embeddings from the model given input text in a synchronous call.
HTTP request
POST https://generativelanguage.googleapis.com/v1beta/{model=models/*}:batchEmbedContents
Path parameters
Parameters | |
---|---|
model |
Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"requests": [
{
object ( |
Fields | |
---|---|
requests[] |
Required. Embed requests for the batch. The model in each of these requests must match the model specified |
Response body
The response to a BatchEmbedContentsRequest
.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"embeddings": [
{
object ( |
Fields | |
---|---|
embeddings[] |
Output only. The embeddings for each request, in the same order as provided in the batch request. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/generative-language
https://www.googleapis.com/auth/generative-language.tuning
https://www.googleapis.com/auth/generative-language.tuning.readonly
https://www.googleapis.com/auth/generative-language.retriever
https://www.googleapis.com/auth/generative-language.retriever.readonly
For more information, see the Authentication Overview.
EmbedContentRequest
Request containing the Content
for the model to embed.
JSON representation |
---|
{ "model": string, "content": { object ( |
Fields | |
---|---|
model |
Required. The model's resource name. This serves as an ID for the Model to use. This name should match a model name returned by the Format: |
content |
Required. The content to embed. Only the |
taskType |
Optional. Optional task type for which the embeddings will be used. Can only be set for |
title |
Optional. An optional title for the text. Only applicable when TaskType is Note: Specifying a |
outputDimensionality |
Optional. Optional reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end. Supported by newer models since 2024, and the earlier model ( |