bstraehle commited on
Commit
cab5cd2
·
1 Parent(s): 46d29e9

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +4 -8
agent.py CHANGED
@@ -1,13 +1,9 @@
 
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.
@@ -15,11 +11,11 @@ def date_tool(text: str) -> str:
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"],
21
  openai_api_key = openai_api_key,
22
- temperature = config["temperature"])
23
 
24
  tools = load_tools(["openweathermap-api"])
25
 
 
1
+ from datetime import date
2
  from langchain.agents import AgentType, initialize_agent, load_tools, tool
3
  from langchain.chat_models import ChatOpenAI
4
 
5
  OPENWEATHERMAP_API_KEY = os.environ["OPENWEATHERMAP_API_KEY"]
6
 
 
 
 
 
 
7
  @tool
8
  def date_tool(text: str) -> str:
9
  """Returns today's date. Use this for any questions related to knowing today's date.
 
11
  Any date mathematics should occur outside this function."""
12
  return str(date.today())
13
 
14
+ def invoke_agent(model, temperature, openai_api_key, prompt):
15
  llm = ChatOpenAI(
16
+ model_name = model,
17
  openai_api_key = openai_api_key,
18
+ temperature = temperature)
19
 
20
  tools = load_tools(["openweathermap-api"])
21