commit 3efaddfae118c9a5f9c072e516d0d403e5468e4c Author: maride Date: Mon Sep 8 23:40:14 2025 +0200 Init diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2589ac4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +# Use Python 3.9 slim image as base +FROM python:3.9-slim + +# Set working directory in container +WORKDIR /app + +# Copy the application code +COPY . . + +# Install dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Expose port (assuming the app runs on port 8000) +EXPOSE 8000 + +# Run the application +CMD ["python", "main.py"] diff --git a/main.py b/main.py new file mode 100644 index 0000000..546286a --- /dev/null +++ b/main.py @@ -0,0 +1,36 @@ +from fastapi import FastAPI, HTTPException +from pydantic import BaseModel +from typing import Any +import uvicorn +import json + +app = FastAPI( + title="Remember Service", + description="An OpenAPI-compatible service that allows an LLM to save details by remembering them.", + version="1.0.0" +) + +class RememberRequest(BaseModel): + """ + The request model for the remember tool. + """ + content: Any + metadata: dict = {} + +@app.post("/remember", + summary="Store information to remember", + description="Saves the provided content and optional metadata. This endpoint is designed to be called by an LLM as a tool.") +def remember_endpoint(request: RememberRequest): + """ + Endpoint to remember information. + Prints the received payload to stdout in JSON format. + """ + payload = { + "content": request.content, + "metadata": request.metadata + } + print(json.dumps(payload, indent=2, ensure_ascii=False)) + return {"status": "remembered"} + +if __name__ == "__main__": + uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6a42f7b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +fastapi>=0.68.0 +uvicorn>=0.15.0 +pydantic>=1.8.0