baconnier commited on
Commit
d954da7
·
verified ·
1 Parent(s): 95b6a1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -63,6 +63,11 @@ class ArtExplorer:
63
  )}
64
  ]
65
 
 
 
 
 
 
66
  response = self.client.chat.completions.create(
67
  model="mixtral-8x7b-32768",
68
  messages=messages,
@@ -70,7 +75,16 @@ class ArtExplorer:
70
  max_tokens=2048
71
  )
72
 
 
 
 
 
73
  result = json.loads(response.choices[0].message.content)
 
 
 
 
 
74
  return result
75
  except json.JSONDecodeError as json_err:
76
  print(f"JSON decode error: {str(json_err)}")
@@ -79,7 +93,6 @@ class ArtExplorer:
79
  except Exception as e:
80
  print(f"Error in LLM response: {str(e)}")
81
  return self.get_default_response()
82
-
83
 
84
  def get_default_response(self):
85
  return CONTEXTUAL_ZOOM_default_response
 
63
  )}
64
  ]
65
 
66
+ # Print the messages being sent to the LLM for debugging
67
+ print("Messages sent to LLM:")
68
+ for message in messages:
69
+ print(f"{message['role']}: {message['content']}")
70
+
71
  response = self.client.chat.completions.create(
72
  model="mixtral-8x7b-32768",
73
  messages=messages,
 
75
  max_tokens=2048
76
  )
77
 
78
+ # Print the raw response from the LLM for debugging
79
+ print("Raw response from LLM:")
80
+ print(response)
81
+
82
  result = json.loads(response.choices[0].message.content)
83
+
84
+ # Print the parsed result for debugging
85
+ print("Parsed result from LLM:")
86
+ print(result)
87
+
88
  return result
89
  except json.JSONDecodeError as json_err:
90
  print(f"JSON decode error: {str(json_err)}")
 
93
  except Exception as e:
94
  print(f"Error in LLM response: {str(e)}")
95
  return self.get_default_response()
 
96
 
97
  def get_default_response(self):
98
  return CONTEXTUAL_ZOOM_default_response