sunholo 0.103.1__py3-none-any.whl → 0.103.3__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.
@@ -19,6 +19,7 @@ import aiohttp
19
19
  from .langserve import prepare_request_data
20
20
  import traceback
21
21
  from .route import route_endpoint
22
+ import os
22
23
 
23
24
  try:
24
25
  from langfuse import Langfuse
@@ -86,7 +87,8 @@ def prep_request_payload(user_input, chat_history, vector_name, stream, **kwargs
86
87
  if 'vector_name' not in qna_data:
87
88
  qna_data['vector_name'] = vector_name
88
89
 
89
- qna_data['trace_id'] = add_langfuse_trace(qna_endpoint)
90
+ if not kwargs.get('trace_id'):
91
+ qna_data['trace_id'] = add_langfuse_trace(qna_endpoint)
90
92
 
91
93
  return qna_endpoint, qna_data
92
94
 
@@ -94,9 +96,9 @@ def add_langfuse_trace(qna_endpoint):
94
96
  if not langfuse:
95
97
  return None
96
98
 
97
- trace = langfuse.trace(name = f'auto/{qna_endpoint}')
99
+ trace = langfuse.trace(name = f'dispatch/{os.path.basename(qna_endpoint)}')
98
100
 
99
- log.info('Adding langfuse trace {trace.id}')
101
+ log.info(f'Adding langfuse trace {trace.id}')
100
102
 
101
103
  return trace.id
102
104
 
@@ -357,7 +357,7 @@ if __name__ == "__main__":
357
357
 
358
358
  try:
359
359
  if span:
360
- generation = span.generation(
360
+ gen = span.generation(
361
361
  name="vac_interpreter",
362
362
  metadata=vac_config.configs_by_kind,
363
363
  input = all_input,
@@ -371,7 +371,7 @@ if __name__ == "__main__":
371
371
  **all_input["kwargs"]
372
372
  )
373
373
  if span:
374
- generation.end(output=bot_output)
374
+ gen.end(output=bot_output)
375
375
  # {"answer": "The answer", "source_documents": [{"page_content": "The page content", "metadata": "The metadata"}]}
376
376
  bot_output = parse_output(bot_output)
377
377
  if trace:
@@ -383,7 +383,9 @@ if __name__ == "__main__":
383
383
 
384
384
  except Exception as err:
385
385
  bot_output = {'answer': f'QNA_ERROR: An error occurred while processing /vac/{vector_name}: {str(err)} traceback: {traceback.format_exc()}'}
386
-
386
+ if span:
387
+ gen.end(output=bot_output)
388
+
387
389
  if trace:
388
390
  span.end(output=jsonify(bot_output))
389
391
  trace.update(output=jsonify(bot_output))
sunholo/genai/images.py CHANGED
@@ -9,12 +9,13 @@ try:
9
9
  except ImportError:
10
10
  genai = None
11
11
 
12
- def extract_gs_images_and_genai_upload(content: str):
12
+ def extract_gs_images_and_genai_upload(content: str, limit:int=20):
13
13
  # Regular expression to find gs:// URLs
14
14
  pattern = r'gs://[^ ]+\.(?:png|jpg|jpeg|pdf)'
15
15
 
16
16
  gs_matches = re.findall(pattern, content)
17
- unique_gs_matches = set(gs_matches)
17
+ # only 20 images by default
18
+ unique_gs_matches = list(set(gs_matches))[:limit]
18
19
  output_gs_images = []
19
20
 
20
21
  for gs_uri in unique_gs_matches:
@@ -266,7 +266,9 @@ class GenAIFunctionProcessor:
266
266
  params_obj = {key: val for key, val in fn.args.items()}
267
267
 
268
268
  params = ', '.join(f'{key}={val}' for key, val in params_obj.items())
269
- log.info(f"Executing {function_name} with params {params}")
269
+ log.info(f"Executing {function_name} with params {params} (Total Characters: {len(params)})")
270
+ if len(params)>8000:
271
+ log.warning(f"Total parameters are over 8000 characters - it may not work properly: {params[:10000]}....[{len(params)}]")
270
272
 
271
273
  # Check if the function is in our dictionary of available functions
272
274
  if function_name in self.funcs:
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.103.1
3
+ Version: 0.103.3
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.103.1.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.103.3.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -2,7 +2,7 @@ sunholo/__init__.py,sha256=lLuVyilzmDbTaiAptR8SZzpbUNsgwHFsp4Ejbr5EApI,1136
2
2
  sunholo/custom_logging.py,sha256=YfIN1oP3dOEkkYkyRBU8BGS3uJFGwUDsFCl8mIVbwvE,12225
3
3
  sunholo/agents/__init__.py,sha256=X2I3pPkGeKWjc3d0QgSpkTyqD8J8JtrEWqwrumf1MMc,391
4
4
  sunholo/agents/chat_history.py,sha256=Gph_CdlP2otYnNdR1q1Umyyyvcad2F6K3LxU5yBQ9l0,5387
5
- sunholo/agents/dispatch_to_qa.py,sha256=i9HeKy-ovH54ZM51jbv1Q89GnXdBf6nvNAwsiNhJQsQ,8807
5
+ sunholo/agents/dispatch_to_qa.py,sha256=AwLS41oK6iS8xre-HuWjS4jj9dvU-evWI58EYfG65fg,8879
6
6
  sunholo/agents/langserve.py,sha256=C46ph2mnygr6bdHijYWYyfQDI9ylAF0_9Kx2PfcCJpU,4414
7
7
  sunholo/agents/pubsub.py,sha256=TscZN_6am6DfaQkC-Yl18ZIBOoLE-0nDSiil6GpQEh4,1344
8
8
  sunholo/agents/route.py,sha256=mV8tGABbSqcg3PQL02MgQOs41gKEHLMyIJJJcTuFdbE,2988
@@ -14,7 +14,7 @@ sunholo/agents/fastapi/qna_routes.py,sha256=lKHkXPmwltu9EH3RMwmD153-J6pE7kWQ4BhB
14
14
  sunholo/agents/flask/__init__.py,sha256=poJDKMr2qj8qMb99JqCvCPSiEt1tj2tLQ3hKW3f2aVw,107
15
15
  sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
16
16
  sunholo/agents/flask/qna_routes.py,sha256=uwUD1yrzOPH27m2AXpiQrPk_2VfJOQOM6dAynOWQtoQ,22532
17
- sunholo/agents/flask/vac_routes.py,sha256=6DzeqPzZV3U_djm1SNaWZbNaGelRtrZjMtrOF4T7MJs,27119
17
+ sunholo/agents/flask/vac_routes.py,sha256=sFjVXxudKP3SMO2hpcSbPZRZFBfrJr0tDQmlHTzn5E0,27181
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
@@ -86,9 +86,9 @@ sunholo/gcs/download_url.py,sha256=Ul81n1rklr8WogPsuxWWD1Nr8RHU451LzHPMJNhAKzw,6
86
86
  sunholo/gcs/extract_and_sign.py,sha256=paRrTCvCN5vkQwCB7OSkxWi-pfOgOtZ0bwdXE08c3Ps,1546
87
87
  sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
88
88
  sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
89
- sunholo/genai/images.py,sha256=eW5V2h2JdNqLkaw_u-pJSzu7edHzvrCWPLirolQXX5s,1617
89
+ sunholo/genai/images.py,sha256=EyjsDqt6XQw99pZUQamomCpMOoIah9bp3XY94WPU7Ms,1678
90
90
  sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
91
- sunholo/genai/process_funcs_cls.py,sha256=wiOIMeGLFEParAkdwHbfySzsPuUgi0rimEYOMbWEZKU,29317
91
+ sunholo/genai/process_funcs_cls.py,sha256=6NZiYd9VWEzRN_-25PvOpBnQcfuJfWMuqi2hgAYm9ls,29530
92
92
  sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
93
93
  sunholo/invoke/__init__.py,sha256=o1RhwBGOtVK0MIdD55fAIMCkJsxTksi8GD5uoqVKI-8,184
94
94
  sunholo/invoke/async_class.py,sha256=G8vD2H94fpBc37mSJSQODEKJ67P2mPQEHabtDaLOvxE,8033
@@ -147,9 +147,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
147
147
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
148
148
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
149
149
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
150
- sunholo-0.103.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
- sunholo-0.103.1.dist-info/METADATA,sha256=YGSRAl2J8mSfpd3w0uPG79av4wmOEqIyntnmYlERRAE,8312
152
- sunholo-0.103.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
- sunholo-0.103.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
- sunholo-0.103.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
- sunholo-0.103.1.dist-info/RECORD,,
150
+ sunholo-0.103.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
151
+ sunholo-0.103.3.dist-info/METADATA,sha256=c9RZHjm11DZGjxIeguvv05L1UzrVTS3SqgHAPsKy_bE,8312
152
+ sunholo-0.103.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
153
+ sunholo-0.103.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
154
+ sunholo-0.103.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
155
+ sunholo-0.103.3.dist-info/RECORD,,