Class: Legion::Extensions::Llm::Context
- Inherits:
-
Object
- Object
- Legion::Extensions::Llm::Context
- Defined in:
- lib/legion/extensions/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 ⇒ Object
- #connection_for(provider_instance) ⇒ Object
- #embed ⇒ Object
-
#initialize(config) ⇒ Context
constructor
A new instance of Context.
- #paint ⇒ Object
Constructor Details
#initialize(config) ⇒ Context
Returns a new instance of Context.
10 11 12 13 |
# File 'lib/legion/extensions/llm/context.rb', line 10 def initialize(config) @config = config @connections = {} end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/legion/extensions/llm/context.rb', line 8 def config @config end |
Instance Method Details
#chat ⇒ Object
15 16 17 |
# File 'lib/legion/extensions/llm/context.rb', line 15 def chat(*, **, &) Chat.new(*, **, context: self, &) end |
#connection_for(provider_instance) ⇒ Object
27 28 29 |
# File 'lib/legion/extensions/llm/context.rb', line 27 def connection_for(provider_instance) provider_instance.connection end |
#embed ⇒ Object
19 20 21 |
# File 'lib/legion/extensions/llm/context.rb', line 19 def (*, **, &) Embedding.(*, **, context: self, &) end |