tobyvertommen Claude Sonnet 4.6 commited on
Commit
3f25911
·
1 Parent(s): 6195748

Switch from Groq to OpenAI gpt-4o-mini

Browse files

Better tool calling support, no daily token limits.
Requires OPENAI_API_KEY secret in HF Space.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +4 -4
  2. requirements.txt +1 -1
app.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  import requests
4
  import pandas as pd
5
  from io import BytesIO
6
- from langchain_groq import ChatGroq
7
  from langchain_community.tools import DuckDuckGoSearchRun
8
  from langchain_experimental.tools import PythonREPLTool
9
  from langchain_core.tools import tool
@@ -66,7 +66,7 @@ def fetch_task_file(task_id: str) -> str:
66
 
67
  class BasicAgent:
68
  def __init__(self):
69
- self.llm = ChatGroq(model="llama-3.3-70b-versatile", temperature=0)
70
  self.tools = [
71
  DuckDuckGoSearchRun(),
72
  PythonREPLTool(),
@@ -74,7 +74,7 @@ class BasicAgent:
74
  ]
75
  self.tools_map = {t.name: t for t in self.tools}
76
  self.llm_with_tools = self.llm.bind_tools(self.tools)
77
- print("BasicAgent initialized with Groq (llama-3.3-70b-versatile).")
78
 
79
  def __call__(self, question: str, task_id: str = "") -> str:
80
  full_question = f"[Task ID: {task_id}]\n\n{question}" if task_id else question
@@ -241,7 +241,7 @@ with gr.Blocks() as demo:
241
  1. Log in to your Hugging Face account using the button below.
242
  2. Click 'Run Evaluation & Submit All Answers' to fetch questions, run the agent, and submit.
243
 
244
- **Agent:** Custom ReAct loop — Groq llama-3.3-70b-versatile
245
  **Tools:** DuckDuckGo search, Python REPL, File fetcher (text + Excel)
246
 
247
  ---
 
3
  import requests
4
  import pandas as pd
5
  from io import BytesIO
6
+ from langchain_openai import ChatOpenAI
7
  from langchain_community.tools import DuckDuckGoSearchRun
8
  from langchain_experimental.tools import PythonREPLTool
9
  from langchain_core.tools import tool
 
66
 
67
  class BasicAgent:
68
  def __init__(self):
69
+ self.llm = ChatOpenAI(model="gpt-4o-mini", temperature=0)
70
  self.tools = [
71
  DuckDuckGoSearchRun(),
72
  PythonREPLTool(),
 
74
  ]
75
  self.tools_map = {t.name: t for t in self.tools}
76
  self.llm_with_tools = self.llm.bind_tools(self.tools)
77
+ print("BasicAgent initialized with OpenAI (gpt-4o-mini).")
78
 
79
  def __call__(self, question: str, task_id: str = "") -> str:
80
  full_question = f"[Task ID: {task_id}]\n\n{question}" if task_id else question
 
241
  1. Log in to your Hugging Face account using the button below.
242
  2. Click 'Run Evaluation & Submit All Answers' to fetch questions, run the agent, and submit.
243
 
244
+ **Agent:** Custom ReAct loop — OpenAI gpt-4o-mini
245
  **Tools:** DuckDuckGo search, Python REPL, File fetcher (text + Excel)
246
 
247
  ---
requirements.txt CHANGED
@@ -1,7 +1,7 @@
1
  gradio
2
  requests
3
  pandas
4
- langchain-groq
5
  langgraph
6
  langchain-community
7
  langchain-experimental
 
1
  gradio
2
  requests
3
  pandas
4
+ langchain-openai
5
  langgraph
6
  langchain-community
7
  langchain-experimental