ankush13r commited on
Commit
72746f8
·
verified ·
1 Parent(s): 7c3b496

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -32,7 +32,7 @@ def complation(history, model, system_prompt, tools=None):
32
  for msg in history:
33
  if type(msg) == dict:
34
  msg = ChatMessage(**msg)
35
- if msg.role == "assistant" and len(msg.options) > 0 and msg.options[0]["label"] == "tool_calls":
36
  tools_calls = json.loads(msg.options[0]["value"])
37
  messages.append({"role": "assistant", "tool_calls": tools_calls})
38
  messages.append({"role": "tool", "content": msg.content})
@@ -128,7 +128,7 @@ def respond(
128
  role="assistant",
129
  content="",
130
  metadata= {"title": f"🛠️ Using tool '{name}', arguments: {json.dumps(json_arguments, ensure_ascii=False)}"},
131
- options=[{"label":"tool_calls", "value": json.dumps([{"id": "call_FthC9qRpsL5kBpwwyw6c7j4k","function": {"arguments": arguments,"name": name},"type": "function"}])}]
132
  )
133
  )
134
  yield history[-1]
@@ -139,7 +139,7 @@ def respond(
139
  role="assistant",
140
  content=result,
141
  metadata= {"title": f"🛠️ Used tool '{name}', arguments: {json.dumps(json_arguments, ensure_ascii=False)}"},
142
- options=[{"label":"tool_calls", "value": json.dumps([{"id": "call_FthC9qRpsL5kBpwwyw6c7j4k","function": {"arguments": arguments,"name": name},"type": "function"}])}]
143
  )
144
  yield history[-1]
145
 
 
32
  for msg in history:
33
  if type(msg) == dict:
34
  msg = ChatMessage(**msg)
35
+ if msg.role == "assistant" and len(msg.options) > 0 and msg.options[0]["label"] == "tool_call":
36
  tools_calls = json.loads(msg.options[0]["value"])
37
  messages.append({"role": "assistant", "tool_calls": tools_calls})
38
  messages.append({"role": "tool", "content": msg.content})
 
128
  role="assistant",
129
  content="",
130
  metadata= {"title": f"🛠️ Using tool '{name}', arguments: {json.dumps(json_arguments, ensure_ascii=False)}"},
131
+ options=[{"label":"tool_call", "value": json.dumps([{"id": "call_FthC9qRpsL5kBpwwyw6c7j4k","function": {"arguments": arguments,"name": name},"type": "function"}])}]
132
  )
133
  )
134
  yield history[-1]
 
139
  role="assistant",
140
  content=result,
141
  metadata= {"title": f"🛠️ Used tool '{name}', arguments: {json.dumps(json_arguments, ensure_ascii=False)}"},
142
+ options=[{"label":"tool_call", "value": json.dumps([{"id": "call_FthC9qRpsL5kBpwwyw6c7j4k","function": {"arguments": arguments,"name": name},"type": "function"}])}]
143
  )
144
  yield history[-1]
145