Method: models.embedText

Generates an embedding from the model given an input message.

HTTP request

POST https://generativelanguage.googleapis.com/v1beta/{model=models/*}:embedText

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
model

string

Required. The model name to use with the format model=models/{model}.

Request body

The request body contains data with the following structure:

JSON representation
{
  "text": string
}
Fields
text

string

Optional. The free-form input text that the model will turn into an embedding.

Response body

The response to a EmbedTextRequest.

If successful, the response body contains data with the following structure:

JSON representation
{
  "embedding": {
    object (Embedding)
  }
}
Fields
embedding

object (Embedding)

Output only. The embedding 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.