Class: LexLLM::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/lex_llm/context.rb

Overview

Holds per-call configs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Context

Returns a new instance of Context.



8
9
10
11
# File 'lib/lex_llm/context.rb', line 8

def initialize(config)
  @config = config
  @connections = {}
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/lex_llm/context.rb', line 6

def config
  @config
end

Instance Method Details

#chatObject



13
14
15
# File 'lib/lex_llm/context.rb', line 13

def chat(*, **, &)
  Chat.new(*, **, context: self, &)
end

#connection_for(provider_instance) ⇒ Object



25
26
27
# File 'lib/lex_llm/context.rb', line 25

def connection_for(provider_instance)
  provider_instance.connection
end

#embedObject



17
18
19
# File 'lib/lex_llm/context.rb', line 17

def embed(*, **, &)
  Embedding.embed(*, **, context: self, &)
end

#paintObject



21
22
23
# File 'lib/lex_llm/context.rb', line 21

def paint(*, **, &)
  Image.paint(*, **, context: self, &)
end