MCPcopy Create free account
hub / github.com/CL-lau/SQL-GPT / queryByEmbedding

Method queryByEmbedding

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

Source from the content-addressed store, hash-verified

166 return result
167
168 def queryByEmbedding(self, embedding, topK=5, where=None, where_document=None):
169 if where is None:
170 if where_document is None:
171 result = self.collection.query(
172 query_embeddings=[embedding],
173 n_results=topK
174 )
175 else:
176 result = self.collection.query(
177 query_texts=[embedding],
178 n_results=topK,
179 )
180 else:
181 if where_document is None:
182 result = self.collection.query(
183 query_texts=[embedding],
184 n_results=topK,
185 where=where
186 )
187 else:
188 result = self.collection.query(
189 query_texts=[embedding],
190 n_results=topK,
191 where=where
192 )
193
194 result = self.processResult(result=result)
195 return result[0]
196
197 def batchQueryByEmbedding(self, embeddings, topK=5, where=None, where_document=None):
198 if where is None:

Callers

nothing calls this directly

Calls 2

processResultMethod · 0.95
queryMethod · 0.80

Tested by

no test coverage detected