Scott Cogan commited on
Commit
deb41f8
·
1 Parent(s): cf37a8d

Update app.py and requirements.txt

Browse files
Files changed (2) hide show
  1. app.py +7 -6
  2. requirements.txt +5 -2
app.py CHANGED
@@ -1,4 +1,5 @@
1
- from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIModel, load_tool, tool
 
2
  import datetime
3
  import requests
4
  import pytz
@@ -53,11 +54,11 @@ def get_current_time_in_timezone(timezone: str) -> str:
53
  final_answer = FinalAnswerTool()
54
 
55
  # Initialize OpenAI model
56
- model = OpenAIModel(
57
- model="gpt-4-turbo-preview", # Using GPT-4 Turbo for best performance
58
- max_tokens=4096, # Increased max tokens for more complex responses
59
- temperature=0.1, # Lower temperature for more focused answers
60
- api_key=os.getenv("OPENAI_API_KEY"), # Get API key from HF Space environment variables
61
  )
62
 
63
  # Import tool from Hub
 
1
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, load_tool, tool
2
+ from openai import OpenAI
3
  import datetime
4
  import requests
5
  import pytz
 
54
  final_answer = FinalAnswerTool()
55
 
56
  # Initialize OpenAI model
57
+ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
58
+ model = client.chat.completions.create(
59
+ model="gpt-4-turbo-preview",
60
+ max_tokens=4096,
61
+ temperature=0.1,
62
  )
63
 
64
  # Import tool from Hub
requirements.txt CHANGED
@@ -1,6 +1,9 @@
1
  markdownify
2
- smolagents
3
  requests
4
  duckduckgo_search
5
  pandas
6
- openai>=1.0.0 # Add this line
 
 
 
 
1
  markdownify
2
+ smolagents>=0.1.0
3
  requests
4
  duckduckgo_search
5
  pandas
6
+ openai>=1.12.0
7
+ pytz
8
+ pyyaml
9
+ gradio