MCPcopy Create free account
hub / github.com/Forethought-Technologies/AutoChain / MockIndex

Class MockIndex

test_utils/pinecone_mocks.py:11–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class MockIndex:
12 def __init__(self):
13 self.kv = {}
14
15 def upsert(self, id_vectors, *args, **kwargs):
16 for id, vector in id_vectors:
17 self.kv[id] = vector
18
19 def query(self, vector, *args, **kwargs):
20 for id, v in self.kv.items():
21 if vector == v:
22 return {
23 "matches": [
24 {
25 "id": id,
26 "score": 0.9,
27 }
28 ],
29 "namespace": "",
30 }
31 else:
32 return {}
33
34
35class DummyEncoder(BaseLanguageModel):

Callers 1

pinecone_index_fixtureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected