sunholo 0.91.1__py3-none-any.whl → 0.91.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.
@@ -89,11 +89,8 @@ class AlloyDBClient:
89
89
  log.info("Build with Langchain engine - will use default service account for auth")
90
90
  self.engine = self._create_engine()
91
91
  self.engine_type = "langchain"
92
-
93
- if self.engine_type == "langchain":
94
- self.vectorstore = self.get_vectorstore()
95
- else:
96
- self.vectorstore = None
92
+
93
+ self.vectorstore = None
97
94
 
98
95
  def _build_instance_uri(self, project_id, region, cluster_name, instance_name):
99
96
  return f"projects/{project_id}/locations/{region}/clusters/{cluster_name}/instances/{instance_name}"
@@ -144,10 +141,13 @@ class AlloyDBClient:
144
141
  def _get_embedder(self):
145
142
  return get_embeddings(self.vector_name)
146
143
 
147
- def get_vectorstore(self):
144
+ def get_vectorstore(self, vector_name:str=None):
148
145
  if self.engine_type != "langchain":
149
146
  raise ValueError("Not available using pg8000 engine")
150
147
 
148
+ if vector_name:
149
+ self.vector_name = vector_name
150
+
151
151
  if self.vector_name is None:
152
152
  raise ValueError("No vectorname found - init with ConfigManager?")
153
153
 
@@ -165,7 +165,9 @@ class AlloyDBClient:
165
165
 
166
166
  return self.vectorstore
167
167
 
168
- def _similarity_search(self, query, source_filter:str="", free_filter:str=None):
168
+ def _similarity_search(self, query, source_filter:str="", free_filter:str=None, vector_name:str=None):
169
+
170
+ self.get_vectorstore(vector_name)
169
171
 
170
172
  if free_filter is None:
171
173
  source_filter_cmd = f"source %LIKE% {source_filter}" if source_filter else None
@@ -176,14 +178,21 @@ class AlloyDBClient:
176
178
 
177
179
  return query, source_filter_cmd
178
180
 
179
- def similarity_search(self, query:str, source_filter:str="", free_filter:str=None, k:int=5):
181
+ def similarity_search(self, query:str, source_filter:str="", free_filter:str=None, k:int=5, vector_name:str=None):
180
182
 
181
- query, source_filter_cmd = self._similarity_search(query, source_filter, free_filter)
183
+ query, source_filter_cmd = self._similarity_search(query,
184
+ source_filter=source_filter,
185
+ free_filter=free_filter,
186
+ vector_name=vector_name)
182
187
 
183
188
  return self.vectorstore.similarity_search(query, filter=source_filter_cmd, k=k)
184
189
 
185
- async def asimilarity_search(self, query:str, source_filter:str="", free_filter:str=None, k:int=5):
186
- query, source_filter_cmd = self._similarity_search(query, source_filter, free_filter)
190
+ async def asimilarity_search(self, query:str, source_filter:str="", free_filter:str=None, k:int=5, vector_name:str=None):
191
+
192
+ query, source_filter_cmd = self._similarity_search(query,
193
+ source_filter=source_filter,
194
+ free_filter=free_filter,
195
+ vector_name=vector_name)
187
196
 
188
197
  return await self.vectorstore.asimilarity_search(query, filter=source_filter_cmd, k=k)
189
198
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.91.1
3
+ Version: 0.91.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.91.1.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.91.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=urXmesN-41FrjmYIy1ybp7zUdw7Y4UnVUhWDacBELAU,17002
62
+ sunholo/database/alloydb_client.py,sha256=QYEqMNuqZqDjWsUVk408eC35qmD8Tu87eI6lmYc1YbI,17547
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
@@ -144,9 +144,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
144
144
  sunholo/vertex/memory_tools.py,sha256=q_phxgGX2TG2j2MXNULF2xGzQnQPENwjPN9nZ_A9Gh0,7526
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.91.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
- sunholo-0.91.1.dist-info/METADATA,sha256=VV2CVfBHDRqyFrsgGDzyd-xfFC8gOGn9LTZvuDwjO0Y,7806
149
- sunholo-0.91.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
- sunholo-0.91.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
- sunholo-0.91.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
- sunholo-0.91.1.dist-info/RECORD,,
147
+ sunholo-0.91.3.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
148
+ sunholo-0.91.3.dist-info/METADATA,sha256=vte-1lgpB21AFvYd1RzsZNcKN0FG-vZhdQ0B7PGDXpQ,7806
149
+ sunholo-0.91.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
150
+ sunholo-0.91.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
151
+ sunholo-0.91.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
152
+ sunholo-0.91.3.dist-info/RECORD,,