File size: 822 Bytes
a54fd97 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | """
OmniMem REST API Server Example
Launches a FastAPI server exposing OmniMem as a REST API.
Prerequisites:
pip install omnimem[server]
export OPENAI_API_KEY=your_key_here
Usage:
python api_server.py
# Then visit http://localhost:8000/docs for API documentation
API Endpoints:
POST /memory/text - Store text memory
POST /memory/query - Query memories
GET /memory/stats - Get memory statistics
GET /health - Health check
"""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
def main():
import uvicorn
from omni_memory.app import app
print("Starting OmniMem API server...")
print("API docs: http://localhost:8000/docs")
uvicorn.run(app, host="0.0.0.0", port=8000)
if __name__ == "__main__":
main()
|