mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-08-11 12:52:06 +00:00
* feat: local inference server * fix: source to use bash + vars * chore: isort and black * fix: make file + inference mode * chore: logging * refactor: remove old links * fix: add new env vars * feat: hf inference server * refactor: remove old links * test: batch and single response * chore: black + isort * separate gpu and cpu dockerfiles * moved gpu to separate dockerfile * Fixed test endpoints * Edits to API. server won't start due to failed instantiation error * Method signature * fix: gpu_infer * tests: fix tests --------- Co-authored-by: Andriy Mulyar <andriy.mulyar@gmail.com>
30 lines
635 B
Python
30 lines
635 B
Python
import logging
|
|
|
|
from api_v1.settings import settings
|
|
from fastapi import HTTPException
|
|
from fastapi.responses import JSONResponse
|
|
from starlette.requests import Request
|
|
|
|
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
|