Module: RSpec::LLM::Helpers
- Defined in:
- lib/rspec/llm/helpers.rb
Overview
Methods mixed into example groups via RSpec.configure (see rspec.rb).
Instance Method Summary collapse
-
#llm ⇒ Object
The configured client wrapped as an Adapter.
-
#stub_llm {|fake| ... } ⇒ Object
Configure a Fake adapter and yield it for stubbing.
-
#stub_llm_judge {|fake| ... } ⇒ Object
Same, but installs the fake as the judge.
Instance Method Details
#llm ⇒ Object
The configured client wrapped as an Adapter. Returns nil if not configured.
8 9 10 |
# File 'lib/rspec/llm/helpers.rb', line 8 def llm RSpec::LLM.client end |
#stub_llm {|fake| ... } ⇒ Object
Configure a Fake adapter and yield it for stubbing. Replaces the global client for the duration of the example. After the example RSpec::LLM is reset via the ‘after` hook installed in rspec.rb.
15 16 17 18 19 20 |
# File 'lib/rspec/llm/helpers.rb', line 15 def stub_llm fake = RSpec::LLM::Adapters::Fake.new yield fake if block_given? RSpec::LLM.configuration.client = fake fake end |