bstraehle commited on
Commit
6f626b7
·
verified ·
1 Parent(s): 80336e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -155,6 +155,14 @@ def wait_on_run(client, thread, run):
155
  #show_json("run", run)
156
  return run
157
 
 
 
 
 
 
 
 
 
158
  def list_run_steps(client, thread, run):
159
  run_steps = client.beta.threads.runs.steps.list(
160
  thread_id=thread.id,
@@ -165,7 +173,7 @@ def list_run_steps(client, thread, run):
165
  for step in run_steps.data:
166
  step_details = step.step_details
167
  show_json("step_details", step_details)
168
- # TODO: Call function
169
 
170
  return run_steps
171
 
@@ -186,14 +194,6 @@ def extract_content_values(data):
186
 
187
  #
188
 
189
- def execute_tool_call(tool_call, tools, agent_name):
190
- name = tool_call.function.name
191
- args = json.loads(tool_call.function.arguments)
192
- print(f"{agent_name}, {name}, {args}")
193
- return tools[name](**args)
194
-
195
- #
196
-
197
  current_agent, current_thread = None, None
198
 
199
  def set_current_agent(agent):
@@ -234,7 +234,7 @@ def chat(message, history, openai_api_key):
234
  assistant = get_current_agent()
235
  show_json("Current Agent", assistant)
236
  thread = get_current_thread()
237
- show_json("Current Thread", thread)
238
 
239
  create_message(client, thread, message)
240
 
@@ -254,12 +254,12 @@ gr.ChatInterface(
254
  textbox=gr.Textbox(placeholder="Question", container=False, scale=7),
255
  title="Multi-Agent Orchestration",
256
  description="Demo using hand-off pattern: triage agent, sales agent, and issues & repairs agent",
 
257
  retry_btn=None,
258
  undo_btn=None,
259
- clear_btn="Clear",
260
  #examples=[["Generate the first 10 Fibbonaci numbers with code.", "sk-<BringYourOwn>"]],
261
  #cache_examples=False,
262
- additional_inputs=[
263
- gr.Textbox("sk-", label="OpenAI API Key", type = "password"),
264
- ],
265
  ).launch()
 
155
  #show_json("run", run)
156
  return run
157
 
158
+ ###
159
+ def execute_tool_call(tool_call, tools, agent_name):
160
+ name = tool_call.function.name
161
+ args = json.loads(tool_call.function.arguments)
162
+ print(f"{agent_name}, {name}, {args}")
163
+ return tools[name](**args)
164
+ ###
165
+
166
  def list_run_steps(client, thread, run):
167
  run_steps = client.beta.threads.runs.steps.list(
168
  thread_id=thread.id,
 
173
  for step in run_steps.data:
174
  step_details = step.step_details
175
  show_json("step_details", step_details)
176
+ # TODO: execute_tool_call
177
 
178
  return run_steps
179
 
 
194
 
195
  #
196
 
 
 
 
 
 
 
 
 
197
  current_agent, current_thread = None, None
198
 
199
  def set_current_agent(agent):
 
234
  assistant = get_current_agent()
235
  show_json("Current Agent", assistant)
236
  thread = get_current_thread()
237
+ #show_json("Current Thread", thread)
238
 
239
  create_message(client, thread, message)
240
 
 
254
  textbox=gr.Textbox(placeholder="Question", container=False, scale=7),
255
  title="Multi-Agent Orchestration",
256
  description="Demo using hand-off pattern: triage agent, sales agent, and issues & repairs agent",
257
+ clear_btn="Clear",
258
  retry_btn=None,
259
  undo_btn=None,
 
260
  #examples=[["Generate the first 10 Fibbonaci numbers with code.", "sk-<BringYourOwn>"]],
261
  #cache_examples=False,
262
+ #additional_inputs=[
263
+ # gr.Textbox("sk-", label="OpenAI API Key", type = "password"),
264
+ #],
265
  ).launch()