API: Add standalone method to fetch OpenAPI docs
Generates and stores an export of the openapi.json file for use in static websites. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
bb8b02a60a
commit
5e82b7eb69
3 changed files with 22 additions and 2 deletions
|
|
@ -25,6 +25,10 @@ app.add_middleware(
|
|||
)
|
||||
|
||||
|
||||
def setup_app():
|
||||
app.include_router(OAIRouter)
|
||||
|
||||
|
||||
async def start_api(host: str, port: int):
|
||||
"""Isolated function to start the API server"""
|
||||
|
||||
|
|
@ -33,8 +37,8 @@ async def start_api(host: str, port: int):
|
|||
logger.info(f"Completions: http://{host}:{port}/v1/completions")
|
||||
logger.info(f"Chat completions: http://{host}:{port}/v1/chat/completions")
|
||||
|
||||
# Add OAI router
|
||||
app.include_router(OAIRouter)
|
||||
# Setup app
|
||||
setup_app()
|
||||
|
||||
config = uvicorn.Config(
|
||||
app,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue