a1n2a3s4w commited on
Commit
461fbe3
·
verified ·
1 Parent(s): 270648a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -6,9 +6,10 @@ import operator
6
  import requests
7
  import pandas as pd
8
  import gradio as gr
 
9
  try:
10
  import spaces
11
-
12
  @spaces.GPU
13
  def _zerogpu_warmup():
14
  # Dummy function so this ZeroGPU Space passes its startup check.
@@ -18,6 +19,7 @@ try:
18
  except ImportError:
19
  # Not running on a ZeroGPU Space / package not installed locally — fine to skip.
20
  pass
 
21
  from typing import TypedDict, Annotated
22
  from langgraph.graph import StateGraph, END
23
  from langgraph.prebuilt import ToolNode
@@ -115,7 +117,10 @@ TOOLS = [calculator, search_tool, wiki_tool, python_tool, read_downloaded_file]
115
  # MODEL
116
  # =========================================================
117
  # Requires GROQ_API_KEY set as a Space secret (free — get one at console.groq.com).
118
- llm = ChatGroq(model="llama-3.3-70b-versatile", temperature=0)
 
 
 
119
  llm_with_tools = llm.bind_tools(TOOLS)
120
 
121
  SYSTEM_PROMPT = """You are a general AI assistant answering benchmark questions that will be
@@ -159,9 +164,11 @@ def verify_answer(state: AgentState):
159
  draft = state["messages"][-1].content
160
  verify_prompt = [
161
  SystemMessage(content=(
162
- "Extract ONLY the final answer from the text below, with no extra words, "
163
- "no explanation, no punctuation unless part of the answer itself, and no "
164
- "'FINAL ANSWER:' prefix. Return just the answer."
 
 
165
  )),
166
  HumanMessage(content=str(draft)),
167
  ]
 
6
  import requests
7
  import pandas as pd
8
  import gradio as gr
9
+
10
  try:
11
  import spaces
12
+
13
  @spaces.GPU
14
  def _zerogpu_warmup():
15
  # Dummy function so this ZeroGPU Space passes its startup check.
 
19
  except ImportError:
20
  # Not running on a ZeroGPU Space / package not installed locally — fine to skip.
21
  pass
22
+
23
  from typing import TypedDict, Annotated
24
  from langgraph.graph import StateGraph, END
25
  from langgraph.prebuilt import ToolNode
 
117
  # MODEL
118
  # =========================================================
119
  # Requires GROQ_API_KEY set as a Space secret (free — get one at console.groq.com).
120
+ # NOTE: llama-3.3-70b-versatile was deprecated by Groq and produces unreliable
121
+ # tool calls. openai/gpt-oss-120b is Groq's recommended replacement and is
122
+ # built for reliable structured tool calling.
123
+ llm = ChatGroq(model="openai/gpt-oss-120b", temperature=0)
124
  llm_with_tools = llm.bind_tools(TOOLS)
125
 
126
  SYSTEM_PROMPT = """You are a general AI assistant answering benchmark questions that will be
 
164
  draft = state["messages"][-1].content
165
  verify_prompt = [
166
  SystemMessage(content=(
167
+ "Extract ONLY the final answer from the text below. Strip ALL extra words, "
168
+ "units, labels, explanations, and surrounding context — return the bare answer only. "
169
+ "If it's a number, return digits only (e.g. '277' not '277 species', '3' not "
170
+ "'three albums'). If it's a name, return just the name. No punctuation unless it is "
171
+ "part of the answer itself. No 'FINAL ANSWER:' prefix. No quotes around the answer."
172
  )),
173
  HumanMessage(content=str(draft)),
174
  ]