mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-05-01 13:14:21 +00:00
* GPT4All API Scaffolding. Matches OpenAI OpenAI spec for engines, chats and completions * Edits for docker building * FastAPI app builds and pydantic models are accurate * Added groovy download into dockerfile * improved dockerfile * Chat completions endpoint edits * API uni test sketch * Working example of groovy inference with open ai api * Added lines to test * Set default to mpt
26 lines
631 B
Python
26 lines
631 B
Python
import logging
|
|
from fastapi import HTTPException
|
|
from fastapi.responses import JSONResponse
|
|
from starlette.requests import Request
|
|
from api_v1.settings import settings
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
startup_msg_fmt = """
|
|
Starting up GPT4All API
|
|
"""
|
|
|
|
|
|
async def on_http_error(request: Request, exc: HTTPException):
|
|
return JSONResponse({'detail': exc.detail}, status_code=exc.status_code)
|
|
|
|
|
|
async def on_startup(app):
|
|
startup_msg = startup_msg_fmt.format(settings=settings)
|
|
log.info(startup_msg)
|
|
|
|
def startup_event_handler(app):
|
|
async def start_app() -> None:
|
|
await on_startup(app)
|
|
|
|
return start_app |