mirror of
https://github.com/kennethreitz/simplemind.git
synced 2026-06-05 22:50:18 +00:00
test
This commit is contained in:
@@ -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"
|
||||
@@ -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"}
|
||||
@@ -0,0 +1,9 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
class AIRequest(BaseModel):
|
||||
prompt: str
|
||||
parameters: dict = {}
|
||||
|
||||
class AIResponse(BaseModel):
|
||||
response: Any
|
||||
metadata: dict = {}
|
||||
@@ -0,0 +1,2 @@
|
||||
def hello() -> str:
|
||||
return "Hello from simplemind!"
|
||||
Reference in New Issue
Block a user