# google.generativeai.embed_content
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 |
`model`
|
Which [model](https://ai.google.dev/models/gemini#embedding) 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`.
|
`output_dimensionality`
|
Optional reduced dimensionality for the output embeddings. If set,
excessive values from the output embeddings will be truncated from
the end.
|
`request_options`
|
Options for the request.
|
Return |
Dictionary containing the embedding (list of float values) for the
input content.
|