sunholo 0.140.8__py3-none-any.whl → 0.140.9__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.
@@ -780,14 +780,6 @@ if __name__ == "__main__":
780
780
  except Exception as e:
781
781
  raise ValueError(f"Unable to find vac_config for {vector_name} - {str(e)}")
782
782
 
783
- # Initialize trace variables
784
- trace = None
785
- span = None
786
- if self.add_langfuse_eval:
787
- trace_id = data.get('trace_id')
788
- # Create trace in background - don't block
789
- trace_future = _thread_pool.submit(self._create_langfuse_trace_background, request, vector_name, trace_id)
790
-
791
783
  # Extract data (keep original logic)
792
784
  user_input = data.pop('user_input').strip()
793
785
  stream_wait_time = data.pop('stream_wait_time', 7)
@@ -811,7 +803,7 @@ if __name__ == "__main__":
811
803
  finally:
812
804
  data.pop("_upload_future", None)
813
805
 
814
- # Build final input
806
+ # BUILD all_input BEFORE trace creation (this was moved inside try/catch by mistake)
815
807
  all_input = {
816
808
  'user_input': user_input,
817
809
  'vector_name': vector_name_param,
@@ -822,8 +814,15 @@ if __name__ == "__main__":
822
814
  'kwargs': data
823
815
  }
824
816
 
825
- # Try to get trace result if available (don't block long)
817
+ # Initialize trace variables
818
+ trace = None
819
+ span = None
826
820
  if self.add_langfuse_eval:
821
+ trace_id = data.get('trace_id')
822
+ # Create trace in background - don't block
823
+ trace_future = _thread_pool.submit(self._create_langfuse_trace_background, request, vector_name, trace_id)
824
+
825
+ # Try to get trace result if available (don't block long)
827
826
  try:
828
827
  trace = trace_future.result(timeout=0.1) # Very short timeout
829
828
  if trace:
@@ -853,67 +852,6 @@ if __name__ == "__main__":
853
852
  "vac_config": vac_config
854
853
  }
855
854
 
856
- async def prep_vac_async(self, request, vector_name):
857
- """Async version of prep_vac."""
858
- # Parse request data
859
- if request.content_type.startswith('application/json'):
860
- data = request.get_json()
861
- elif request.content_type.startswith('multipart/form-data'):
862
- data = request.form.to_dict()
863
- if 'file' in request.files:
864
- file = request.files['file']
865
- if file.filename != '':
866
- log.info(f"Found file: {file.filename} to upload to GCS")
867
- try:
868
- # Make file upload async if possible
869
- image_uri, mime_type = await self.handle_file_upload_async(file, vector_name)
870
- data["image_uri"] = image_uri
871
- data["mime"] = mime_type
872
- except Exception as e:
873
- log.error(traceback.format_exc())
874
- return jsonify({'error': str(e), 'traceback': traceback.format_exc()}), 500
875
- else:
876
- log.error("No file selected")
877
- return jsonify({"error": "No file selected"}), 400
878
- else:
879
- return jsonify({"error": "Unsupported content type"}), 400
880
-
881
- log.info(f"vac/{vector_name} got data: {data}")
882
-
883
- # Run these operations concurrently
884
- tasks = []
885
-
886
- # Extract other data while configs load
887
- user_input = data.pop('user_input').strip()
888
- stream_wait_time = data.pop('stream_wait_time', 7)
889
- stream_timeout = data.pop('stream_timeout', 120)
890
- chat_history = data.pop('chat_history', None)
891
- vector_name_param = data.pop('vector_name', vector_name)
892
- data.pop('trace_id', None) # to ensure not in kwargs
893
-
894
- # Task 3: Process chat history
895
- chat_history_task = asyncio.create_task(extract_chat_history_async_cached(chat_history))
896
- tasks.append(chat_history_task)
897
-
898
- # Await all tasks concurrently
899
- results = await asyncio.gather(*tasks, return_exceptions=True)
900
-
901
- paired_messages = results[0] if not isinstance(results[0], Exception) else []
902
-
903
- # Only create span after we have trace
904
- all_input = {
905
- 'user_input': user_input,
906
- 'vector_name': vector_name_param,
907
- 'chat_history': paired_messages,
908
- 'stream_wait_time': stream_wait_time,
909
- 'stream_timeout': stream_timeout,
910
- 'kwargs': data
911
- }
912
-
913
- return {
914
- "all_input": all_input
915
- }
916
-
917
855
  def handle_file_upload(self, file, vector_name):
918
856
  try:
919
857
  file.save(file.filename)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.140.8
3
+ Version: 0.140.9
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -14,7 +14,7 @@ sunholo/agents/fastapi/base.py,sha256=W-cyF8ZDUH40rc-c-Apw3-_8IIi2e4Y9qRtnoVnsc1
14
14
  sunholo/agents/fastapi/qna_routes.py,sha256=lKHkXPmwltu9EH3RMwmD153-J6pE7kWQ4BhBlV3to-s,3864
15
15
  sunholo/agents/flask/__init__.py,sha256=dEoByI3gDNUOjpX1uVKP7uPjhfFHJubbiaAv3xLopnk,63
16
16
  sunholo/agents/flask/base.py,sha256=vnpxFEOnCmt9humqj-jYPLfJcdwzsop9NorgkJ-tSaU,1756
17
- sunholo/agents/flask/vac_routes.py,sha256=YOW64HaRYa0MfMnzwbx2s9IrU6lz-CeqpcfmIo_L3ho,37664
17
+ sunholo/agents/flask/vac_routes.py,sha256=eafqIudPKAtsOC73bnIXCpreL8AhMz_LQ212HuXqGhc,35101
18
18
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
19
19
  sunholo/archive/archive.py,sha256=PxVfDtO2_2ZEEbnhXSCbXLdeoHoQVImo4y3Jr2XkCFY,1204
20
20
  sunholo/auth/__init__.py,sha256=TeP-OY0XGxYV_8AQcVGoh35bvyWhNUcMRfhuD5l44Sk,91
@@ -168,9 +168,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
168
168
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
169
169
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
170
170
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
171
- sunholo-0.140.8.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
- sunholo-0.140.8.dist-info/METADATA,sha256=30zPLVCgeU87lsGIdFxyaAOFvYDuC-EOayXWNgophxI,10067
173
- sunholo-0.140.8.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
174
- sunholo-0.140.8.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
- sunholo-0.140.8.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
- sunholo-0.140.8.dist-info/RECORD,,
171
+ sunholo-0.140.9.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.140.9.dist-info/METADATA,sha256=PrTJywV40Kp5vGdiwPaLEzu2pujsY0DuoJSKuhis0MA,10067
173
+ sunholo-0.140.9.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
174
+ sunholo-0.140.9.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.140.9.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.140.9.dist-info/RECORD,,