Calls the API to create embeddings for content passed in.
google.generativeai.embed_content(
model: model_types.BaseModelNameOptions,
content: (content_types.ContentType | Iterable[content_types.ContentType]),
task_type: (EmbeddingTaskTypeOptions | None) = None,
title: (str | None) = None,
client: glm.GenerativeServiceClient = None
) -> (text_types.EmbeddingDict | text_types.BatchEmbeddingDict)
Args |
model
|
Which model to call, as a string or a types.Model .
|
content
|
Content to embed.
|
task_type
|
Optional task type for which the embeddings will be used. Can only be set for models/embedding-001 .
|
title
|
An optional title for the text. Only applicable when task_type is RETRIEVAL_DOCUMENT .
|
Return |
Dictionary containing the embedding (list of float values) for the input content.
|