6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/turnkit/adapters/ruby_llm.rb', line 6
def chat(model:, messages:, tools:, instructions:, temperature: nil, metadata: nil)
require "ruby_llm"
configure_from_environment
chat = ::RubyLLM.chat(model: model)
chat.with_instructions(instructions) if instructions && !instructions.empty?
chat.with_temperature(temperature) if temperature
Array(tools).each { |tool| chat.with_tool(ruby_llm_tool(tool)) }
Array(messages).each { |message| add_message(chat, message) }
response = complete_without_tool_execution(chat)
normalize_response(response, model: model)
end
|