You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API_KEY = "YOUR_OPENAI_API_KEY" # Replace with your key
387
+
BASE_URL = "" # Optional: if using a custom OpenAI endpoint
387
388
DATA_STORAGE_PATH = "./simple_demo_data"
388
389
LLM_MODEL = "gpt-4o-mini"
389
390
390
391
def simple_demo():
391
-
memo = Memoryos(
392
-
user_id=USER_ID,
393
-
openai_api_key=API_KEY,
394
-
openai_base_url=BASE_URL,
395
-
data_storage_path=DATA_STORAGE_PATH,
396
-
llm_model=LLM_MODEL,
397
-
assistant_id=ASSISTANT_ID,
398
-
short_term_capacity=7,
399
-
mid_term_heat_threshold=5,
400
-
retrieval_queue_capacity=7,
401
-
long_term_knowledge_capacity=100
402
-
)
392
+
print("MemoryOS Simple Demo")
393
+
394
+
# 1. Initialize MemoryOS
395
+
print("Initializing MemoryOS...")
396
+
try:
397
+
memo = Memoryos(
398
+
user_id=USER_ID,
399
+
openai_api_key=API_KEY,
400
+
openai_base_url=BASE_URL,
401
+
data_storage_path=DATA_STORAGE_PATH,
402
+
llm_model=LLM_MODEL,
403
+
assistant_id=ASSISTANT_ID,
404
+
short_term_capacity=7,
405
+
mid_term_heat_threshold=5,
406
+
retrieval_queue_capacity=7,
407
+
long_term_knowledge_capacity=100
408
+
)
409
+
print("MemoryOS initialized successfully!\n")
410
+
except Exception as e:
411
+
print(f"Error: {e}")
412
+
return
413
+
414
+
# 2. Add some basic memories
415
+
print("Adding some memories...")
416
+
403
417
memo.add_memory(
404
418
user_input="Hi! I'm Tom, I work as a data scientist in San Francisco.",
405
419
agent_response="Hello Tom! Nice to meet you. Data science is such an exciting field. What kind of data do you work with?"
406
420
)
407
-
response = memo.get_response(query="What do you remember about my job?")
421
+
422
+
test_query = "What do you remember about my job?"
423
+
print(f"User: {test_query}")
424
+
425
+
response = memo.get_response(
426
+
query=test_query,
427
+
)
428
+
408
429
print(f"Assistant: {response}")
409
430
410
431
if __name__ == "__main__":
411
432
simple_demo()</code></pre>
412
-
</li>
433
+
</li>
434
+
</ul>
435
+
<li><b>MemoryOS-MCP Getting Started</b></li>
436
+
<ul>
437
+
<li><b>🔧 Core Tools</b>
438
+
<ol>
439
+
<li><code>add_memory</code><br>Saves the content of the conversation between the user and the AI assistant into the memory system, for the purpose of building a persistent dialogue history and contextual record.</li>
440
+
<li><code>retrieve_memory</code><br>Retrieves related historical dialogues, user preferences, and knowledge information from the memory system based on a query, helping the AI assistant understand the user’s needs and background.</li>
441
+
<li><code>get_user_profile</code><br>Obtains a user profile generated from the analysis of historical dialogues, including the user’s personality traits, interest preferences, and relevant knowledge background.</li>
0 commit comments