Class: Riffer::Providers::Gemini
- Defined in:
- lib/riffer/providers/gemini.rb
Overview
Google Gemini provider for Gemini models via the Gemini REST API.
Constant Summary collapse
- BASE_URI =
URI("https://generativelanguage.googleapis.com")
- VALID_MODEL_PATTERN =
: Regexp
/\A[a-zA-Z0-9._-]+\z/- DEFAULT_OPEN_TIMEOUT =
: Integer
10- DEFAULT_READ_TIMEOUT =
: Integer
60- FINISH_REASONS =
{ "STOP" => :stop, "MAX_TOKENS" => :length, "SAFETY" => :content_filter, "RECITATION" => :content_filter, "BLOCKLIST" => :content_filter, "PROHIBITED_CONTENT" => :content_filter, "SPII" => :content_filter, "IMAGE_SAFETY" => :content_filter, "MALFORMED_FUNCTION_CALL" => :error }.freeze
Constants inherited from Base
Class Method Summary collapse
-
.semconv_provider_name ⇒ Object
The GenAI semconv well-known provider name.
Instance Method Summary collapse
-
#initialize(api_key: nil, open_timeout: nil, read_timeout: nil, **options) ⇒ Gemini
constructor
– : (?api_key: String?, ?open_timeout: Integer?, ?read_timeout: Integer?, **untyped) -> void.
Methods inherited from Base
#generate_text, skills_adapter, #stream_text
Constructor Details
#initialize(api_key: nil, open_timeout: nil, read_timeout: nil, **options) ⇒ Gemini
– : (?api_key: String?, ?open_timeout: Integer?, ?read_timeout: Integer?, **untyped) -> void
41 42 43 44 45 46 |
# File 'lib/riffer/providers/gemini.rb', line 41 def initialize(api_key: nil, open_timeout: nil, read_timeout: nil, **) api_key ||= Riffer.config.gemini.api_key @api_key = api_key @open_timeout = open_timeout || Riffer.config.gemini.open_timeout || DEFAULT_OPEN_TIMEOUT @read_timeout = read_timeout || Riffer.config.gemini.read_timeout || DEFAULT_READ_TIMEOUT end |
Class Method Details
.semconv_provider_name ⇒ Object
The GenAI semconv well-known provider name. – : () -> String
35 36 37 |
# File 'lib/riffer/providers/gemini.rb', line 35 def self.semconv_provider_name "gcp.gemini" end |