Skip to content

Commit b228d38

Browse files
author
Alex Kwiatkowski
committed
split endpoints into separate modules
1 parent 64dfa27 commit b228d38

File tree

18 files changed

+327
-295
lines changed

18 files changed

+327
-295
lines changed

src/llm_http_api/server.py

Lines changed: 0 additions & 295 deletions
This file was deleted.

src/llm_http_api/server/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from pydantic_settings import (
2+
BaseSettings,
3+
)
4+
import uvicorn
5+
import importlib
6+
from llm_http_api.server.fastapi import app
7+
8+
importlib.import_module("llm_http_api.server.root")
9+
importlib.import_module("llm_http_api.server.swagger")
10+
importlib.import_module("llm_http_api.server.probes")
11+
importlib.import_module("llm_http_api.server.audio")
12+
importlib.import_module("llm_http_api.server.chat")
13+
importlib.import_module("llm_http_api.server.embeddings")
14+
importlib.import_module("llm_http_api.server.fine_tuning")
15+
importlib.import_module("llm_http_api.server.files")
16+
importlib.import_module("llm_http_api.server.images")
17+
importlib.import_module("llm_http_api.server.models")
18+
importlib.import_module("llm_http_api.server.moderations")
19+
importlib.import_module("llm_http_api.server.assistants")
20+
importlib.import_module("llm_http_api.server.threads")
21+
importlib.import_module("llm_http_api.server.messages")
22+
importlib.import_module("llm_http_api.server.runs")
23+
24+
25+
class ServerSettings(BaseSettings):
26+
host: str
27+
port: int
28+
log_level: str
29+
30+
31+
def run(settings: ServerSettings):
32+
uvicorn.run(
33+
app, host=settings.host, port=settings.port, log_level=settings.log_level
34+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from llm_http_api.server.fastapi import app
2+
3+
4+
@app.post("/v1/assistants")
5+
async def create_assistant():
6+
return {"message": "TODO#POST create assistant"}
7+
8+
9+
@app.get("/v1/assistants")
10+
async def list_assistants():
11+
return {"message": "TODO#GET list assistants"}
12+
13+
14+
@app.get("/v1/assistants/{assistant_id}")
15+
async def retrieve_assistant():
16+
return {"message": "TODO#GET retrieve assistant"}
17+
18+
19+
@app.post("/v1/assistants/{assistant_id}")
20+
async def modify_assistant():
21+
return {"message": "TODO#POST modify assistant"}
22+
23+
24+
@app.delete("/v1/assistants/{assistant_id}")
25+
async def delete_assistant():
26+
return {"message": "TODO#DELETE assistant"}
27+
28+
29+
@app.post("/v1/assistants/{assistant_id}/files")
30+
async def create_assistant_file():
31+
return {"message": "TODO#POST create assistant file"}
32+
33+
34+
@app.get("/v1/assistants/{assistant_id}/files")
35+
async def list_assistant_file():
36+
return {"message": "TODO#GET list assistant file"}
37+
38+
39+
@app.get("/v1/assistants/{assistant_id}/files/{file_id}")
40+
async def retrieve_assistant_file():
41+
return {"message": "TODO#GET retrieve assistant file"}
42+
43+
44+
@app.delete("/v1/assistants/{assistant_id}/files/{file_id}")
45+
async def delete_assistant_file():
46+
return {"message": "TODO#DELETE assistant file"}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from llm_http_api.server.fastapi import app
2+
3+
4+
@app.post("/v1/audio/speech")
5+
async def create_speech():
6+
return {"message": "TODO#POST speech"}
7+
8+
9+
@app.post("/v1/audio/transcriptions")
10+
async def create_transcription():
11+
return {"message": "TODO#POST transcription"}
12+
13+
14+
@app.post("/v1/audio/translations")
15+
async def create_translation():
16+
return {"message": "TODO#POST translations"}

0 commit comments

Comments
 (0)