Class: DSPy::Gemini::Guardrails

Inherits:
Object
  • Object
show all
Defined in:
lib/dspy/gemini/guardrails.rb

Constant Summary collapse

SUPPORTED_GEMINI_VERSIONS =
"~> 4.3".freeze

Class Method Summary collapse

Class Method Details

.ensure_gemini_installed!Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dspy/gemini/guardrails.rb', line 10

def self.ensure_gemini_installed!
  require 'gemini-ai'

  spec = Gem.loaded_specs["gemini-ai"]
  unless spec && Gem::Requirement.new(SUPPORTED_GEMINI_VERSIONS).satisfied_by?(spec.version)
    msg = "      DSPY requires `gemini-ai` gem \#{SUPPORTED_GEMINI_VERSIONS}.\n      Please Install or upgrade it with `bundle add gemini-ai --version \"\#{SUPPORTED_GEMINI_VERSIONS}\"`.\n    MSG\n    raise DSPy::LM::UnsupportedVersionError, msg\n  end\nend\n"