This commit is contained in:
2024-10-28 06:22:41 -04:00
parent 16471a31c9
commit fe7aebd6b6
9 changed files with 43 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
[project]
name = "simplemind"
version = "0.1.0"
description = "An experimental client for AI providers that intends to replace LangChain and LangGraph for most common use cases."
readme = "README.md"
requires-python = ">=3.11"
dependencies = ["pydantic", "instructor"]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
View File
View File
+21
View File
@@ -0,0 +1,21 @@
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from typing import Any
app = FastAPI(title="SimpleMind AI API", description="AI for humans, replacing LangGraph and LangChain for Python users.")
@app.post("/generate", response_model=AIResponse)
def generate_response(request: AIRequest):
try:
# Placeholder for AI generation logic
response = {"message": "This would be the AI response."}
metadata = {"tokens_used": 50}
return AIResponse(response=response, metadata=metadata)
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
@app.get("/health")
def health_check():
return {"status": "healthy"}
View File
View File
View File
+9
View File
@@ -0,0 +1,9 @@
from pydantic import BaseModel
class AIRequest(BaseModel):
prompt: str
parameters: dict = {}
class AIResponse(BaseModel):
response: Any
metadata: dict = {}
+2
View File
@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from simplemind!"