Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/roast/cogs/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ class MissingPromptError < AgentCogError; end
#: (Input) -> Output
def execute(input)
output = provider.invoke(input)
puts "[AGENT STATS] #{output.stats}" if config.show_stats?
puts "Session ID: #{output.session}" if config.show_stats?
if config.show_stats?
Event << { block: { header: "AGENT STATS", content: "#{output.stats}\nSession ID: #{output.session}" } }
Comment thread
LasmarKhalifa marked this conversation as resolved.
end
output
end

Expand Down
10 changes: 5 additions & 5 deletions lib/roast/cogs/chat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def execute(input)
end
if config.show_stats?
temperature = chat.instance_variable_get(:@temperature)
puts "[LLM STATS]"
puts "\tModel: #{response.model_id}"
puts "\tTemperature: #{format("%0.2f", temperature)}" if temperature
puts "\tInput Tokens: #{response.input_tokens}"
puts "\tOutput Tokens: #{response.output_tokens}"
lines = ["Model: #{response.model_id}"]
lines << "Temperature: #{format("%0.2f", temperature)}" if temperature
lines << "Input Tokens: #{response.input_tokens}"
lines << "Output Tokens: #{response.output_tokens}"
Event << { block: { header: "LLM STATS", content: lines.join("\n") } }
end

Output.new(Session.from_chat(chat), response.content)
Expand Down
15 changes: 12 additions & 3 deletions test/examples/functional/roast_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ class RoastExamplesTest < FunctionalTest
────────────────────────────────────────
12 - 5 = 7
────────────────────────────────────────
[AGENT STATS] Turns: 3
[AGENT STATS]
────────────────────────────────────────
Turns: 3
Duration: 6 seconds
Cost (USD): $0.0747
Tokens (claude-haiku-4-5-20251001): 27 in, 198 out
Session ID: 51c68f29-7210-4c12-852f-0c169f621488
────────────────────────────────────────
((2 + 2) * 3) - 5 = 7
STDOUT
assert_equal expected_stdout, logged_stdout
Expand Down Expand Up @@ -637,11 +640,14 @@ class RoastExamplesTest < FunctionalTest
Ancient waters vast and deep,
World's largest lake gleams.
────────────────────────────────────────
[AGENT STATS] Turns: 1
[AGENT STATS]
────────────────────────────────────────
Turns: 1
Duration: 4 seconds
Cost (USD): $0.050913
Tokens (claude-haiku-4-5-20251001): 9 in, 385 out
Session ID: 6d6782cf-d193-4fc7-b5f4-414bc0cfcd3a
────────────────────────────────────────
STDOUT
assert_equal expected_stdout, logged_stdout
assert_empty logged_stderr
Expand Down Expand Up @@ -688,11 +694,14 @@ class RoastExamplesTest < FunctionalTest
Ancient waters vast and deep,
World's largest lake gleams.
────────────────────────────────────────
[AGENT STATS] Turns: 1
[AGENT STATS]
────────────────────────────────────────
Turns: 1
Duration: 0 seconds
Cost (USD): $0.024634
Tokens (claude-haiku-4-5-20251001): 9 in, 25 out
Session ID: a1b2c3d4-e5f6-7890-abcd-ef1234567890
────────────────────────────────────────
STDOUT
assert_equal expected_stdout, logged_stdout
assert_empty logged_stderr
Expand Down
Loading