sunholo 0.64.4__py3-none-any.whl → 0.64.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,19 +168,17 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
168
168
  @app.route('/openai/v1/chat/completions/<vector_name>', methods=['POST'])
169
169
  def openai_compatible_endpoint(vector_name=None):
170
170
  data = request.get_json()
171
- log.info(f'openai_compatible_endpoint got data: {data}')
171
+ log.info(f'openai_compatible_endpoint got data: {data} for vector: {vector_name}')
172
172
 
173
173
  vector_name = vector_name or data.pop('model', None)
174
174
  messages = data.pop('messages', None)
175
175
  chat_history = data.pop('chat_history', None)
176
176
  stream = data.pop('stream', False)
177
177
 
178
- log.info(f'openai_compatible_endpoint got data: {data} for vector: {vector_name}')
179
-
180
178
  if not messages:
181
179
  return jsonify({"error": "No messages provided"}), 400
182
180
 
183
- user_message = next((msg['content'] for msg in messages if msg['role'] == 'user'), None)
181
+ user_message = next((msg['content'] for msg in reversed(messages) if msg['role'] == 'user'), None)
184
182
  if not user_message:
185
183
  return jsonify({"error": "No user message provided"}), 400
186
184
 
@@ -192,7 +190,6 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
192
190
 
193
191
  observed_stream_interpreter = observe()(stream_interpreter)
194
192
 
195
-
196
193
  response_id = str(uuid.uuid4())
197
194
 
198
195
  def generate_response_content():
@@ -238,10 +235,12 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
238
235
  yield json.dumps(final_chunk) + "\n"
239
236
 
240
237
  if stream:
238
+ log.info("Streaming openai chunks")
241
239
  return Response(generate_response_content(), content_type='text/plain; charset=utf-8')
242
240
 
243
241
  try:
244
- bot_output = observed_stream_interpreter(
242
+ observed_vac_interpreter = observe()(vac_interpreter)
243
+ bot_output = observed_vac_interpreter(
245
244
  question=user_message,
246
245
  vector_name=vector_name,
247
246
  chat_history=all_input["chat_history"],
@@ -249,6 +248,8 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
249
248
  )
250
249
  bot_output = parse_output(bot_output)
251
250
 
251
+ log.info(f"Bot output: {bot_output}")
252
+
252
253
  openai_response = {
253
254
  "id": response_id,
254
255
  "object": "chat.completion",
@@ -275,6 +276,7 @@ def register_qna_routes(app, stream_interpreter, vac_interpreter):
275
276
  return jsonify(openai_response)
276
277
 
277
278
  except Exception as err:
279
+ log.error(f"OpenAI response error: {err}")
278
280
  return jsonify({'error': f'QNA_ERROR: An error occurred: {str(err)} traceback: {traceback.format_exc()}'}), 500
279
281
 
280
282
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.64.4
3
+ Version: 0.64.5
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Home-page: https://github.com/sunholo-data/sunholo-py
6
- Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.64.4.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.64.5.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -12,7 +12,7 @@ sunholo/agents/fastapi/base.py,sha256=clk76cHbUAvU0OYJrRfCWX_5f0ACbhDsIzYBhI3wyo
12
12
  sunholo/agents/fastapi/qna_routes.py,sha256=DgK4Btu5XriOC1JaRQ4G_nWEjJfnQ0J5pyLanF6eF1g,3857
13
13
  sunholo/agents/flask/__init__.py,sha256=uqfHNw2Ru3EJ4dJEcbp86h_lkquBQPMxZbjhV_xe3rs,72
14
14
  sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
15
- sunholo/agents/flask/qna_routes.py,sha256=yskVD7bP_MAvWipZcdsdNyvh1WVlYr9VqbokfV09pYM,14513
15
+ sunholo/agents/flask/qna_routes.py,sha256=4tUpwTKGqvHorRuVjomvkfLit3ERjjzYaVAtqn-6EJo,14673
16
16
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
17
17
  sunholo/archive/archive.py,sha256=C-UhG5x-XtZ8VheQp92IYJqgD0V3NFQjniqlit94t18,1197
18
18
  sunholo/auth/__init__.py,sha256=4owDjSaWYkbTlPK47UHTOC0gCWbZsqn4ZIEw5NWZTlg,28
@@ -102,9 +102,9 @@ sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,13
102
102
  sunholo/vertex/init.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
103
103
  sunholo/vertex/memory_tools.py,sha256=8F1iTWnqEK9mX4W5RzCVKIjydIcNp6OFxjn_dtQ3GXo,5379
104
104
  sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
105
- sunholo-0.64.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
106
- sunholo-0.64.4.dist-info/METADATA,sha256=-vzVQ820NsKlAjLeentAjVDxSWvjKIH5y4Up5Wi1vtU,5971
107
- sunholo-0.64.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
108
- sunholo-0.64.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
109
- sunholo-0.64.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
110
- sunholo-0.64.4.dist-info/RECORD,,
105
+ sunholo-0.64.5.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
106
+ sunholo-0.64.5.dist-info/METADATA,sha256=e_JboqgTpZEFQJx2UpjF5pCrqlOfdw0p46hAVhCX190,5971
107
+ sunholo-0.64.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
108
+ sunholo-0.64.5.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
109
+ sunholo-0.64.5.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
110
+ sunholo-0.64.5.dist-info/RECORD,,