import os

from fastapi import FastAPI

from .admin import router as admin_router
from .embed import router as embed_router
from .generate import router as generate_router
from .rerank import router as rerank_router

app = FastAPI(title="Lakehouse AI Sidecar")

app.include_router(embed_router, prefix="/embed", tags=["embed"])
app.include_router(generate_router, prefix="/generate", tags=["generate"])
app.include_router(rerank_router, prefix="/rerank", tags=["rerank"])
app.include_router(admin_router, prefix="/admin", tags=["admin"])


@app.get("/health")
async def health():
    return {
        "status": "ok",
        "ollama_url": os.environ.get("OLLAMA_URL", "http://localhost:11434"),
        "embed_model": os.environ.get("EMBED_MODEL", "nomic-embed-text"),
        "gen_model": os.environ.get("GEN_MODEL", "qwen2.5"),
    }
