Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,8 @@ import os
|
|
18 |
hf_token = os.environ['HF_TOKEN']
|
19 |
serp_token = os.environ['SERP_TOKEN']
|
20 |
repo_id = "sentence-transformers/all-mpnet-base-v2"
|
|
|
|
|
21 |
|
22 |
|
23 |
|
@@ -119,7 +121,13 @@ def main():
|
|
119 |
name="search",
|
120 |
func=search,
|
121 |
description="use this tool to answer real time or current search related questions."
|
122 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
# tool for asking human
|
124 |
human_ask_tool = CustomAskHumanTool()
|
125 |
# agent prompt
|
@@ -129,7 +137,7 @@ def main():
|
|
129 |
# initialize agent
|
130 |
agent = initialize_agent(
|
131 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
132 |
-
tools=[db_search_tool,search_tool],
|
133 |
llm=llm,
|
134 |
verbose=True,
|
135 |
max_iterations=5,
|
|
|
18 |
hf_token = os.environ['HF_TOKEN']
|
19 |
serp_token = os.environ['SERP_TOKEN']
|
20 |
repo_id = "sentence-transformers/all-mpnet-base-v2"
|
21 |
+
from datetime import datetime
|
22 |
+
from langchain.tools import Tool
|
23 |
|
24 |
|
25 |
|
|
|
121 |
name="search",
|
122 |
func=search,
|
123 |
description="use this tool to answer real time or current search related questions."
|
124 |
+
)
|
125 |
+
# Define a new tool that returns the current datetime
|
126 |
+
datetime_tool = Tool(
|
127 |
+
name="Datetime",
|
128 |
+
func=lambda x: datetime.now().isoformat(),
|
129 |
+
description="Returns the current datetime",
|
130 |
+
)
|
131 |
# tool for asking human
|
132 |
human_ask_tool = CustomAskHumanTool()
|
133 |
# agent prompt
|
|
|
137 |
# initialize agent
|
138 |
agent = initialize_agent(
|
139 |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
140 |
+
tools=[db_search_tool,search_tool,datetime_tool],
|
141 |
llm=llm,
|
142 |
verbose=True,
|
143 |
max_iterations=5,
|