This quickstart guide will help you integrate MemSync into your application and start building personalized AI experiences. You’ll learn how to store memories, search for relevant context, and retrieve user profiles.
Let’s start by storing a conversation that MemSync will process to extract meaningful memories:
Copy
import requestsurl = "https://api.memsync.ai/v1/memories"headers = { "X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}data = { "messages": [ { "role": "user", "content": "I'm a software engineer at Google working on machine learning projects. I love hiking and photography in my free time." }, { "role": "assistant", "content": "That's great! It sounds like you have a nice balance between your technical work and creative hobbies." } ], "agent_id": "my-chatbot", "thread_id": "conversation-123", "source": "chat"}response = requests.post(url, json=data, headers=headers)print(response.json())
{ "user_bio": "Software engineer at Google specializing in machine learning with interests in hiking and photography", "memories": [ { "id": "mem_123", "memory": "Works as a software engineer at Google focusing on machine learning projects", "categories": ["career"], "type": "semantic", "vector_distance": 0.15, "rerank_score": 0.92, "source": "chat", "created_at": "2024-03-20T10:00:00Z" } ]}
This example shows the basic pattern: search for context, generate response, store conversation. MemSync handles the complex memory extraction and organization automatically.
Make sure your API key is valid and included in the X-API-Key header as X-API-Key: YOUR_API_KEY.
No memories returned
It may take a few seconds for memories to be processed and indexed. Try searching again, or check that your conversation contained meaningful information.
Rate limiting
MemSync has rate limits to ensure service quality. If you hit limits, implement exponential backoff in your retry logic.