View Source GoogleAI.Embedding (google_ai v0.1.0)
This module provides an implementation of the Google AI embeddings API. The API reference can be found at https://ai.google.dev/tutorials/rest_quickstart#embedding.
Summary
Types
The structure of a GoogleAI batch embedding request.
The structure of a GoogleAI batch embedding response.
The structure of a GoogleAI embedding request.
The structure of a GoogleAI embedding response.
Functions
Create an embedding using the given model
for the given input
.
Types
@type batch_embed_request() :: %{requests: [embed_request()]}
The structure of a GoogleAI batch embedding request.
The structure of a GoogleAI batch embedding response.
Has the following format:
%{
"embeddings" => [%{
"values" => [
0.0234234,
0.3214135,
0.5645654,
...
]
}]
}
The structure of a GoogleAI embedding request.
The structure of a GoogleAI embedding response.
Has the following format:
%{
"embedding" => %{
"values" => [
0.0234234,
0.3214135,
0.5645654,
...
]
}
}
Functions
@spec create(GoogleAI.Model.t(), String.t() | [String.t()]) :: GoogleAI.Http.response(embed_response() | batch_embed_response())
Create an embedding using the given model
for the given input
.
Arguments
:model
- TheGoogleAI.Model
to use for this request.:input
- Either a single string or a list of strings. In the case that it is a list, thebatchEmbedContents
action will be used.
Returns
A map containing the fields of the embedding response.
See https://ai.google.dev/tutorials/rest_quickstart#embedding.