@@ -25,7 +25,7 @@ def render_payload(messages, tools:, temperature:, model:, stream: nil,
25
25
Array ( tools )
26
26
end
27
27
28
- puts " \n [DEBUG] Available tools: #{ tools_array &.map { |t | t . name . to_s } } " if ENV [ "DEBUG" ]
28
+ RubyLLM . logger . debug " [DEBUG] Available tools: #{ tools_array &.map { |t | t . name . to_s } } "
29
29
30
30
# Use "any" for tool_choice when tools are available
31
31
effective_tool_choice = if tool_choice
@@ -36,7 +36,7 @@ def render_payload(messages, tools:, temperature:, model:, stream: nil,
36
36
"none"
37
37
end
38
38
39
- puts "[DEBUG] Tool choice: #{ effective_tool_choice . inspect } " if ENV [ "DEBUG" ]
39
+ RubyLLM . logger . debug "[DEBUG] Tool choice: #{ effective_tool_choice . inspect } "
40
40
41
41
payload = {
42
42
model : model ,
@@ -55,7 +55,7 @@ def render_payload(messages, tools:, temperature:, model:, stream: nil,
55
55
frequency_penalty : frequency_penalty ,
56
56
} . compact
57
57
58
- puts "[DEBUG] Full payload: #{ payload . inspect } " if ENV [ "DEBUG" ]
58
+ RubyLLM . logger . debug "[DEBUG] Full payload: #{ payload . inspect } "
59
59
60
60
payload
61
61
end
@@ -110,7 +110,7 @@ def render_tool_call(tool_call)
110
110
arguments : tool_call . arguments ,
111
111
} ,
112
112
}
113
- puts "[DEBUG] Rendered tool call: #{ tool_call_spec . inspect } " if ENV [ "DEBUG" ]
113
+ RubyLLM . logger . debug "[DEBUG] Rendered tool call: #{ tool_call_spec . inspect } "
114
114
tool_call_spec
115
115
end
116
116
@@ -132,7 +132,7 @@ def render_tool(tool)
132
132
}
133
133
}
134
134
}
135
- puts "[DEBUG] Rendered tool spec: #{ tool_spec . inspect } " if ENV [ "DEBUG" ]
135
+ RubyLLM . logger . debug "[DEBUG] Rendered tool spec: #{ tool_spec . inspect } "
136
136
tool_spec
137
137
end
138
138
@@ -144,7 +144,7 @@ def param_schema(param)
144
144
end
145
145
146
146
def parse_completion_response ( response )
147
- puts "\n [DEBUG] Raw response: #{ response . body . inspect } " if ENV [ "DEBUG" ]
147
+ RubyLLM . logger . debug "\n [DEBUG] Raw response: #{ response . body . inspect } "
148
148
149
149
if response . body [ "error" ]
150
150
error_message = response . body . dig ( "error" , "message" )
@@ -166,10 +166,10 @@ def parse_completion_response(response)
166
166
message = choice . dig ( "message" )
167
167
return unless message
168
168
169
- puts "[DEBUG] Message from model: #{ message . inspect } " if ENV [ "DEBUG" ]
169
+ RubyLLM . logger . debug "[DEBUG] Message from model: #{ message . inspect } "
170
170
171
171
tool_calls = Mistral ::Tools . parse_tool_calls ( message [ "tool_calls" ] )
172
- puts "[DEBUG] Parsed tool calls: #{ tool_calls . inspect } " if ENV [ "DEBUG" ]
172
+ RubyLLM . logger . debug "[DEBUG] Parsed tool calls: #{ tool_calls . inspect } "
173
173
174
174
content = message [ "content" ]
175
175
0 commit comments