aboutsummaryrefslogtreecommitdiff
path: root/apps/docs/test.py
diff options
context:
space:
mode:
authorDhravya Shah <[email protected]>2025-11-27 09:53:11 -0700
committerDhravya Shah <[email protected]>2025-11-27 09:53:11 -0700
commit2f8bafac4ecdbf5eccf49219b898fd6586f338a3 (patch)
tree0b97ae1eaab5257a5658da38bcff0e4acd36c602 /apps/docs/test.py
parentruntime styles injection + let user proxy requests for data in graph package ... (diff)
downloadsupermemory-2f8bafac4ecdbf5eccf49219b898fd6586f338a3.tar.xz
supermemory-2f8bafac4ecdbf5eccf49219b898fd6586f338a3.zip
update quickstart
Diffstat (limited to 'apps/docs/test.py')
-rw-r--r--apps/docs/test.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/apps/docs/test.py b/apps/docs/test.py
new file mode 100644
index 00000000..ee5309d6
--- /dev/null
+++ b/apps/docs/test.py
@@ -0,0 +1,33 @@
+from supermemory import Supermemory
+
+client = Supermemory()
+USER_ID = "dhravya"
+
+conversation = [
+ {"role": "assistant", "content": "Hello, how are you doing?"},
+ {"role": "user", "content": "Hello! I am Dhravya. I am 20 years old. I love to code!"},
+ {"role": "user", "content": "Can I go to the club?"},
+]
+
+# Get user profile + relevant memories for context
+profile = client.profile(container_tag=USER_ID, q=conversation[-1]["content"])
+
+context = f"""Static profile:
+{ "\n".join(profile.profile.static)}
+
+Dynamic profile:
+{"\n".join(profile.profile.dynamic)}
+
+Relevant memories:
+{"\n".join(r.content for r in profile.search_results.results)}"""
+
+# Build messages with memory-enriched context
+messages = [{"role": "system", "content": f"User context:\n{context}"}, *conversation]
+
+# response = llm.chat(messages=messages)
+
+# Store conversation for future context
+client.add(
+ content="\n".join(f"{m['role']}: {m['content']}" for m in conversation),
+ container_tag=USER_ID,
+)