Class: RubyLLM::Context
- Inherits:
-
Object
- Object
- RubyLLM::Context
- Defined in:
- lib/ruby_llm/context.rb
Overview
Holds per-call configs
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #chat(*args, **kwargs) ⇒ Object
- #connection_for(provider_instance) ⇒ Object
- #embed(*args, **kwargs) ⇒ Object
-
#initialize(config) ⇒ Context
constructor
A new instance of Context.
- #paint(*args, **kwargs) ⇒ Object
Constructor Details
#initialize(config) ⇒ Context
Returns a new instance of Context.
8 9 10 11 |
# File 'lib/ruby_llm/context.rb', line 8 def initialize(config) @config = config @connections = {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/ruby_llm/context.rb', line 6 def config @config end |
Instance Method Details
#chat(*args, **kwargs) ⇒ Object
13 14 15 |
# File 'lib/ruby_llm/context.rb', line 13 def chat(*args, **kwargs, &) Chat.new(*args, **kwargs, context: self, &) end |
#connection_for(provider_instance) ⇒ Object
25 26 27 |
# File 'lib/ruby_llm/context.rb', line 25 def connection_for(provider_instance) provider_instance.connection end |
#embed(*args, **kwargs) ⇒ Object
17 18 19 |
# File 'lib/ruby_llm/context.rb', line 17 def (*args, **kwargs, &) Embedding.(*args, **kwargs, context: self, &) end |
#paint(*args, **kwargs) ⇒ Object
21 22 23 |
# File 'lib/ruby_llm/context.rb', line 21 def paint(*args, **kwargs, &) Image.paint(*args, **kwargs, context: self, &) end |