mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-05-03 05:57:15 +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
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from fastapi import APIRouter, Depends, Response, Security, status
|
|
from pydantic import BaseModel, Field
|
|
from typing import List, Dict
|
|
import logging
|
|
from api_v1.settings import settings
|
|
|
|
logger = logging.getLogger(__name__)
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
### This should follow https://github.com/openai/openai-openapi/blob/master/openapi.yaml
|
|
|
|
class ListEnginesResponse(BaseModel):
|
|
data: List[Dict] = Field(..., description="All available models.")
|
|
|
|
class EngineResponse(BaseModel):
|
|
data: List[Dict] = Field(..., description="All available models.")
|
|
|
|
router = APIRouter(prefix="/engines", tags=["Search Endpoints"])
|
|
|
|
@router.get("/", response_model=ListEnginesResponse)
|
|
async def list_engines():
|
|
'''
|
|
List all available GPT4All models from
|
|
https://raw.githubusercontent.com/nomic-ai/gpt4all/main/gpt4all-chat/metadata/models.json
|
|
'''
|
|
raise NotImplementedError()
|
|
return ListEnginesResponse(data=[])
|
|
|
|
|
|
@router.get("/{engine_id}", response_model=EngineResponse)
|
|
async def retrieve_engine(engine_id: str):
|
|
'''
|
|
|
|
'''
|
|
|
|
raise NotImplementedError()
|
|
return EngineResponse()
|
|
|