From 2971c5f5c38c7134a7d931937d5142e3de764471 Mon Sep 17 00:00:00 2001 From: Egor Kraev Date: Mon, 29 Jul 2024 15:09:57 +0200 Subject: [PATCH] minor tweaks --- motleycrew/agents/__init__.py | 2 ++ motleycrew/agents/langchain/langchain.py | 3 ++- motleycrew/agents/langchain/tool_calling_react.py | 2 +- motleycrew/agents/parent.py | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/motleycrew/agents/__init__.py b/motleycrew/agents/__init__.py index e240d90a..b5d8f69f 100644 --- a/motleycrew/agents/__init__.py +++ b/motleycrew/agents/__init__.py @@ -3,9 +3,11 @@ from .abstract_parent import MotleyAgentAbstractParent from .output_handler import MotleyOutputHandler from .parent import MotleyAgentParent +from .langchain import LangchainMotleyAgent __all__ = [ "MotleyAgentAbstractParent", "MotleyAgentParent", "MotleyOutputHandler", + "LangchainMotleyAgent", ] diff --git a/motleycrew/agents/langchain/langchain.py b/motleycrew/agents/langchain/langchain.py index 33a8510d..a6bf7600 100644 --- a/motleycrew/agents/langchain/langchain.py +++ b/motleycrew/agents/langchain/langchain.py @@ -6,6 +6,7 @@ from langchain_core.chat_history import InMemoryChatMessageHistory from langchain_core.runnables import RunnableConfig from langchain_core.runnables.history import RunnableWithMessageHistory, GetSessionHistoryCallable +from langchain_core.prompts.chat import ChatPromptTemplate from motleycrew.agents.mixins import LangchainOutputHandlingAgentMixin from motleycrew.agents.parent import MotleyAgentParent @@ -21,7 +22,7 @@ def __init__( self, description: str | None = None, name: str | None = None, - prompt_prefix: str | None = None, + prompt_prefix: str | ChatPromptTemplate | None = None, agent_factory: MotleyAgentFactory[AgentExecutor] | None = None, tools: Sequence[MotleySupportedTool] | None = None, output_handler: MotleySupportedTool | None = None, diff --git a/motleycrew/agents/langchain/tool_calling_react.py b/motleycrew/agents/langchain/tool_calling_react.py index 3d4a7efd..1240fcda 100644 --- a/motleycrew/agents/langchain/tool_calling_react.py +++ b/motleycrew/agents/langchain/tool_calling_react.py @@ -101,7 +101,7 @@ def __init__( tools: Sequence[MotleySupportedTool], description: str | None = None, name: str | None = None, - prompt_prefix: str | None = None, + prompt_prefix: str | ChatPromptTemplate | None = None, prompt: ChatPromptTemplate | None = None, chat_history: bool | GetSessionHistoryCallable = True, output_handler: MotleySupportedTool | None = None, diff --git a/motleycrew/agents/parent.py b/motleycrew/agents/parent.py index b492bcba..e5f52de7 100644 --- a/motleycrew/agents/parent.py +++ b/motleycrew/agents/parent.py @@ -55,7 +55,7 @@ class MotleyAgentParent(MotleyAgentAbstractParent, ABC): def __init__( self, - prompt_prefix: str | None = None, + prompt_prefix: str | ChatPromptTemplate | None = None, description: str | None = None, name: str | None = None, agent_factory: MotleyAgentFactory | None = None,