import asyncio
import os
from gravixlayer import AsyncGravixLayer
from gravixlayer.resources.memory import Memory
async def main():
client = AsyncGravixLayer()
memory = Memory(client)
# Add to different indexes
await memory.add("User likes pizza", user_id="alice", index_name="food_preferences")
await memory.add("User prefers React", user_id="alice", index_name="tech_preferences")
await memory.add("Meeting at 3pm", user_id="alice", index_name="calendar_events")
# Search across specific indexes
food_results = await memory.search("food", user_id="alice", index_name="food_preferences")
tech_results = await memory.search("framework", user_id="alice", index_name="tech_preferences")
print(f"Food preferences: {len(food_results['results'])} results")
print(f"Tech preferences: {len(tech_results['results'])} results")
asyncio.run(main())