ankush13r commited on
Commit
10e2584
·
verified ·
1 Parent(s): 107bf78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -29,15 +29,18 @@ def clean_json_string(json_str):
29
 
30
  def complation(history, model, system_prompt, tools=None):
31
  messages = [{"role": "system", "content": system_prompt}]
 
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})
39
  else:
40
  messages.append({"role": msg.role, "content": msg.content})
 
41
  if not tools:
42
  return client.chat.completions.create(
43
  model=model,
 
29
 
30
  def complation(history, model, system_prompt, tools=None):
31
  messages = [{"role": "system", "content": system_prompt}]
32
+ print("================")
33
  for msg in history:
34
  if type(msg) == dict:
35
  msg = ChatMessage(**msg)
36
+ print(msg.role, end=", ")
37
  if msg.role == "assistant" and len(msg.options) > 0 and msg.options[0]["label"] == "tool_calls":
38
  tools_calls = json.loads(msg.options[0]["value"])
39
  messages.append({"role": "assistant", "tool_calls": tools_calls})
40
  messages.append({"role": "tool", "content": msg.content})
41
  else:
42
  messages.append({"role": msg.role, "content": msg.content})
43
+ print("================")
44
  if not tools:
45
  return client.chat.completions.create(
46
  model=model,