Class: LLM::MessageFilter::Multi
- Inherits:
-
LLM::MessageFilter
- Object
- LLM::MessageFilter
- LLM::MessageFilter::Multi
- Defined in:
- lib/llm/message_filter/multi.rb
Overview
A filter that fans out to multiple other filters, so a message can be filtered multiple times by different filters.
Instance Attribute Summary collapse
-
#filters ⇒ Array<LLM::MessageFilter>
readonly
Returns the filters under the supervision of Multi.
Attributes inherited from LLM::MessageFilter
Instance Method Summary collapse
-
#initialize(*filters) ⇒ Multi
constructor
A new instance of Multi.
- #call(message:, **opts) ⇒ LLM::Message
Methods inherited from LLM::MessageFilter
Constructor Details
#initialize(*filters) ⇒ Multi
Returns a new instance of Multi.
26 27 28 29 |
# File 'lib/llm/message_filter/multi.rb', line 26 def initialize(*filters) super(nil) @filters = filters end |
Instance Attribute Details
#filters ⇒ Array<LLM::MessageFilter> (readonly)
Returns the filters under the supervision of Multi
20 21 22 |
# File 'lib/llm/message_filter/multi.rb', line 20 def filters @filters end |
Instance Method Details
#call(message:, **opts) ⇒ LLM::Message
34 35 36 37 38 |
# File 'lib/llm/message_filter/multi.rb', line 34 def call(message:, **opts) @filters.map do = it.call(message:, **opts) end.last end |