Generates multiple embeddings from the model given input text in a synchronous call.
HTTP request
POST https://generativelanguage.googleapis.com/v1beta/{model=models/*}:batchEmbedText
Path parameters
Parameters | |
---|---|
model |
Required. The name of the |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"texts": [
string
],
"requests": [
{
object ( |
Fields | |
---|---|
texts[] |
Optional. The free-form input texts that the model will turn into an embedding. The current limit is 100 texts, over which an error will be thrown. |
requests[] |
Optional. Embed requests for the batch. Only one of |
Response body
The response to a EmbedTextRequest.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"embeddings": [
{
object ( |
Fields | |
---|---|
embeddings[] |
Output only. The embeddings generated from the input text. |
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.
EmbedTextRequest
Request to get a text embedding from the model.
JSON representation |
---|
{ "model": string, "text": string } |
Fields | |
---|---|
model |
Required. The model name to use with the format model=models/{model}. |
text |
Optional. The free-form input text that the model will turn into an embedding. |