Init
This commit is contained in:
		
						commit
						3efaddfae1
					
				
							
								
								
									
										17
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @ -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"] | ||||
							
								
								
									
										36
									
								
								main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								main.py
									
									
									
									
									
										Normal file
									
								
							| @ -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) | ||||
							
								
								
									
										3
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| fastapi>=0.68.0 | ||||
| uvicorn>=0.15.0 | ||||
| pydantic>=1.8.0 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user