bstraehle commited on
Commit
46e9da4
·
1 Parent(s): 3d0e4b2

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +14 -0
agent.py CHANGED
@@ -1,6 +1,20 @@
1
  from langchain.agents import AgentType, initialize_agent, load_tools, tool
2
  from langchain.chat_models import ChatOpenAI
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  def invoke_agent(openai_api_key, prompt):
5
  llm = ChatOpenAI(
6
  model_name = config["model"],
 
1
  from langchain.agents import AgentType, initialize_agent, load_tools, tool
2
  from langchain.chat_models import ChatOpenAI
3
 
4
+ OPENWEATHERMAP_API_KEY = os.environ["OPENWEATHERMAP_API_KEY"]
5
+
6
+ config = {
7
+ "model": "gpt-4-0613",
8
+ "temperature": 0,
9
+ }
10
+
11
+ @tool
12
+ def date_tool(text: str) -> str:
13
+ """Returns today's date. Use this for any questions related to knowing today's date.
14
+ The input should always be an empty string, and this function will always return today's date.
15
+ Any date mathematics should occur outside this function."""
16
+ return str(date.today())
17
+
18
  def invoke_agent(openai_api_key, prompt):
19
  llm = ChatOpenAI(
20
  model_name = config["model"],