mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-30 11:11:35 +00:00
API: Move serviceinfo to core
Best to expose this endpoint to all APIs as its an information endpoint. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Request
|
from fastapi import APIRouter, Depends, HTTPException, Request
|
||||||
from fastapi.responses import JSONResponse
|
|
||||||
from sse_starlette import EventSourceResponse
|
from sse_starlette import EventSourceResponse
|
||||||
from sys import maxsize
|
from sys import maxsize
|
||||||
|
|
||||||
@@ -30,7 +29,6 @@ from endpoints.OAI.utils.embeddings import get_embeddings
|
|||||||
|
|
||||||
api_name = "OAI"
|
api_name = "OAI"
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
urls = {
|
urls = {
|
||||||
"Completions": "http://{host}:{port}/v1/completions",
|
"Completions": "http://{host}:{port}/v1/completions",
|
||||||
"Chat completions": "http://{host}:{port}/v1/chat/completions",
|
"Chat completions": "http://{host}:{port}/v1/chat/completions",
|
||||||
@@ -168,28 +166,3 @@ async def embeddings(request: Request, data: EmbeddingsRequest) -> EmbeddingsRes
|
|||||||
)
|
)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@router.get("/.well-known/serviceinfo")
|
|
||||||
async def service_info():
|
|
||||||
return JSONResponse(content={
|
|
||||||
"version": 0.2,
|
|
||||||
"software": {
|
|
||||||
"name": "TabbyAPI",
|
|
||||||
"repository": "https://github.com/theroyallab/tabbyAPI",
|
|
||||||
"homepage": "https://github.com/theroyallab/tabbyAPI",
|
|
||||||
},
|
|
||||||
"api": {
|
|
||||||
"openai": {
|
|
||||||
"name": "OpenAI API",
|
|
||||||
"relative_url": "/v1",
|
|
||||||
"documentation": "https://theroyallab.github.io/tabbyAPI",
|
|
||||||
"version": 1
|
|
||||||
},
|
|
||||||
"koboldai": {
|
|
||||||
"name": "KoboldAI API",
|
|
||||||
"relative_url": "/api",
|
|
||||||
"documentation": "https://theroyallab.github.io/tabbyAPI",
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import asyncio
|
|||||||
import pathlib
|
import pathlib
|
||||||
from sys import maxsize
|
from sys import maxsize
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Request, Response
|
from fastapi import APIRouter, Depends, HTTPException, Request, Response
|
||||||
|
from fastapi.responses import JSONResponse
|
||||||
from sse_starlette import EventSourceResponse
|
from sse_starlette import EventSourceResponse
|
||||||
|
|
||||||
from common import model, sampling
|
from common import model, sampling
|
||||||
@@ -61,6 +62,34 @@ async def healthcheck(response: Response) -> HealthCheckResponse:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/.well-known/serviceinfo")
|
||||||
|
async def service_info():
|
||||||
|
return JSONResponse(
|
||||||
|
content={
|
||||||
|
"version": 0.1,
|
||||||
|
"software": {
|
||||||
|
"name": "TabbyAPI",
|
||||||
|
"repository": "https://github.com/theroyallab/tabbyAPI",
|
||||||
|
"homepage": "https://github.com/theroyallab/tabbyAPI",
|
||||||
|
},
|
||||||
|
"api": {
|
||||||
|
"openai": {
|
||||||
|
"name": "OpenAI API",
|
||||||
|
"relative_url": "/v1",
|
||||||
|
"documentation": "https://theroyallab.github.io/tabbyAPI",
|
||||||
|
"version": 1,
|
||||||
|
},
|
||||||
|
"koboldai": {
|
||||||
|
"name": "KoboldAI API",
|
||||||
|
"relative_url": "/api",
|
||||||
|
"documentation": "https://theroyallab.github.io/tabbyAPI",
|
||||||
|
"version": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Model list endpoint
|
# Model list endpoint
|
||||||
@router.get("/v1/models", dependencies=[Depends(check_api_key)])
|
@router.get("/v1/models", dependencies=[Depends(check_api_key)])
|
||||||
@router.get("/v1/model/list", dependencies=[Depends(check_api_key)])
|
@router.get("/v1/model/list", dependencies=[Depends(check_api_key)])
|
||||||
|
|||||||
Reference in New Issue
Block a user