bstraehle commited on
Commit
2fe1d3f
·
verified ·
1 Parent(s): 82995c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,7 +3,7 @@ import json, openai, os, time
3
  from openai import OpenAI
4
 
5
  client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
6
- assistant = client.beta.assistants.create(
7
  name="Math Tutor",
8
  instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
9
  model="gpt-4-1106-preview",
@@ -16,11 +16,11 @@ def show_json(str, obj):
16
  print(obj)
17
 
18
  def init_assistant():
19
- global client, assistant, thread
20
 
21
  #client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
22
 
23
- #assistant = client.beta.assistants.create(
24
  # name="Math Tutor",
25
  # instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
26
  # model="gpt-4-1106-preview",
@@ -47,7 +47,7 @@ def extract_content_value(data):
47
 
48
  def chat(message, history):
49
  global client
50
- global assistant
51
  global thread
52
 
53
  history_openai_format = []
@@ -78,7 +78,7 @@ def chat(message, history):
78
 
79
  run = client.beta.threads.runs.create(
80
  thread_id=thread.id,
81
- assistant_id=assistant.id,
82
  )
83
 
84
  #show_json("run", run)
 
3
  from openai import OpenAI
4
 
5
  client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
6
+ assistant2 = client.beta.assistants.create(
7
  name="Math Tutor",
8
  instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
9
  model="gpt-4-1106-preview",
 
16
  print(obj)
17
 
18
  def init_assistant():
19
+ global client, assistant2, thread
20
 
21
  #client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
22
 
23
+ #assistant2 = client.beta.assistants.create(
24
  # name="Math Tutor",
25
  # instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
26
  # model="gpt-4-1106-preview",
 
47
 
48
  def chat(message, history):
49
  global client
50
+ global assistant2
51
  global thread
52
 
53
  history_openai_format = []
 
78
 
79
  run = client.beta.threads.runs.create(
80
  thread_id=thread.id,
81
+ assistant_id=assistant2.id,
82
  )
83
 
84
  #show_json("run", run)