ricklamers commited on
Commit
a939268
1 Parent(s): 6aa31f2

fix: on exception print error

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -51,14 +51,19 @@ def call_function(tool_call, available_functions):
51
  }
52
 
53
  def get_model_response(messages):
54
- return client.chat.completions.create(
55
- model=MODEL,
56
- messages=messages,
57
- tools=tools,
58
- temperature=0.5,
59
- top_p=0.65,
60
- max_tokens=4096,
61
- )
 
 
 
 
 
62
 
63
  def respond(message, history, system_message):
64
  if not hasattr(respond, 'conversation'):
 
51
  }
52
 
53
  def get_model_response(messages):
54
+ try:
55
+ return client.chat.completions.create(
56
+ model=MODEL,
57
+ messages=messages,
58
+ tools=tools,
59
+ temperature=0.5,
60
+ top_p=0.65,
61
+ max_tokens=4096,
62
+ )
63
+ except Exception as e:
64
+ print(f"An error occurred while getting model response: {str(e)}")
65
+ print(messages)
66
+ return None
67
 
68
  def respond(message, history, system_message):
69
  if not hasattr(respond, 'conversation'):