added v1 endpoints

This commit is contained in:
Pratik Narola 2026-05-25 17:45:17 +00:00
parent e5a4d1c7c2
commit ea07a82bd7

View file

@ -401,6 +401,7 @@ async def openai_chat_completions(
# Memory management endpoints - pure Mem0 passthroughs # Memory management endpoints - pure Mem0 passthroughs
@app.post("/memories") @app.post("/memories")
@app.post("/v1/memories")
@limiter.limit("60/minute") # Memory operations - 60/min @limiter.limit("60/minute") # Memory operations - 60/min
async def add_memories( async def add_memories(
request: Request, request: Request,
@ -439,6 +440,7 @@ async def add_memories(
@app.post("/memories/search") @app.post("/memories/search")
@app.post("/v1/memories/search")
@limiter.limit("120/minute") # Search is lighter - 120/min @limiter.limit("120/minute") # Search is lighter - 120/min
async def search_memories( async def search_memories(
request: Request, request: Request,
@ -479,7 +481,7 @@ async def search_memories(
detail="An internal error occurred. Please try again later.", detail="An internal error occurred. Please try again later.",
) )
@app.get("/v1/memories/{user_id}")
@app.get("/memories/{user_id}") @app.get("/memories/{user_id}")
@limiter.limit("120/minute") @limiter.limit("120/minute")
async def get_user_memories( async def get_user_memories(
@ -518,6 +520,7 @@ async def get_user_memories(
@app.put("/memories") @app.put("/memories")
@app.put("/v1/memories")
@limiter.limit("60/minute") @limiter.limit("60/minute")
async def update_memory( async def update_memory(
request: Request, request: Request,
@ -562,7 +565,7 @@ async def update_memory(
detail="An internal error occurred. Please try again later.", detail="An internal error occurred. Please try again later.",
) )
@app.delete("/v1/memories/{memory_id}")
@app.delete("/memories/{memory_id}") @app.delete("/memories/{memory_id}")
@limiter.limit("60/minute") @limiter.limit("60/minute")
async def delete_memory( async def delete_memory(
@ -597,6 +600,7 @@ async def delete_memory(
) )
@app.delete("/v1/memories/user/{user_id}")
@app.delete("/memories/user/{user_id}") @app.delete("/memories/user/{user_id}")
@limiter.limit("10/minute") # Dangerous bulk delete - heavily rate limited @limiter.limit("10/minute") # Dangerous bulk delete - heavily rate limited
async def delete_user_memories( async def delete_user_memories(
@ -832,6 +836,7 @@ async def get_active_users(
} }
# Mount MCP server at /mcp endpoint # Mount MCP server at /mcp endpoint
try: try:
from mcp_server import create_mcp_app from mcp_server import create_mcp_app