Module: RCrewAI::AgentAugmentations
- Included in:
- Agent
- Defined in:
- lib/rcrewai/agent_augmentations.rb
Overview
Optional per-task augmentations mixed into Agent: a reasoning/planning pass before answering, and context-window trimming of the message history. Kept in a module so Agent's core stays focused.
Instance Method Summary collapse
-
#fit_context(messages) ⇒ Object
Trims a message list to fit the model's context window when the agent has respect_context_window enabled; otherwise returns it unchanged.
- #reasoning? ⇒ Boolean
- #respect_context_window? ⇒ Boolean
Instance Method Details
#fit_context(messages) ⇒ Object
Trims a message list to fit the model's context window when the agent has respect_context_window enabled; otherwise returns it unchanged. Called by the runners before each LLM call.
21 22 23 24 25 26 27 |
# File 'lib/rcrewai/agent_augmentations.rb', line 21 def fit_context() return unless @respect_context_window limit = ContextWindow.window_for(llm_model_name) reserve = [RCrewAI.configuration.max_tokens.to_i, 0].max ContextWindow.fit(, limit: limit, reserve: reserve) end |
#reasoning? ⇒ Boolean
10 11 12 |
# File 'lib/rcrewai/agent_augmentations.rb', line 10 def reasoning? @reasoning end |
#respect_context_window? ⇒ Boolean
14 15 16 |
# File 'lib/rcrewai/agent_augmentations.rb', line 14 def respect_context_window? @respect_context_window end |