Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,7 @@ os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN
|
|
102 |
################################################
|
103 |
#zentral einmal erzeugen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
104 |
client = OpenAI()
|
105 |
-
|
106 |
thread = client.beta.threads.create()
|
107 |
|
108 |
|
@@ -212,10 +212,10 @@ def create_assistant(prompt, file):
|
|
212 |
#neues File dem Assistant hinzufügen
|
213 |
file_neu = client.files.create(file=open(file,"rb",),purpose="assistants",)
|
214 |
# Update Assistant
|
215 |
-
|
216 |
-
thread, run = create_thread_and_run(prompt, client,
|
217 |
run = wait_on_run(run, thread, client)
|
218 |
-
response = get_response(thread, client,
|
219 |
result = response.data[1].content[0].text.value
|
220 |
return result
|
221 |
|
|
|
102 |
################################################
|
103 |
#zentral einmal erzeugen!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
104 |
client = OpenAI()
|
105 |
+
general_assistant = client.beta.assistants.create(name="File Analysator",instructions=template, model="gpt-4-1106-preview",)
|
106 |
thread = client.beta.threads.create()
|
107 |
|
108 |
|
|
|
212 |
#neues File dem Assistant hinzufügen
|
213 |
file_neu = client.files.create(file=open(file,"rb",),purpose="assistants",)
|
214 |
# Update Assistant
|
215 |
+
updated_assistant = client.beta.assistants.update(general_assistant.id,tools=[{"type": "code_interpreter"}, {"type": "retrieval"}],file_ids=[file_neu.id],)
|
216 |
+
thread, run = create_thread_and_run(prompt, client, updated_assistant.id)
|
217 |
run = wait_on_run(run, thread, client)
|
218 |
+
response = get_response(thread, client, updated_assistant.id)
|
219 |
result = response.data[1].content[0].text.value
|
220 |
return result
|
221 |
|