MCPcopy Create free account
hub / github.com/MemTensor/MemOS / ZepClient

Class ZepClient

evaluation/scripts/utils/client.py:19–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18
19class ZepClient:
20 def __init__(self):
21 from zep_cloud.client import Zep
22
23 api_key = os.getenv("ZEP_API_KEY")
24 self.client = Zep(api_key=api_key)
25
26 def add(self, messages, user_id, timestamp):
27 iso_date = datetime.fromtimestamp(timestamp).isoformat()
28 for msg in messages:
29 self.client.graph.add(
30 data=msg.get("role") + ": " + msg.get("content"),
31 type="message",
32 created_at=iso_date,
33 group_id=user_id,
34 )
35
36 def search(self, query, user_id, top_k):
37 search_results = (
38 self.client.graph.search(
39 query=query, group_id=user_id, scope="nodes", reranker="rrf", limit=top_k
40 ),
41 self.client.graph.search(
42 query=query, group_id=user_id, scope="edges", reranker="cross_encoder", limit=top_k
43 ),
44 )
45
46 nodes = search_results[0].nodes
47 edges = search_results[1].edges
48 return nodes, edges
49
50
51class Mem0Client:

Callers 3

mainFunction · 0.90
ingest_convFunction · 0.90
process_userFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected