View Source GoogleAI.Model (google_ai v0.1.0)
A struct representing a Google AI model.
Summary
Types
Configuration used for tweaking model generation.
The structure of a GoogleAI get model response.
The structure of a GoogleAI list models response.
Configuration used for tweaking model safety.
Type of the underlying model struct.
Functions
Get information about the model with the given model_name
.
List information about the all models available on Google AI.
Create a new GoogleAI model from the given client
and opts
.
Types
@type generation_config() :: %{ candidateCount: integer(), stopSequences: [String.t()], maxOutputTokens: integer(), temperature: float(), topP: number(), topK: number() }
Configuration used for tweaking model generation.
The structure of a GoogleAI get model response.
Has the following format:
%{
"name" => "models/gemini-pro",
"version" => "001",
"displayName" => "Gemini Pro",
"description" => "The best model for scaling across a wide range of tasks",
"inputTokenLimit" => 30720,
"outputTokenLimit" => 2048,
"supportedGenerationMethods" => [
"generateContent",
"countTokens"
],
"temperature" => 0.9,
"topP" => 1,
"topK" => 1
}
@type list_models_response() :: %{required(String.t()) => [get_model_response()]}
The structure of a GoogleAI list models response.
Has the following format:
%{
"models" => [
%{
"name" => "models/gemini-pro",
"version" => "001",
"displayName" => "Gemini Pro",
"description" => "The best model for scaling across a wide range of tasks",
"inputTokenLimit" => 30720,
"outputTokenLimit" => 2048,
"supportedGenerationMethods" => [
"generateContent",
"countTokens"
],
"temperature" => 0.9,
"topP" => 1,
"topK" => 1
}
]
}
Configuration used for tweaking model safety.
@type t() :: %GoogleAI.Model{ client: GoogleAI.Client.t(), generation_config: generation_config(), model: String.t(), safety_settings: safety_settings() }
Type of the underlying model struct.
Functions
@spec get(client :: GoogleAI.Client.t(), model_name :: String.t()) :: GoogleAI.Http.response(get_model_response())
Get information about the model with the given model_name
.
Arguments
:client
- TheGoogleAI.Client
to use for this request.:model_name
- The name of the model to look up.
Returns
A map containing the fields of the get model response.
See https://ai.google.dev/tutorials/rest_quickstart#get_model.
@spec list(client :: GoogleAI.Client.t()) :: GoogleAI.Http.response(list_models_response())
List information about the all models available on Google AI.
Arguments
:client
- TheGoogleAI.Client
to use for this request.
Returns
A map containing the fields of the list models response.
See https://ai.google.dev/tutorials/rest_quickstart#list_models
@spec new(client :: GoogleAI.Client.t(), opts :: Keyword.t()) :: t()
Create a new GoogleAI model from the given client
and opts
.
The function new/1
will use the default GoogleAI API configuration.
Options
:model
(String.t/0
) - Required. The model name e.g. gemini-pro, gemini-pro-vision or embedding-001.:generation_config
(keyword/0
) - The model generation configuration. These will be passed to requests as required.:safety_settings
(keyword/0
) - The model safety settings. These will be passed to requests as required.