sunholo 0.99.2__py3-none-any.whl → 0.99.4__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.
@@ -449,31 +449,38 @@ class GenAIFunctionProcessor:
449
449
  token = token_queue.popleft()
450
450
  callback.on_llm_new_token(token=token)
451
451
 
452
- try:
453
- # Convert MapComposite to a standard Python dictionary
454
- if isinstance(fn_result, proto.marshal.collections.maps.MapComposite):
455
- fn_result = dict(fn_result)
456
- fn_result_json = json.loads(fn_result)
457
- if not isinstance(fn_result_json, dict):
458
- log.warning(f"{fn_result} was loaded but is not a dictionary")
459
- fn_result_json = None
460
- except json.JSONDecodeError:
461
- log.warning(f"{fn_result} was not JSON decoded")
462
- fn_result_json = None
463
- except Exception as err:
464
- log.warning(f"{fn_result} was not json decoded due to unknown exception: {str(err)}")
465
- fn_result_json = None
466
-
452
+ log.info(f"{fn_log} created a result={type(fn_result)=}")
453
+
454
+ fn_result_json = None
455
+ # Convert MapComposite to a standard Python dictionary
456
+ if isinstance(fn_result, proto.marshal.collections.maps.MapComposite):
457
+ fn_result_json = dict(fn_result)
458
+ elif isinstance(fn_result, dict):
459
+ fn_result_json = fn_result
460
+ elif isinstance(fn_result, str):
461
+ try:
462
+ if isinstance(fn_result_json, str):
463
+ fn_result_json = json.loads(fn_result_json)
464
+ except json.JSONDecodeError:
465
+ log.warning(f"{fn_result} was not JSON decoded")
466
+ except Exception as err:
467
+ log.warning(f"{fn_result} was not json decoded due to unknown exception: {str(err)} {traceback.format_exc()}")
468
+ else:
469
+ log.warning(f"Unrecognised type for {fn_log}: {type(fn_result)}")
470
+
471
+ # should be a string or a dict by now
472
+ log.info(f"Processed {fn_log} to {fn_result_json=} type: {type(fn_result_json)}")
473
+
467
474
  if fn == "decide_to_go_on":
468
- log.info(f"{fn_result_json} {fn_result=} {type(fn_result)}")
469
- go_on_args = fn_result_json
470
- if go_on_args:
471
- token = f"\n{'STOPPING' if not go_on_args.get('go_on') else 'CONTINUE'}: {go_on_args.get('chat_summary')}\n"
475
+ log.info(f"{fn_result_json=} {type(fn_result)}")
476
+ if fn_result_json:
477
+ token = f"\n{'STOPPING' if not fn_result_json.get('go_on') else 'CONTINUE'}: {fn_result_json.get('chat_summary')}\n"
472
478
  else:
473
479
  log.warning(f"{fn_result_json} did not work for decide_to_go_on")
474
- token = f"Error calling decide_to_go_on with {fn_result_json}\n"
480
+ token = f"Error calling decide_to_go_on with {fn_result=}\n"
475
481
  else:
476
482
  token = f"--- {fn_log} result --- \n"
483
+ # if json dict we look for keys to extract
477
484
  if fn_result_json:
478
485
  if fn_result_json.get('stdout'):
479
486
  text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
@@ -484,6 +491,7 @@ class GenAIFunctionProcessor:
484
491
  if not fn_result_json.get('stdout') and fn_result_json.get('stderr'):
485
492
  token += f"{fn_result}\n"
486
493
  else:
494
+ # probably a string, just return it
487
495
  token += f"{fn_result}\n--- end ---\n"
488
496
 
489
497
  this_text += token
@@ -546,4 +554,5 @@ class GenAIFunctionProcessor:
546
554
  Returns:
547
555
  boolean: True to carry on, False to continue
548
556
  """
549
- return json.dumps({"go_on": go_on, "chat_summary": chat_summary})
557
+ return {"go_on": go_on, "chat_summary": chat_summary}
558
+
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.99.2
3
+ Version: 0.99.4
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.99.2.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.99.4.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -86,7 +86,7 @@ sunholo/gcs/download_url.py,sha256=q1NiJSvEhdNrmU5ZJ-sBCMC_J5CxzrajY8LRgdPOV_M,6
86
86
  sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
87
87
  sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
88
88
  sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
89
- sunholo/genai/process_funcs_cls.py,sha256=sFM5WxzZW02H9FC80ZZ_fcTv2OBRwuueeR7JoWPuM78,24362
89
+ sunholo/genai/process_funcs_cls.py,sha256=S_xNGm-GMIeymfNd74G9KXJpEBprrXhOThPi9BI4SU0,24863
90
90
  sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
91
91
  sunholo/invoke/__init__.py,sha256=o1RhwBGOtVK0MIdD55fAIMCkJsxTksi8GD5uoqVKI-8,184
92
92
  sunholo/invoke/async_class.py,sha256=uvCP8ekUCfTRWk7xwofTzRqFykMAwrRZ4Ce_YUR6PVs,2820
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
144
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
145
145
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
146
146
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
147
- sunholo-0.99.2.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.99.2.dist-info/METADATA,sha256=fws38XF7U74myvRCU-tsXdM0wf3Lc6SCcM2tcVA7yPc,8310
149
- sunholo-0.99.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
- sunholo-0.99.2.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.99.2.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.99.2.dist-info/RECORD,,
147
+ sunholo-0.99.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.99.4.dist-info/METADATA,sha256=sDVj5CQ3mDSGCPk3KyA56D4yR6h_uzmPxE_wOtZehKo,8310
149
+ sunholo-0.99.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
+ sunholo-0.99.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.99.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.99.4.dist-info/RECORD,,