MCPcopy
hub / github.com/openai/chatgpt-retrieval-plugin / query

Method query

datastore/datastore.py:53–65  ·  view source on GitHub ↗

Takes in a list of queries and filters and returns a list of query results with matching document chunks and scores.

(self, queries: List[Query])

Source from the content-addressed store, hash-verified

51 raise NotImplementedError
52
53 async def query(self, queries: List[Query]) -> List[QueryResult]:
54 """
55 Takes in a list of queries and filters and returns a list of query results with matching document chunks and scores.
56 """
57 # get a list of just the queries from the Query list
58 query_texts = [query.query for query in queries]
59 query_embeddings = get_embeddings(query_texts)
60 # hydrate the queries with embeddings
61 queries_with_embeddings = [
62 QueryWithEmbedding(**query.dict(), embedding=embedding)
63 for query, embedding in zip(queries, query_embeddings)
64 ]
65 return await self._query(queries_with_embeddings)
66
67 @abstractmethod
68 async def _query(self, queries: List[QueryWithEmbedding]) -> List[QueryResult]:

Callers 11

_single_queryMethod · 0.80
deleteMethod · 0.80
_queryMethod · 0.80
lifecycleFunction · 0.80
query_mainFunction · 0.80
queryFunction · 0.80
query_mainFunction · 0.80
queryFunction · 0.80
query_mainFunction · 0.80
queryFunction · 0.80
query_mainFunction · 0.80

Calls 3

_queryMethod · 0.95
get_embeddingsFunction · 0.90
QueryWithEmbeddingClass · 0.90

Tested by 1

lifecycleFunction · 0.64