bstraehle commited on
Commit
c5b702c
·
1 Parent(s): d193340

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -12,7 +12,7 @@ _ = load_dotenv(find_dotenv())
12
  OPENWEATHERMAP_API_KEY = os.environ["OPENWEATHERMAP_API_KEY"]
13
 
14
  config = {
15
- "model_name": "gpt-4-0613",
16
  "temperature": 0,
17
  }
18
 
@@ -20,7 +20,7 @@ AGENT_OFF = False
20
  AGENT_ON = True
21
 
22
  @tool
23
- def time(text: str) -> str:
24
  """Returns today's date. Use this for any questions related to knowing today's date.
25
  The input should always be an empty string, and this function will always return today's date.
26
  Any date mathematics should occur outside this function."""
@@ -42,21 +42,21 @@ def invoke(openai_api_key, prompt, agent_option):
42
 
43
  completion = client.chat.completions.create(
44
  messages = [{"role": "user", "content": prompt}],
45
- model = config["model_name"],
46
  temperature = config["temperature"],)
47
 
48
  output = completion.choices[0].message.content
49
  else:
50
  llm = ChatOpenAI(
51
- model_name = config["model_name"],
52
  openai_api_key = openai_api_key,
53
  temperature = config["temperature"])
54
 
55
  tools = load_tools(["openweathermap-api"])
56
 
57
  agent = initialize_agent(
58
- tools + # built-in tools
59
- [time], # custom tools
60
  llm,
61
  agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
62
  handle_parsing_errors = True,
 
12
  OPENWEATHERMAP_API_KEY = os.environ["OPENWEATHERMAP_API_KEY"]
13
 
14
  config = {
15
+ "model: "gpt-4-0613",
16
  "temperature": 0,
17
  }
18
 
 
20
  AGENT_ON = True
21
 
22
  @tool
23
+ def date_tool(text: str) -> str:
24
  """Returns today's date. Use this for any questions related to knowing today's date.
25
  The input should always be an empty string, and this function will always return today's date.
26
  Any date mathematics should occur outside this function."""
 
42
 
43
  completion = client.chat.completions.create(
44
  messages = [{"role": "user", "content": prompt}],
45
+ model = config["model"],
46
  temperature = config["temperature"],)
47
 
48
  output = completion.choices[0].message.content
49
  else:
50
  llm = ChatOpenAI(
51
+ model_name = config["model"],
52
  openai_api_key = openai_api_key,
53
  temperature = config["temperature"])
54
 
55
  tools = load_tools(["openweathermap-api"])
56
 
57
  agent = initialize_agent(
58
+ tools + # built-in tools
59
+ [date_tool], # custom tools
60
  llm,
61
  agent = AgentType.CHAT_ZERO_SHOT_REACT_DESCRIPTION,
62
  handle_parsing_errors = True,