Module: RubyLLM::Provider::InstanceMethods

Defined in:
lib/ruby_llm/provider.rb

Instance Method Summary collapse

Instance Method Details

#complete(messages, tools: [], model: nil, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/ruby_llm/provider.rb', line 10

def complete(messages, tools: [], model: nil, &block)
  payload = build_payload messages, tools, model: model, stream: block_given?

  if block_given?
    stream_response payload, &block
  else
    sync_response payload
  end
end

#list_modelsObject



20
21
22
23
24
25
26
# File 'lib/ruby_llm/provider.rb', line 20

def list_models
  response = connection.get(models_url) do |req|
    req.headers.merge! headers
  end

  parse_list_models_response response
end