Geminix.V1beta.Models (geminix v0.2.0)
Summary
Functions
Enqueues a batch of EmbedContent requests for batch processing.
Generates multiple embedding vectors from the input Content which consists of a batch of strings represented as EmbedContentRequest objects.
Generates multiple embeddings from the model given input text in a synchronous call.
Enqueues a batch of GenerateContent requests for batch processing.
Runs a model's tokenizer on a string and returns the token count.
Runs a model's tokenizer on a text and returns the token count.
Runs a model's tokenizer on input Content and returns the token count.
Generates a text embedding vector from the input Content using the specified Gemini Embedding model.
Generates an embedding from the model given an input message.
Generates a grounded answer from the model given an input GenerateAnswerRequest.
Generates a model response given an input GenerateContentRequest.
Generates a response from the model given an input MessagePrompt.
Generates a response from the model given an input message.
Performs a prediction request.
Same as Predict but returns an LRO.
Generates a streamed response from the model given an input GenerateContentRequest.
Functions
@spec async_batch_embed_content( binary(), Geminix.V1beta.AsyncBatchEmbedContentRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.Operation.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Enqueues a batch of EmbedContent requests for batch processing.
We have a BatchEmbedContents handler in GenerativeService, but it was synchronized. So we name this one to be Async to avoid confusion.
@spec batch_embed_contents( binary(), Geminix.V1beta.BatchEmbedContentsRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.BatchEmbedContentsResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates multiple embedding vectors from the input Content which consists of a batch of strings represented as EmbedContentRequest objects.
@spec batch_embed_text(binary(), Geminix.V1beta.BatchEmbedTextRequest.t(), keyword()) :: {:ok, Geminix.V1beta.BatchEmbedTextResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates multiple embeddings from the model given input text in a synchronous call.
@spec batch_generate_content( binary(), Geminix.V1beta.BatchGenerateContentRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.Operation.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Enqueues a batch of GenerateContent requests for batch processing.
@spec count_message_tokens( binary(), Geminix.V1beta.CountMessageTokensRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.CountMessageTokensResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Runs a model's tokenizer on a string and returns the token count.
@spec count_text_tokens( binary(), Geminix.V1beta.CountTextTokensRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.CountTextTokensResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Runs a model's tokenizer on a text and returns the token count.
@spec count_tokens(binary(), Geminix.V1beta.CountTokensRequest.t(), keyword()) :: {:ok, Geminix.V1beta.CountTokensResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Runs a model's tokenizer on input Content and returns the token count.
Refer to the tokens guide to learn more about tokens.
@spec embed_content(binary(), Geminix.V1beta.EmbedContentRequest.t(), keyword()) :: {:ok, Geminix.V1beta.EmbedContentResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a text embedding vector from the input Content using the specified Gemini Embedding model.
@spec embed_text(binary(), Geminix.V1beta.EmbedTextRequest.t(), keyword()) :: {:ok, Geminix.V1beta.EmbedTextResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates an embedding from the model given an input message.
@spec generate_answer(binary(), Geminix.V1beta.GenerateAnswerRequest.t(), keyword()) :: {:ok, Geminix.V1beta.GenerateAnswerResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a grounded answer from the model given an input GenerateAnswerRequest.
@spec generate_content(binary(), Geminix.V1beta.GenerateContentRequest.t(), keyword()) :: {:ok, Geminix.V1beta.GenerateContentResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a model response given an input GenerateContentRequest.
Refer to the text generation guide for detailed usage information. Input capabilities differ between models, including tuned models. Refer to the model guide and tuning guide for details.
@spec generate_message(binary(), Geminix.V1beta.GenerateMessageRequest.t(), keyword()) :: {:ok, Geminix.V1beta.GenerateMessageResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a response from the model given an input MessagePrompt.
@spec generate_text(binary(), Geminix.V1beta.GenerateTextRequest.t(), keyword()) :: {:ok, Geminix.V1beta.GenerateTextResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a response from the model given an input message.
@spec predict(binary(), Geminix.V1beta.PredictRequest.t(), keyword()) :: {:ok, Geminix.V1beta.PredictResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Performs a prediction request.
@spec predict_long_running( binary(), Geminix.V1beta.PredictLongRunningRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.Operation.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Same as Predict but returns an LRO.
@spec stream_generate_content( binary(), Geminix.V1beta.GenerateContentRequest.t(), keyword() ) :: {:ok, Geminix.V1beta.GenerateContentResponse.t()} | {:error, {:invalid_data, Ecto.Changeset.t()}} | {:error, {:bad_request, Req.Response.t()}}
Generates a streamed response from the model given an input GenerateContentRequest.