Spaces:
Running
Running
Update agent_langchain.py
Browse files- agent_langchain.py +2 -2
agent_langchain.py
CHANGED
@@ -5,7 +5,7 @@ from langchain.agents import AgentType, initialize_agent, load_tools, tool
|
|
5 |
from langchain.chat_models import ChatOpenAI
|
6 |
|
7 |
@tool
|
8 |
-
def
|
9 |
"""Returns today's date. Use this for any questions related to knowing today's date.
|
10 |
The input should always be an empty string, and this function will always return today's date.
|
11 |
Any date mathematics should occur outside this function."""
|
@@ -22,7 +22,7 @@ def agent_langchain(config, prompt):
|
|
22 |
|
23 |
agent = initialize_agent(
|
24 |
tools + # built-in tools
|
25 |
-
[
|
26 |
llm,
|
27 |
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
28 |
handle_parsing_errors = True,
|
|
|
5 |
from langchain.chat_models import ChatOpenAI
|
6 |
|
7 |
@tool
|
8 |
+
def today_tool(text: str) -> str:
|
9 |
"""Returns today's date. Use this for any questions related to knowing today's date.
|
10 |
The input should always be an empty string, and this function will always return today's date.
|
11 |
Any date mathematics should occur outside this function."""
|
|
|
22 |
|
23 |
agent = initialize_agent(
|
24 |
tools + # built-in tools
|
25 |
+
[today_tool], # custom tools
|
26 |
llm,
|
27 |
agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
|
28 |
handle_parsing_errors = True,
|