Class: LLM::MessageFilter::DeleteBacktrace
- Inherits:
-
LLM::MessageFilter
- Object
- LLM::MessageFilter
- LLM::MessageFilter::DeleteBacktrace
- Defined in:
- lib/llm/message_filter/delete_backtrace.rb
Overview
The DeleteBacktrace class removes the backtrace that the runtime includes with a Function::Return that represents an unrescued exception raised by a tool.
Instance Attribute Summary
Attributes inherited from LLM::MessageFilter
Instance Method Summary collapse
Methods inherited from LLM::MessageFilter
Constructor Details
This class inherits a constructor from LLM::MessageFilter
Instance Method Details
#call(message:, **opts) ⇒ LLM::Message
15 16 17 18 19 20 21 22 |
# File 'lib/llm/message_filter/delete_backtrace.rb', line 15 def call(message:, **opts) returns = [*.content].flatten.grep(LLM::Function::Return) returns.each do next unless it.error? it.value.delete(:backtrace) end end |