Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add serviceinfo URI #232

Merged
merged 3 commits into from
Nov 29, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions endpoints/OAI/router.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
from fastapi import APIRouter, Depends, HTTPException, Request
from fastapi.responses import JSONResponse
from sse_starlette import EventSourceResponse
from sys import maxsize

Expand Down Expand Up @@ -29,6 +30,7 @@

api_name = "OAI"
router = APIRouter()

urls = {
"Completions": "http://{host}:{port}/v1/completions",
"Chat completions": "http://{host}:{port}/v1/chat/completions",
Expand Down Expand Up @@ -166,3 +168,28 @@ async def embeddings(request: Request, data: EmbeddingsRequest) -> EmbeddingsRes
)

return response

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route should be in endpoints/core since those are propagated across all API servers.

@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
}
}
})
Loading