bstraehle commited on
Commit
10d6c27
1 Parent(s): 6e1d034

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
app.py CHANGED
@@ -24,6 +24,8 @@ from utils import function_to_schema, show_json
24
 
25
  client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
26
 
 
 
27
  assistant, thread = None, None
28
 
29
  def today_tool() -> str:
@@ -48,10 +50,10 @@ def create_assistant(client):
48
  assistant = client.beta.assistants.create(
49
  name="Python Code Generator",
50
  instructions=(
51
- "You are a Python programming language expert that "
52
- "generates Pylint-compliant code and explains it. "
53
- "Execute code when explicitly asked to."
54
- ),
55
  model="gpt-4o",
56
  tools=[
57
  {"type": "code_interpreter"},
@@ -64,10 +66,8 @@ def create_assistant(client):
64
 
65
  return assistant
66
 
67
- def load_assistant(client):
68
- ASSISTANT_ID = "asst_ypbcWnilAd60bc2DQ8haDL5P"
69
-
70
- assistant = client.beta.assistants.retrieve(ASSISTANT_ID)
71
 
72
  show_json("assistant", assistant)
73
 
@@ -302,7 +302,12 @@ gr.ChatInterface(
302
  chatbot=gr.Chatbot(height=350),
303
  textbox=gr.Textbox(placeholder="Ask anything", container=False, scale=7),
304
  title="Python Code Generator",
305
- description="The assistant can generate, explain, fix, optimize, document, and test code. It can also execute code.",
 
 
 
 
 
306
  clear_btn="Clear",
307
  retry_btn=None,
308
  undo_btn=None,
 
24
 
25
  client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
26
 
27
+ assistant_id = "asst_ypbcWnilAd60bc2DQ8haDL5P"
28
+
29
  assistant, thread = None, None
30
 
31
  def today_tool() -> str:
 
50
  assistant = client.beta.assistants.create(
51
  name="Python Code Generator",
52
  instructions=(
53
+ "You are a Python programming language expert that "
54
+ "generates Pylint-compliant code and explains it. "
55
+ "Execute code when explicitly asked to."
56
+ ),
57
  model="gpt-4o",
58
  tools=[
59
  {"type": "code_interpreter"},
 
66
 
67
  return assistant
68
 
69
+ def load_assistant(client):
70
+ assistant = client.beta.assistants.retrieve(assistant_id)
 
 
71
 
72
  show_json("assistant", assistant)
73
 
 
302
  chatbot=gr.Chatbot(height=350),
303
  textbox=gr.Textbox(placeholder="Ask anything", container=False, scale=7),
304
  title="Python Code Generator",
305
+ description=(
306
+ "The assistant can **generate, explain, fix, optimize, document, and test code**. "
307
+ "It can also <b>execute code</b>. "
308
+ "It has access to <b>today tool</b> (to get current date) and "
309
+ "<b>yfinance download tool</b> (to get stock data)."
310
+ ),
311
  clear_btn="Clear",
312
  retry_btn=None,
313
  undo_btn=None,