mirror of
https://github.com/Ladebeze66/devsite.git
synced 2025-12-13 04:36:49 +01:00
17 lines
342 B
Python
17 lines
342 B
Python
from fastapi import FastAPI
|
|
import requests
|
|
|
|
app = FastAPI()
|
|
|
|
OLLAMA_API_URL = "http://localhost:11434/api/generate"
|
|
|
|
@app.get("/ask")
|
|
async def ask_question(q: str):
|
|
data = {
|
|
"model": "mistral",
|
|
"prompt": q,
|
|
"stream": False
|
|
}
|
|
response = requests.post(OLLAMA_API_URL, json=data)
|
|
return response.json()
|