Calls the API to create an embedding for the text passed in.
google.generativeai.generate_embeddings(
model: model_types.BaseModelNameOptions,
text: (str | Sequence[str]),
client: glm.TextServiceClient = None,
request_options: (helper_types.RequestOptionsType | None) = None
) -> (text_types.EmbeddingDict | text_types.BatchEmbeddingDict)
Args |
model
|
Which model to call, as a string or a types.Model .
|
text
|
Free-form input text given to the model. Given a string, the model will
generate an embedding based on the input text.
|
client
|
If you're not relying on a default client, you pass a glm.TextServiceClient instead.
|
request_options
|
Options for the request.
|
Returns |
Dictionary containing the embedding (list of float values) for the input text.
|