Class: DSPy::LM::Adapter
- Inherits:
-
Object
- Object
- DSPy::LM::Adapter
- Defined in:
- lib/dspy/lm/adapter.rb
Overview
Base adapter interface for all LM providers
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#chat(messages:, signature: nil, &block) ⇒ DSPy::LM::Response
Chat interface that all adapters must implement.
-
#initialize(model:, api_key:) ⇒ Adapter
constructor
A new instance of Adapter.
Constructor Details
#initialize(model:, api_key:) ⇒ Adapter
Returns a new instance of Adapter.
9 10 11 12 13 |
# File 'lib/dspy/lm/adapter.rb', line 9 def initialize(model:, api_key:) @model = model @api_key = api_key validate_configuration! end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/dspy/lm/adapter.rb', line 7 def api_key @api_key end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/dspy/lm/adapter.rb', line 7 def model @model end |
Instance Method Details
#chat(messages:, signature: nil, &block) ⇒ DSPy::LM::Response
Chat interface that all adapters must implement
20 21 22 |
# File 'lib/dspy/lm/adapter.rb', line 20 def chat(messages:, signature: nil, &block) raise NotImplementedError, "Subclasses must implement #chat method" end |