google.generativeai.embed_content#
View source on GitHub |
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,
output_dimensionality: (int | None) = None,
client: glm.GenerativeServiceClient = None,
request_options: (helper_types.RequestOptionsType | None) = None
) -> (text_types.EmbeddingDict | text_types.BatchEmbeddingDict)
Args | |
---|---|
Which [model](https://ai.google.dev/models/gemini#embedding) to
call, as a string or a |
|
Content to embed.
|
|
Optional task type for which the embeddings will be used. Can only
be set for |
|
An optional title for the text. Only applicable when task_type is
|
|
Optional reduced dimensionality for the output embeddings. If set,
excessive values from the output embeddings will be truncated from the end. |
|
Options for the request.
|
Return | |
---|---|
Dictionary containing the embedding (list of float values) for the input content. |