sunholo 0.99.7__py3-none-any.whl → 0.99.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.
@@ -269,9 +269,9 @@ class GenAIFunctionProcessor:
269
269
  traceback_details = traceback.format_exc()
270
270
  log.warning(f"{error_message}\nTraceback: {traceback_details}")
271
271
  result = [f"{error_message}\n{traceback_details}"]
272
-
272
+ clean_result = self.remove_invisible_characters(result)
273
273
  api_requests_and_responses.append(
274
- [function_name, params, result]
274
+ [function_name, params, clean_result]
275
275
  )
276
276
  else:
277
277
  log.error(f"Function {function_name} is not recognized")
@@ -350,6 +350,16 @@ class GenAIFunctionProcessor:
350
350
  except Exception as err:
351
351
  log.error(f"Error initializing model: {str(err)}")
352
352
  return None
353
+
354
+ def remove_invisible_characters(self, string):
355
+
356
+ if not isinstance(string, str):
357
+ return string
358
+
359
+ clean = string.encode('utf-8').decode('unicode_escape')
360
+ log.info(f"Cleaning:\n{string}\n > to >\n{clean}")
361
+
362
+ return clean
353
363
 
354
364
  def run_agent_loop(self, chat, content, callback, guardrail_max=10, loop_return=3):
355
365
  """
@@ -484,11 +494,11 @@ class GenAIFunctionProcessor:
484
494
  if fn_result_json:
485
495
  log.info(f"{fn_result_json} dict parsing")
486
496
  if fn_result_json.get('stdout'):
487
- text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
488
- token += text
497
+ text = fn_result_json.get('stdout')
498
+ token += self.remove_invisible_characters(text)
489
499
  if fn_result_json.get('stderr'):
490
- text = fn_result_json.get('stdout').encode('utf-8').decode('unicode_escape')
491
- token += text
500
+ text = fn_result_json.get('stdout')
501
+ token += self.remove_invisible_characters(text)
492
502
  # If neither 'stdout' nor 'stderr' is present, dump the entire JSON
493
503
  if 'stdout' not in fn_result_json and 'stderr' not in fn_result_json:
494
504
  log.info(f"No recognised keys ('stdout' or 'stderr') in dict: {fn_result_json=} - dumping it all")
@@ -496,7 +506,7 @@ class GenAIFunctionProcessor:
496
506
  else:
497
507
  # probably a string, just return it
498
508
  log.info(f"{fn_result_json} non-dict (String?) parsing")
499
- token += f"{fn_result}\n--- end ---\n"
509
+ token += f"{self.remove_invisible_characters(fn_result)}\n--- end ---\n"
500
510
 
501
511
  this_text += token
502
512
  token_queue.append(token)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.99.7
3
+ Version: 0.99.9
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.7.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.99.9.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=qBcwFE59QzX1ngZB0-5ajjz3LOsvgBeG5_wCk1mWTh8,25309
89
+ sunholo/genai/process_funcs_cls.py,sha256=PSb5MiNKG6NU5OBJU-myq0uRRtj640j2IBkIaxBUC5Q,25695
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.7.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.99.7.dist-info/METADATA,sha256=2gAwyQSDzAlgDzjxufyJqy-zvx2HglT-pi_VsuXVwqg,8310
149
- sunholo-0.99.7.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
- sunholo-0.99.7.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.99.7.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.99.7.dist-info/RECORD,,
147
+ sunholo-0.99.9.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.99.9.dist-info/METADATA,sha256=1rH-_XTnX4V8aENU_dXeqoy3jgY4ophTljQ17gmX5Vw,8310
149
+ sunholo-0.99.9.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
150
+ sunholo-0.99.9.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.99.9.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.99.9.dist-info/RECORD,,