sunholo 0.105.1__py3-none-any.whl → 0.105.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.
- sunholo/genai/process_funcs_cls.py +12 -8
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/METADATA +2 -2
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/RECORD +7 -7
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/WHEEL +0 -0
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/entry_points.txt +0 -0
- {sunholo-0.105.1.dist-info → sunholo-0.105.3.dist-info}/top_level.txt +0 -0
|
@@ -225,7 +225,7 @@ class GenAIFunctionProcessor:
|
|
|
225
225
|
|
|
226
226
|
return strings
|
|
227
227
|
|
|
228
|
-
def process_funcs(self, full_response, output_parts=True) -> Union[list['Part'], str]:
|
|
228
|
+
def process_funcs(self, full_response, output_parts=True, loop_span=None) -> Union[list['Part'], str]:
|
|
229
229
|
"""
|
|
230
230
|
Processes the functions based on the full_response from the generative model.
|
|
231
231
|
|
|
@@ -247,6 +247,7 @@ class GenAIFunctionProcessor:
|
|
|
247
247
|
"""
|
|
248
248
|
api_requests_and_responses = []
|
|
249
249
|
|
|
250
|
+
|
|
250
251
|
if not full_response:
|
|
251
252
|
log.info("No response was found to process")
|
|
252
253
|
return api_requests_and_responses
|
|
@@ -273,6 +274,8 @@ class GenAIFunctionProcessor:
|
|
|
273
274
|
if len(params)>8000:
|
|
274
275
|
log.warning(f"Total parameters are over 8000 characters - it may not work properly: {params[:10000]}....[{len(params)}]")
|
|
275
276
|
|
|
277
|
+
fn_span = loop_span.span(name=function_name, input=params_obj) if loop_span else None
|
|
278
|
+
|
|
276
279
|
# Check if the function is in our dictionary of available functions
|
|
277
280
|
if function_name in self.funcs:
|
|
278
281
|
fn_exec = self.funcs[function_name]
|
|
@@ -297,8 +300,11 @@ class GenAIFunctionProcessor:
|
|
|
297
300
|
api_requests_and_responses.append(
|
|
298
301
|
[function_name, params, clean_result]
|
|
299
302
|
)
|
|
303
|
+
fn_span.end(output=clean_result) if fn_span else None
|
|
300
304
|
else:
|
|
301
|
-
|
|
305
|
+
msg = f"Function {function_name} is not recognized"
|
|
306
|
+
log.error(msg)
|
|
307
|
+
fn_span.end(output=msg) if fn_span else None
|
|
302
308
|
|
|
303
309
|
log.info(f"{api_requests_and_responses=}")
|
|
304
310
|
self.last_api_requests_and_responses = api_requests_and_responses
|
|
@@ -466,7 +472,7 @@ class GenAIFunctionProcessor:
|
|
|
466
472
|
input = {'content': content},
|
|
467
473
|
) if loop_span else None
|
|
468
474
|
|
|
469
|
-
response: GenerateContentResponse = chat.send_message(content,
|
|
475
|
+
response: GenerateContentResponse = chat.send_message(content, request_options=RequestOptions(
|
|
470
476
|
retry=retry.Retry(
|
|
471
477
|
initial=10,
|
|
472
478
|
multiplier=2,
|
|
@@ -500,7 +506,7 @@ class GenAIFunctionProcessor:
|
|
|
500
506
|
f"Session tokens: [{loop_metadata.total_token_count}]/[{usage_metadata['total_token_count']}] \n"
|
|
501
507
|
))
|
|
502
508
|
loop_metadata = None
|
|
503
|
-
gen.end(output=
|
|
509
|
+
gen.end(output=response.to_dict()) if gen else None
|
|
504
510
|
else:
|
|
505
511
|
gen.end(output="No response received") if gen else None
|
|
506
512
|
|
|
@@ -519,16 +525,14 @@ class GenAIFunctionProcessor:
|
|
|
519
525
|
|
|
520
526
|
except ValueError as err:
|
|
521
527
|
token_queue.append(f"{str(err)} for {chunk=}")
|
|
522
|
-
fn_span = loop_span.span(name="function_execution", input=response) if loop_span else None
|
|
523
528
|
try:
|
|
524
|
-
executed_responses = self.process_funcs(response)
|
|
529
|
+
executed_responses = self.process_funcs(response, loop_span=loop_span)
|
|
525
530
|
except Exception as err:
|
|
526
531
|
log.error(f"Error in executions: {str(err)}")
|
|
527
532
|
executed_responses = []
|
|
528
533
|
token_queue.append(f"{str(err)} for {response=}")
|
|
529
534
|
|
|
530
535
|
log.info(f"[{guardrail}] {executed_responses=}")
|
|
531
|
-
fn_span.end(output=executed_responses) if fn_span else None
|
|
532
536
|
|
|
533
537
|
if executed_responses:
|
|
534
538
|
token_queue.append("\n-- Agent Actions:\n")
|
|
@@ -548,7 +552,7 @@ class GenAIFunctionProcessor:
|
|
|
548
552
|
callback.on_llm_new_token(token=token)
|
|
549
553
|
|
|
550
554
|
log.info(f"{fn_log} created a result={type(fn_result)=}")
|
|
551
|
-
fn_exec_one = fn_exec.span(name=
|
|
555
|
+
fn_exec_one = fn_exec.span(name=fn, input=fn_args) if fn_exec else None
|
|
552
556
|
|
|
553
557
|
fn_result_json = None
|
|
554
558
|
# Convert MapComposite to a standard Python dictionary
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.105.
|
|
3
|
+
Version: 0.105.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.105.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.105.3.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -88,7 +88,7 @@ sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
|
|
|
88
88
|
sunholo/genai/__init__.py,sha256=dBl6IA3-Fx6-Vx81r0XqxHlUq6WeW1iDX188dpChu8s,115
|
|
89
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=
|
|
91
|
+
sunholo/genai/process_funcs_cls.py,sha256=8wKBFzZ59q9Djrl7AYOfciuH9PWeTnaHrLDYDiPmzhE,31430
|
|
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.105.
|
|
151
|
-
sunholo-0.105.
|
|
152
|
-
sunholo-0.105.
|
|
153
|
-
sunholo-0.105.
|
|
154
|
-
sunholo-0.105.
|
|
155
|
-
sunholo-0.105.
|
|
150
|
+
sunholo-0.105.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
151
|
+
sunholo-0.105.3.dist-info/METADATA,sha256=pUNOX0YMdJYBo_SwC0LhTRf67huFAFrR1XSr8oqucIw,8312
|
|
152
|
+
sunholo-0.105.3.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
153
|
+
sunholo-0.105.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
154
|
+
sunholo-0.105.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
155
|
+
sunholo-0.105.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|