bstraehle commited on
Commit
1d42f25
·
verified ·
1 Parent(s): 2a3fc7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -31,6 +31,10 @@ def today_tool(text: str) -> str:
31
  Any date mathematics should occur outside this function."""
32
  return str(date.today())
33
 
 
 
 
 
34
  def create_assistant(client):
35
  assistant = client.beta.assistants.create(
36
  name="Python Code Generator",
@@ -119,9 +123,9 @@ def execute_tool_call(tool_call):
119
  print(f"name={name}")
120
  print(f"args={args}")
121
 
122
- #global tools
123
 
124
- #return tools[name](**args)
125
  ###
126
 
127
  def get_run_step_details(run_steps):
@@ -138,6 +142,7 @@ def get_run_step_details(run_steps):
138
  show_json("tool_call", tool_call)
139
  if hasattr(tool_call, "function"):
140
  result = execute_tool_call(tool_call)
 
141
  ###
142
 
143
  return run_step_details
 
31
  Any date mathematics should occur outside this function."""
32
  return str(date.today())
33
 
34
+ tools = {
35
+ "today_tool": today_tool,
36
+ }
37
+
38
  def create_assistant(client):
39
  assistant = client.beta.assistants.create(
40
  name="Python Code Generator",
 
123
  print(f"name={name}")
124
  print(f"args={args}")
125
 
126
+ global tools
127
 
128
+ return tools[name](**args)
129
  ###
130
 
131
  def get_run_step_details(run_steps):
 
142
  show_json("tool_call", tool_call)
143
  if hasattr(tool_call, "function"):
144
  result = execute_tool_call(tool_call)
145
+ print(result)
146
  ###
147
 
148
  return run_step_details