sunholo 0.99.1__py3-none-any.whl → 0.99.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/database/alloydb_client.py +7 -12
- sunholo/genai/process_funcs_cls.py +15 -6
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/METADATA +2 -2
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/RECORD +8 -8
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/WHEEL +0 -0
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/entry_points.txt +0 -0
- {sunholo-0.99.1.dist-info → sunholo-0.99.3.dist-info}/top_level.txt +0 -0
|
@@ -87,7 +87,7 @@ class AlloyDBClient:
|
|
|
87
87
|
self.password = password
|
|
88
88
|
self.inst_url = ""
|
|
89
89
|
if user:
|
|
90
|
-
log.info("User specified {user} - using pg8000 engine")
|
|
90
|
+
log.info(f"User specified {user} - using pg8000 engine")
|
|
91
91
|
self.inst_url = self._build_instance_uri(project_id, region, cluster_name, instance_name)
|
|
92
92
|
self.engine = self._create_engine_from_pg8000(user, password, self.database)
|
|
93
93
|
self.engine_type = "pg8000"
|
|
@@ -204,23 +204,18 @@ class AlloyDBClient:
|
|
|
204
204
|
|
|
205
205
|
return await self.vectorstore.asimilarity_search(query, filter=source_filter_cmd, k=k)
|
|
206
206
|
|
|
207
|
-
def create_index(self, vectorstore=None
|
|
207
|
+
def create_index(self, vectorstore=None):
|
|
208
208
|
from langchain_google_alloydb_pg.indexes import IVFFlatIndex
|
|
209
209
|
|
|
210
|
-
vector_size = vectorsize or get_vector_size(self.vector_name)
|
|
211
|
-
table_name = f"{self.vector_name}_vectorstore_{vector_size}"
|
|
212
|
-
|
|
213
|
-
vsize = f'''ALTER TABLE
|
|
214
|
-
"public"."{table_name}"
|
|
215
|
-
ALTER COLUMN "embedding" TYPE vector({vector_size});
|
|
216
|
-
'''
|
|
217
|
-
self.execute_sql(vsize)
|
|
218
|
-
|
|
219
210
|
index = IVFFlatIndex()
|
|
220
211
|
vs = vectorstore or self.vectorstore
|
|
221
212
|
|
|
222
213
|
return vs.apply_vector_index(index)
|
|
214
|
+
|
|
215
|
+
def refresh_index(self, vectorstore=None):
|
|
216
|
+
vs = vectorstore or self.vectorstore
|
|
223
217
|
|
|
218
|
+
return vs.reindex()
|
|
224
219
|
|
|
225
220
|
def execute_sql(self, sql_statement):
|
|
226
221
|
log.info(f"Executing sync SQL statement: {sql_statement}")
|
|
@@ -482,7 +477,7 @@ class AlloyDBClient:
|
|
|
482
477
|
CREATE TABLE IF NOT EXISTS "{vectorstore_id}" (
|
|
483
478
|
langchain_id UUID NOT NULL,
|
|
484
479
|
content TEXT NOT NULL,
|
|
485
|
-
embedding vector NOT NULL,
|
|
480
|
+
embedding vector({vector_size}) NOT NULL,
|
|
486
481
|
source TEXT,
|
|
487
482
|
langchain_metadata JSONB,
|
|
488
483
|
docstore_doc_id UUID,
|
|
@@ -450,10 +450,18 @@ class GenAIFunctionProcessor:
|
|
|
450
450
|
callback.on_llm_new_token(token=token)
|
|
451
451
|
|
|
452
452
|
try:
|
|
453
|
+
log.info(f"{fn_log} created a result={type(fn_result)=}")
|
|
453
454
|
# Convert MapComposite to a standard Python dictionary
|
|
454
455
|
if isinstance(fn_result, proto.marshal.collections.maps.MapComposite):
|
|
455
456
|
fn_result = dict(fn_result)
|
|
456
|
-
|
|
457
|
+
if isinstance(fn_result, str):
|
|
458
|
+
fn_result_json = json.loads(fn_result)
|
|
459
|
+
else:
|
|
460
|
+
fn_result_json = fn_result
|
|
461
|
+
elif isinstance(fn_result, dict):
|
|
462
|
+
fn_result_json = fn_result
|
|
463
|
+
else:
|
|
464
|
+
log.warning(f"Unrecognised result: {type(fn_result)}")
|
|
457
465
|
if not isinstance(fn_result_json, dict):
|
|
458
466
|
log.warning(f"{fn_result} was loaded but is not a dictionary")
|
|
459
467
|
fn_result_json = None
|
|
@@ -461,17 +469,17 @@ class GenAIFunctionProcessor:
|
|
|
461
469
|
log.warning(f"{fn_result} was not JSON decoded")
|
|
462
470
|
fn_result_json = None
|
|
463
471
|
except Exception as err:
|
|
464
|
-
log.warning(f"{fn_result} was not json decoded due to unknown exception: {str(err)}")
|
|
472
|
+
log.warning(f"{fn_result} was not json decoded due to unknown exception: {str(err)} {traceback.format_exc()}")
|
|
465
473
|
fn_result_json = None
|
|
466
474
|
|
|
467
475
|
if fn == "decide_to_go_on":
|
|
468
|
-
log.info(f"{
|
|
469
|
-
go_on_args =
|
|
476
|
+
log.info(f"{fn_result=} {type(fn_result)}")
|
|
477
|
+
go_on_args = fn_result
|
|
470
478
|
if go_on_args:
|
|
471
479
|
token = f"\n{'STOPPING' if not go_on_args.get('go_on') else 'CONTINUE'}: {go_on_args.get('chat_summary')}\n"
|
|
472
480
|
else:
|
|
473
481
|
log.warning(f"{fn_result_json} did not work for decide_to_go_on")
|
|
474
|
-
token = f"Error calling decide_to_go_on with {
|
|
482
|
+
token = f"Error calling decide_to_go_on with {fn_result}\n"
|
|
475
483
|
else:
|
|
476
484
|
token = f"--- {fn_log} result --- \n"
|
|
477
485
|
if fn_result_json:
|
|
@@ -546,4 +554,5 @@ class GenAIFunctionProcessor:
|
|
|
546
554
|
Returns:
|
|
547
555
|
boolean: True to carry on, False to continue
|
|
548
556
|
"""
|
|
549
|
-
return
|
|
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.
|
|
3
|
+
Version: 0.99.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.99.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.99.3.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=UQpmILNeInuqMrMgf-AeIB7_I44AgJuR_WSrBafDC_k,18986
|
|
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
|
|
@@ -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=
|
|
89
|
+
sunholo/genai/process_funcs_cls.py,sha256=CJCYA5fHAjYaF2uu-H9HzCPEhvGLlRITU2AHZcPz20k,24821
|
|
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.
|
|
148
|
-
sunholo-0.99.
|
|
149
|
-
sunholo-0.99.
|
|
150
|
-
sunholo-0.99.
|
|
151
|
-
sunholo-0.99.
|
|
152
|
-
sunholo-0.99.
|
|
147
|
+
sunholo-0.99.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
148
|
+
sunholo-0.99.3.dist-info/METADATA,sha256=ZbYM2dfChl6nLGkN5OB5SbYiS7CSEyLoKkdTJKteFss,8310
|
|
149
|
+
sunholo-0.99.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
150
|
+
sunholo-0.99.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
151
|
+
sunholo-0.99.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
152
|
+
sunholo-0.99.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|