sunholo 0.105.2__py3-none-any.whl → 0.105.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.
- sunholo/database/alloydb_client.py +1 -1
- sunholo/genai/process_funcs_cls.py +14 -8
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/METADATA +2 -2
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/RECORD +8 -8
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/WHEEL +0 -0
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/entry_points.txt +0 -0
- {sunholo-0.105.2.dist-info → sunholo-0.105.4.dist-info}/top_level.txt +0 -0
|
@@ -129,7 +129,7 @@ class AlloyDBClient:
|
|
|
129
129
|
log.error("Can't create AlloyDBEngine - install via `pip install sunholo[gcp,database]`")
|
|
130
130
|
raise ValueError("Can't import AlloyDBEngine")
|
|
131
131
|
|
|
132
|
-
log.info(f"Inititaing AlloyDB Langchain engine for database: {self.database}")
|
|
132
|
+
log.info(f"Inititaing AlloyDB Langchain engine for database: {self.database} with config: {self.config}")
|
|
133
133
|
|
|
134
134
|
from google.cloud.alloydb.connector import IPTypes
|
|
135
135
|
engine = AlloyDBEngine.from_instance(
|
|
@@ -81,7 +81,9 @@ class GenAIFunctionProcessor:
|
|
|
81
81
|
self.model_name = "gemini-1.5-flash"
|
|
82
82
|
if config:
|
|
83
83
|
self.model_name = config.vacConfig("model") if config.vacConfig("llm") == "vertex" else "gemini-1.5-flash"
|
|
84
|
-
|
|
84
|
+
|
|
85
|
+
if model_name:
|
|
86
|
+
log.info(f"Overriding agent model name {self.model_name} with model {model_name}")
|
|
85
87
|
self.model_name = model_name
|
|
86
88
|
|
|
87
89
|
self.trace = trace
|
|
@@ -225,7 +227,7 @@ class GenAIFunctionProcessor:
|
|
|
225
227
|
|
|
226
228
|
return strings
|
|
227
229
|
|
|
228
|
-
def process_funcs(self, full_response, output_parts=True) -> Union[list['Part'], str]:
|
|
230
|
+
def process_funcs(self, full_response, output_parts=True, loop_span=None) -> Union[list['Part'], str]:
|
|
229
231
|
"""
|
|
230
232
|
Processes the functions based on the full_response from the generative model.
|
|
231
233
|
|
|
@@ -247,6 +249,7 @@ class GenAIFunctionProcessor:
|
|
|
247
249
|
"""
|
|
248
250
|
api_requests_and_responses = []
|
|
249
251
|
|
|
252
|
+
|
|
250
253
|
if not full_response:
|
|
251
254
|
log.info("No response was found to process")
|
|
252
255
|
return api_requests_and_responses
|
|
@@ -273,6 +276,8 @@ class GenAIFunctionProcessor:
|
|
|
273
276
|
if len(params)>8000:
|
|
274
277
|
log.warning(f"Total parameters are over 8000 characters - it may not work properly: {params[:10000]}....[{len(params)}]")
|
|
275
278
|
|
|
279
|
+
fn_span = loop_span.span(name=function_name, input=params_obj) if loop_span else None
|
|
280
|
+
|
|
276
281
|
# Check if the function is in our dictionary of available functions
|
|
277
282
|
if function_name in self.funcs:
|
|
278
283
|
fn_exec = self.funcs[function_name]
|
|
@@ -297,8 +302,11 @@ class GenAIFunctionProcessor:
|
|
|
297
302
|
api_requests_and_responses.append(
|
|
298
303
|
[function_name, params, clean_result]
|
|
299
304
|
)
|
|
305
|
+
fn_span.end(output=clean_result) if fn_span else None
|
|
300
306
|
else:
|
|
301
|
-
|
|
307
|
+
msg = f"Function {function_name} is not recognized"
|
|
308
|
+
log.error(msg)
|
|
309
|
+
fn_span.end(output=msg) if fn_span else None
|
|
302
310
|
|
|
303
311
|
log.info(f"{api_requests_and_responses=}")
|
|
304
312
|
self.last_api_requests_and_responses = api_requests_and_responses
|
|
@@ -466,7 +474,7 @@ class GenAIFunctionProcessor:
|
|
|
466
474
|
input = {'content': content},
|
|
467
475
|
) if loop_span else None
|
|
468
476
|
|
|
469
|
-
response: GenerateContentResponse = chat.send_message(content,
|
|
477
|
+
response: GenerateContentResponse = chat.send_message(content, request_options=RequestOptions(
|
|
470
478
|
retry=retry.Retry(
|
|
471
479
|
initial=10,
|
|
472
480
|
multiplier=2,
|
|
@@ -519,16 +527,14 @@ class GenAIFunctionProcessor:
|
|
|
519
527
|
|
|
520
528
|
except ValueError as err:
|
|
521
529
|
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
530
|
try:
|
|
524
|
-
executed_responses = self.process_funcs(response)
|
|
531
|
+
executed_responses = self.process_funcs(response, loop_span=loop_span)
|
|
525
532
|
except Exception as err:
|
|
526
533
|
log.error(f"Error in executions: {str(err)}")
|
|
527
534
|
executed_responses = []
|
|
528
535
|
token_queue.append(f"{str(err)} for {response=}")
|
|
529
536
|
|
|
530
537
|
log.info(f"[{guardrail}] {executed_responses=}")
|
|
531
|
-
fn_span.end(output=executed_responses) if fn_span else None
|
|
532
538
|
|
|
533
539
|
if executed_responses:
|
|
534
540
|
token_queue.append("\n-- Agent Actions:\n")
|
|
@@ -548,7 +554,7 @@ class GenAIFunctionProcessor:
|
|
|
548
554
|
callback.on_llm_new_token(token=token)
|
|
549
555
|
|
|
550
556
|
log.info(f"{fn_log} created a result={type(fn_result)=}")
|
|
551
|
-
fn_exec_one = fn_exec.span(name=
|
|
557
|
+
fn_exec_one = fn_exec.span(name=fn, input=fn_args) if fn_exec else None
|
|
552
558
|
|
|
553
559
|
fn_result_json = None
|
|
554
560
|
# 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.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.105.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.105.4.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -59,7 +59,7 @@ sunholo/components/retriever.py,sha256=bKIVT7_18Ut3OJd0E0jyiISPnD9qkHWVjcQPT4i1_
|
|
|
59
59
|
sunholo/components/vectorstore.py,sha256=xKk7micTRwZckaI7U6PxvFz_ZSjCH48xPTDYiDcv2tc,5913
|
|
60
60
|
sunholo/database/__init__.py,sha256=bpB5Nk21kwqYj-qdVnvNgXjLsbflnH4g-San7OHMqR4,283
|
|
61
61
|
sunholo/database/alloydb.py,sha256=YH8wNPS8gN-TDZEXQcVHxwd1NScHRfAxma3gK4R6KCk,11740
|
|
62
|
-
sunholo/database/alloydb_client.py,sha256=
|
|
62
|
+
sunholo/database/alloydb_client.py,sha256=kg6J8pCqBkjfEkXdhU8mwxdaI7w-cSE9AxKHWuYmzaM,18943
|
|
63
63
|
sunholo/database/database.py,sha256=VqhZdkXUNdvWn8sUcUV3YNby1JDVf7IykPVXWBtxo9U,7361
|
|
64
64
|
sunholo/database/lancedb.py,sha256=DyfZntiFKBlVPaFooNN1Z6Pl-LAs4nxWKKuq8GBqN58,715
|
|
65
65
|
sunholo/database/static_dbs.py,sha256=8cvcMwUK6c32AS2e_WguKXWMkFf5iN3g9WHzsh0C07Q,442
|
|
@@ -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=8T0664wMeLcUIOHfa3EYHjohbMOHnzTzNz_UNhxutNM,31532
|
|
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.4.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
151
|
+
sunholo-0.105.4.dist-info/METADATA,sha256=mFYUzjQ7asBiG4SEi4oAVar-FbD0kgedLQ8h7C5cs6A,8312
|
|
152
|
+
sunholo-0.105.4.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
|
153
|
+
sunholo-0.105.4.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
154
|
+
sunholo-0.105.4.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
155
|
+
sunholo-0.105.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|