sunholo 0.67.6__py3-none-any.whl → 0.67.8__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/agents/route.py +6 -1
- sunholo/components/retriever.py +60 -8
- sunholo/components/vectorstore.py +1 -1
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/METADATA +2 -2
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/RECORD +9 -9
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/WHEEL +1 -1
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/LICENSE.txt +0 -0
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/entry_points.txt +0 -0
- {sunholo-0.67.6.dist-info → sunholo-0.67.8.dist-info}/top_level.txt +0 -0
sunholo/agents/route.py
CHANGED
|
@@ -47,19 +47,24 @@ def route_endpoint(vector_name, method = 'post', override_endpoint=None):
|
|
|
47
47
|
|
|
48
48
|
agents_config = load_config_key(agent_type, vector_name, kind="agentConfig")
|
|
49
49
|
|
|
50
|
-
log.info(f"
|
|
50
|
+
log.info(f"agents_config: {agents_config}")
|
|
51
51
|
if method not in agents_config:
|
|
52
52
|
raise ValueError(f"Invalid method '{method}' for agent configuration.")
|
|
53
53
|
|
|
54
54
|
# 'post' or 'get'
|
|
55
55
|
endpoints_config = agents_config[method]
|
|
56
56
|
|
|
57
|
+
log.info(f"endpoints_config: {endpoints_config}")
|
|
57
58
|
# Replace placeholders in the config
|
|
58
59
|
endpoints = {}
|
|
59
60
|
for key, value in endpoints_config.items():
|
|
60
61
|
format_args = {'stem': stem}
|
|
61
62
|
if '{vector_name}' in value and vector_name is not None:
|
|
62
63
|
format_args['vector_name'] = vector_name
|
|
64
|
+
|
|
65
|
+
if not isinstance(value, str):
|
|
66
|
+
log.warning('endpoint value not string? format_args: {format_args} - value: {value} - key: {key}')
|
|
67
|
+
|
|
63
68
|
endpoints[key] = value.format(**format_args)
|
|
64
69
|
|
|
65
70
|
return endpoints
|
sunholo/components/retriever.py
CHANGED
|
@@ -46,10 +46,18 @@ def pick_retriever(vector_name, embeddings=None):
|
|
|
46
46
|
vectorstore = value.get('vectorstore')
|
|
47
47
|
if vectorstore:
|
|
48
48
|
log.info(f"Found vectorstore {vectorstore}")
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
from_metadata_id = value.get('from_metadata_id')
|
|
50
|
+
if from_metadata_id:
|
|
51
|
+
# this entry needs to be fetched via metadata key
|
|
52
|
+
log.info(f"Skipped from_metadata_id for {vectorstore}")
|
|
53
|
+
continue
|
|
54
|
+
|
|
55
|
+
embeddings = embeddings or get_embeddings(vector_name)
|
|
51
56
|
read_only = value.get('readonly')
|
|
52
|
-
vectorstore = pick_vectorstore(vectorstore,
|
|
57
|
+
vectorstore = pick_vectorstore(vectorstore,
|
|
58
|
+
vector_name=vector_name,
|
|
59
|
+
embeddings=embeddings,
|
|
60
|
+
read_only=read_only)
|
|
53
61
|
k_override = value.get('k', 3)
|
|
54
62
|
vs_retriever = vectorstore.as_retriever(search_kwargs=dict(k=k_override))
|
|
55
63
|
retriever_list.append(vs_retriever)
|
|
@@ -71,10 +79,54 @@ def pick_retriever(vector_name, embeddings=None):
|
|
|
71
79
|
log.info(f"No retrievers were created for {memories}")
|
|
72
80
|
return None
|
|
73
81
|
|
|
82
|
+
retriever = process_retrieval(retriever_list, vector_name)
|
|
83
|
+
|
|
84
|
+
return retriever
|
|
85
|
+
|
|
86
|
+
def metadata_retriever(metadata: dict, key: str, vector_name:str, embeddings=None):
|
|
87
|
+
"""
|
|
88
|
+
Decides which vector_name to retrieve from metadata passed
|
|
89
|
+
"""
|
|
90
|
+
memories = load_memories(vector_name)
|
|
91
|
+
|
|
92
|
+
retriever_list = []
|
|
93
|
+
for memory in memories: # Iterate over the list
|
|
94
|
+
for key, value in memory.items(): # Now iterate over the dictionary
|
|
95
|
+
log.info(f"Found memory {key}")
|
|
96
|
+
vectorstore = value.get('vectorstore')
|
|
97
|
+
if vectorstore:
|
|
98
|
+
log.info(f"Found vectorstore {vectorstore}")
|
|
99
|
+
from_metadata_id = value.get('from_metadata_id')
|
|
100
|
+
if from_metadata_id:
|
|
101
|
+
# this entry needs to be fetched via metadata key
|
|
102
|
+
log.info(f"Finding id from_metadata_id for {vectorstore}")
|
|
103
|
+
if key not in metadata:
|
|
104
|
+
raise ValueError(f"Missing {key} in {metadata}")
|
|
105
|
+
the_id = metadata[key]
|
|
106
|
+
read_only = value.get('readonly')
|
|
107
|
+
embeddings = embeddings or get_embeddings(vector_name)
|
|
108
|
+
vectorstore = pick_vectorstore(vectorstore,
|
|
109
|
+
vector_name=the_id,
|
|
110
|
+
embeddings=embeddings,
|
|
111
|
+
read_only=read_only)
|
|
112
|
+
k_override = value.get('k', 3)
|
|
113
|
+
id_retriever = vectorstore.as_retriever(search_kwargs=dict(k=k_override))
|
|
114
|
+
retriever_list.append(id_retriever)
|
|
115
|
+
else:
|
|
116
|
+
continue
|
|
117
|
+
|
|
118
|
+
if not retriever_list or len(retriever_list) == 0:
|
|
119
|
+
log.info(f"No retrievers were created for {memories}")
|
|
120
|
+
return None
|
|
121
|
+
|
|
122
|
+
retriever = process_retrieval(retriever_list, vector_name)
|
|
123
|
+
|
|
124
|
+
return retriever
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def process_retrieval(retriever_list: list, vector_name: str):
|
|
74
129
|
k_override = load_config_key("memory_k", vector_name, kind="vacConfig")
|
|
75
|
-
if not k_override:
|
|
76
|
-
k_override = 3
|
|
77
|
-
|
|
78
130
|
lotr = MergerRetriever(retrievers=retriever_list)
|
|
79
131
|
|
|
80
132
|
filter_embeddings = get_embeddings(vector_name)
|
|
@@ -83,5 +135,5 @@ def pick_retriever(vector_name, embeddings=None):
|
|
|
83
135
|
retriever = ContextualCompressionRetriever(
|
|
84
136
|
base_compressor=pipeline, base_retriever=lotr,
|
|
85
137
|
k=k_override)
|
|
86
|
-
|
|
87
|
-
return retriever
|
|
138
|
+
|
|
139
|
+
return retriever
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import os
|
|
15
15
|
from ..logging import log
|
|
16
16
|
|
|
17
|
-
def pick_vectorstore(vs_str, vector_name, embeddings, read_only=None):
|
|
17
|
+
def pick_vectorstore(vs_str: str, vector_name: str, embeddings, read_only=None):
|
|
18
18
|
log.debug('Picking vectorstore')
|
|
19
19
|
|
|
20
20
|
if vs_str == 'supabase':
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sunholo
|
|
3
|
-
Version: 0.67.
|
|
3
|
+
Version: 0.67.8
|
|
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.67.
|
|
6
|
+
Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.67.8.tar.gz
|
|
7
7
|
Author: Holosun ApS
|
|
8
8
|
Author-email: multivac@sunholo.com
|
|
9
9
|
License: Apache License, Version 2.0
|
|
@@ -5,7 +5,7 @@ sunholo/agents/chat_history.py,sha256=bkII7PNEbGCaobu2Rnr2rM9dim3BCK0kM-tiWhoI1t
|
|
|
5
5
|
sunholo/agents/dispatch_to_qa.py,sha256=nFNdxhkr7rVYuUwVoBCBNYBI2Dke6-_z_ZApBEWb_cU,8291
|
|
6
6
|
sunholo/agents/langserve.py,sha256=FdhQjorAY2bMn2rpuabNT6bU3uqSKWrl8DjpH3L_V7k,4375
|
|
7
7
|
sunholo/agents/pubsub.py,sha256=5hbbhbBGyVWRpt2sAGC5FEheYH1mCCwVUhZEB1S7vGg,1337
|
|
8
|
-
sunholo/agents/route.py,sha256=
|
|
8
|
+
sunholo/agents/route.py,sha256=xh8ZJuIs60AhGk-1lw-b9LLuvOIVD2sx8m41BnWMJUI,2606
|
|
9
9
|
sunholo/agents/special_commands.py,sha256=ecD5jrBVXo170sdgPILi0m_m_4nRFEv6qKn5zYEvEK8,6494
|
|
10
10
|
sunholo/agents/swagger.py,sha256=wK90aGOgUojZjfMcjqhhJ_ksJ6ZCsVT1Iy02oU6Q5XM,10786
|
|
11
11
|
sunholo/agents/fastapi/__init__.py,sha256=S_pj4_bTUmDGoq_exaREHlOKThi0zTuGT0VZY0YfODQ,88
|
|
@@ -44,8 +44,8 @@ sunholo/cli/sun_rich.py,sha256=UpMqeJ0C8i0pkue1AHnnyyX0bFJ9zZeJ7HBR6yhuA8A,54
|
|
|
44
44
|
sunholo/cli/swagger.py,sha256=absYKAU-7Yd2eiVNUY-g_WLl2zJfeRUNdWQ0oH8M_HM,1564
|
|
45
45
|
sunholo/components/__init__.py,sha256=IDoylb74zFKo6NIS3RQqUl0PDFBGVxM1dfUmO7OJ44U,176
|
|
46
46
|
sunholo/components/llm.py,sha256=T4we3tGmqUj4tPwxQr9M6AXv_BALqZV_dRSvINan-oU,10374
|
|
47
|
-
sunholo/components/retriever.py,sha256=
|
|
48
|
-
sunholo/components/vectorstore.py,sha256=
|
|
47
|
+
sunholo/components/retriever.py,sha256=8_qA7IZvhWWbTplZK3A6x4DlBsGGAaF_NYX6Fn9QGug,6147
|
|
48
|
+
sunholo/components/vectorstore.py,sha256=BxtMF_wX8Zrexr67P07OTSJPjucTewmcPM5OQwIXHPM,5630
|
|
49
49
|
sunholo/database/__init__.py,sha256=Zz0Shcq-CtStf9rJGIYB_Ybzb8rY_Q9mfSj-nviM490,241
|
|
50
50
|
sunholo/database/alloydb.py,sha256=UeWbk_DAqivquMGibX_tz8v1Jza9qnf4SWThNBG2Dh4,17327
|
|
51
51
|
sunholo/database/database.py,sha256=UDHkceiEvJmS3esQX2LYEjEMrHcogN_JHuJXoVWCH3M,7354
|
|
@@ -105,9 +105,9 @@ sunholo/vertex/__init__.py,sha256=JvHcGFuv6R_nAhY2AdoqqhMpJ5ugeWPZ_svGhWrObBk,13
|
|
|
105
105
|
sunholo/vertex/init.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
|
|
106
106
|
sunholo/vertex/memory_tools.py,sha256=8F1iTWnqEK9mX4W5RzCVKIjydIcNp6OFxjn_dtQ3GXo,5379
|
|
107
107
|
sunholo/vertex/safety.py,sha256=3meAX0HyGZYrH7rXPUAHxtI_3w_zoy_RX7Shtkoa660,1275
|
|
108
|
-
sunholo-0.67.
|
|
109
|
-
sunholo-0.67.
|
|
110
|
-
sunholo-0.67.
|
|
111
|
-
sunholo-0.67.
|
|
112
|
-
sunholo-0.67.
|
|
113
|
-
sunholo-0.67.
|
|
108
|
+
sunholo-0.67.8.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
|
|
109
|
+
sunholo-0.67.8.dist-info/METADATA,sha256=ykhSJT_lwZb0G5IkCAlUPzUcUKOvi8Qhcb0riHi0NYI,6155
|
|
110
|
+
sunholo-0.67.8.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
|
|
111
|
+
sunholo-0.67.8.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
|
|
112
|
+
sunholo-0.67.8.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
|
|
113
|
+
sunholo-0.67.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|