MCPcopy Index your code
hub / github.com/CL-lau/SQL-GPT / batchQuery

Method batchQuery

embedding/embeddingHelper.py:130–166  ·  view source on GitHub ↗
(self, texts, topK=5, where=None, where_document=None)

Source from the content-addressed store, hash-verified

128 return result
129
130 def batchQuery(self, texts, topK=5, where=None, where_document=None):
131 # where={"metadata_field": "is_equal_to_this"},
132 # where_document={"$contains": "search_string"}
133 if self.need_redis:
134 res = self.batchQuery_preprocessing(texts)
135 if res is not None:
136 return res
137 if where is None:
138 if where_document is None:
139 result = self.collection.query(
140 query_texts=texts,
141 n_results=topK
142 )
143 else:
144 result = self.collection.query(
145 query_texts=texts,
146 n_results=topK,
147 )
148 else:
149 if where_document is None:
150 result = self.collection.query(
151 query_texts=texts,
152 n_results=topK,
153 where=where
154 )
155 else:
156 result = self.collection.query(
157 query_texts=texts,
158 n_results=topK,
159 where=where
160 )
161
162 result = self.processResult(query=texts, result=result)
163 """
164 result : [[]] 第一层为查询的数量,第二层为每一次查询的相似度结果
165 """
166 return result
167
168 def queryByEmbedding(self, embedding, topK=5, where=None, where_document=None):
169 if where is None:

Callers

nothing calls this directly

Calls 3

processResultMethod · 0.95
queryMethod · 0.80

Tested by

no test coverage detected