class Gemini::GenerativeModel
- Gemini::GenerativeModel
- Reference
- Object
Overview
Generates a model response given an input.
Included Modules
- JSON::Serializable
Defined in:
gemini/models.crConstant Summary
-
HEADERS =
HTTP::Headers {"Content-Type" => "application/json"}
Constructors
- .new(pull : JSON::PullParser)
-
.new(model_name : String, system_instruction : Gemini::Content | Nil = nil, generation_config : Gemini::GenerationConfig | Nil = nil, safety_settings : Nil | Array(Gemini::SafetySetting) = nil, tools : Nil | Array(Gemini::Tool) = nil, tool_config : Gemini::ToolConfig | Nil = nil, cached_content : Nil | String = nil)
Configuration parameters are optional and non-initialized, so they must be defined later
Instance Method Summary
-
#cached_content : String | Nil
The name of the content cached to use as context to serve the prediction.
-
#cached_content=(cached_content : String | Nil)
The name of the content cached to use as context to serve the prediction.
-
#contents : Array(Content) | Deque(Content) | Content
The content of the current conversation with the model.
-
#contents=(contents : Array(Content) | Deque(Content) | Content)
The content of the current conversation with the model.
-
#contents? : Array(Content) | Deque(Content) | Content | Nil
The content of the current conversation with the model.
- #generate_content(text : String) : GenerateContentResponse
- #generate_content(contents : Array(Gemini::Content) | Deque(Gemini::Content) | Gemini::Content | Nil) : GenerateContentResponse
-
#generation_config : GenerationConfig | Nil
Configuration options for model generation and outputs.
-
#generation_config=(generation_config : GenerationConfig | Nil)
Configuration options for model generation and outputs.
-
#safety_settings : Array(SafetySetting) | Nil
A list of unique SafetySetting instances for blocking unsafe content.
-
#safety_settings=(safety_settings : Array(SafetySetting) | Nil)
A list of unique SafetySetting instances for blocking unsafe content.
-
#system_instruction : Content | Nil
Developer set
system instruction(s)
. -
#system_instruction=(system_instruction : Content | Nil)
Developer set
system instruction(s)
. -
#tool_config : ToolConfig | Nil
Tool configuration for any Tool specified in the request.
-
#tool_config=(tool_config : ToolConfig | Nil)
Tool configuration for any Tool specified in the request.
-
#tools : Array(Tool) | Nil
A list of Tools the Model may use to generate the next response.
-
#tools=(tools : Array(Tool) | Nil)
A list of Tools the Model may use to generate the next response.
Constructor Detail
Configuration parameters are optional and non-initialized, so they must be defined later
Instance Method Detail
The name of the content cached to use as context to serve the prediction. (Optional)
The name of the content cached to use as context to serve the prediction. (Optional)
The content of the current conversation with the model. (Required) For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
The content of the current conversation with the model. (Required) For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
The content of the current conversation with the model. (Required) For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
Configuration options for model generation and outputs. (Optional)
Configuration options for model generation and outputs. (Optional)
A list of unique SafetySetting instances for blocking unsafe content. (Optional)
A list of unique SafetySetting instances for blocking unsafe content. (Optional)
Developer set system instruction(s)
. Currently, text only. (Optional)
Developer set system instruction(s)
. Currently, text only. (Optional)
Tool configuration for any Tool specified in the request. Refer to the Function calling guide for a usage example. (Optional)
Tool configuration for any Tool specified in the request. Refer to the Function calling guide for a usage example. (Optional)
A list of Tools the Model may use to generate the next response. (Optional)