Skip to content

Commit

Permalink
Update dependencies & fix config param in output handler _run
Browse files Browse the repository at this point in the history
  • Loading branch information
whimo committed Jul 23, 2024
1 parent 48c9b9b commit ba718f2
Show file tree
Hide file tree
Showing 3 changed files with 597 additions and 662 deletions.
6 changes: 3 additions & 3 deletions motleycrew/agents/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from langchain_core.agents import AgentFinish, AgentAction
from langchain_core.callbacks import CallbackManagerForChainRun
from langchain_core.messages import AIMessage
from langchain_core.runnables import RunnableConfig
from langchain_core.tools import BaseTool, Tool

from motleycrew.agents.parent import DirectOutput
from motleycrew.tools import MotleyTool

Expand Down Expand Up @@ -109,9 +109,9 @@ def wrapper(
def _run_tool_direct_decorator(self, func: Callable):
"""Decorator of the tool's _run method, for intercepting a DirectOutput exception"""

def wrapper(*args, **kwargs):
def wrapper(*args, config: RunnableConfig, **kwargs):
try:
result = func(*args, **kwargs)
result = func(*args, **kwargs, config=config)
except DirectOutput as direct_exc:
return direct_exc
return result
Expand Down
3 changes: 1 addition & 2 deletions motleycrew/agents/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from langchain_core.runnables import RunnableConfig
from langchain_core.tools import StructuredTool
from langchain_core.tools import Tool

from motleycrew.agents.abstract_parent import MotleyAgentAbstractParent
from motleycrew.agents.output_handler import MotleyOutputHandler
from motleycrew.common import MotleyAgentFactory, MotleySupportedTool
Expand Down Expand Up @@ -193,7 +192,7 @@ def handle_agent_output(*args, **kwargs):

try:
iteration += 1
output = self.output_handler._run(*args, **kwargs)
output = self.output_handler._run(*args, **kwargs, config=RunnableConfig())
except exceptions_to_handle as exc:
if iteration <= max_iterations:
return f"{exc.__class__.__name__}: {str(exc)}"
Expand Down
Loading

0 comments on commit ba718f2

Please sign in to comment.