Class: Rixie::LLM::Client
- Inherits:
-
Object
- Object
- Rixie::LLM::Client
- Defined in:
- lib/rixie/llm/client.rb,
lib/rixie/llm/client/resolver.rb
Defined Under Namespace
Classes: Resolver
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Instance Method Summary collapse
- #call(messages, tools:, &block) ⇒ Object
-
#initialize(model: nil, provider: nil, adapter: nil, stream: false, request_timeout: nil, max_tokens: nil, temperature: nil, parallel_tool_calls: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(model: nil, provider: nil, adapter: nil, stream: false, request_timeout: nil, max_tokens: nil, temperature: nil, parallel_tool_calls: nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rixie/llm/client.rb', line 10 def initialize(model: nil, provider: nil, adapter: nil, stream: false, request_timeout: nil, max_tokens: nil, temperature: nil, parallel_tool_calls: nil) @model = model @provider = provider @stream = stream @adapter = adapter || Client::Resolver.resolve( model: model, provider: provider, request_timeout: request_timeout, max_tokens: max_tokens, temperature: temperature, parallel_tool_calls: parallel_tool_calls ) end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
8 9 10 |
# File 'lib/rixie/llm/client.rb', line 8 def model @model end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
8 9 10 |
# File 'lib/rixie/llm/client.rb', line 8 def provider @provider end |
Instance Method Details
#call(messages, tools:, &block) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rixie/llm/client.rb', line 24 def call(, tools:, &block) if @stream @adapter.stream(, tools: tools, &block) else @adapter.chat(, tools: tools) end end |