Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ from utils import function_to_schema, show_json
|
|
25 |
openai_client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
26 |
tavily_client = TavilyClient(api_key=os.environ.get("TAVILY_API_KEY"))
|
27 |
|
28 |
-
assistant_id = "
|
29 |
|
30 |
assistant, thread = None, None
|
31 |
|
@@ -232,9 +232,9 @@ def chat(message, history):
|
|
232 |
global assistant, thread
|
233 |
|
234 |
if assistant == None:
|
235 |
-
assistant = create_assistant(openai_client) # on first run, create assistant and update assistant_id
|
236 |
# see https://platform.openai.com/playground/assistants
|
237 |
-
|
238 |
|
239 |
if thread == None or len(history) == 0:
|
240 |
thread = create_thread(openai_client)
|
@@ -339,7 +339,7 @@ gr.ChatInterface(
|
|
339 |
"It can also **execute code**. "
|
340 |
"The assistant has access to a <b>today tool</b> (get current date), to a "
|
341 |
"**yfinance download tool** (get stock data), and to a "
|
342 |
-
"**tavily search tool** (web search
|
343 |
),
|
344 |
clear_btn="Clear",
|
345 |
retry_btn=None,
|
@@ -353,5 +353,5 @@ gr.ChatInterface(
|
|
353 |
["Execute with tools: Create a plot showing stock gain QTD for NVDA and AMD, x-axis is \"Day\" and y-axis is \"Gain %\""],
|
354 |
["Execute with tools: Get key announcements from the latest OpenAI Dev Day"]
|
355 |
],
|
356 |
-
cache_examples=
|
357 |
).launch()
|
|
|
25 |
openai_client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
26 |
tavily_client = TavilyClient(api_key=os.environ.get("TAVILY_API_KEY"))
|
27 |
|
28 |
+
assistant_id = "asst_DbCpNsJ0vHSSdl6ePlkKZ8wG"
|
29 |
|
30 |
assistant, thread = None, None
|
31 |
|
|
|
232 |
global assistant, thread
|
233 |
|
234 |
if assistant == None:
|
235 |
+
#assistant = create_assistant(openai_client) # on first run, create assistant and update assistant_id
|
236 |
# see https://platform.openai.com/playground/assistants
|
237 |
+
assistant = load_assistant(openai_client) # on subsequent runs, load assistant
|
238 |
|
239 |
if thread == None or len(history) == 0:
|
240 |
thread = create_thread(openai_client)
|
|
|
339 |
"It can also **execute code**. "
|
340 |
"The assistant has access to a <b>today tool</b> (get current date), to a "
|
341 |
"**yfinance download tool** (get stock data), and to a "
|
342 |
+
"**tavily search tool** (web search)."
|
343 |
),
|
344 |
clear_btn="Clear",
|
345 |
retry_btn=None,
|
|
|
353 |
["Execute with tools: Create a plot showing stock gain QTD for NVDA and AMD, x-axis is \"Day\" and y-axis is \"Gain %\""],
|
354 |
["Execute with tools: Get key announcements from the latest OpenAI Dev Day"]
|
355 |
],
|
356 |
+
cache_examples=True,
|
357 |
).launch()
|