Update comments and rename files. Add anthropic.py for Anthropic API proxy.

This commit is contained in:
Hemang
2025-01-30 16:34:37 +01:00
parent f6794b76e2
commit 9888068850
3 changed files with 12 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
"""Proxy service to forward requests to the Anthropic APIs"""
from fastapi import APIRouter
proxy = APIRouter()
@@ -1,4 +1,4 @@
"""Proxy service to forward requests to the appropriate language model provider"""
"""Proxy service to forward requests to the OpenAI APIs"""
import gzip
import json
@@ -47,7 +47,7 @@ async def openai_proxy(
dataset_name: str,
endpoint: str,
):
"""Proxy call to a language model provider"""
"""Proxy calls to the OpenAI APIs"""
if endpoint not in ALLOWED_OPEN_AI_ENDPOINTS:
raise HTTPException(status_code=404, detail=NOT_SUPPORTED_ENDPOINT)
+5 -2
View File
@@ -2,13 +2,16 @@
import fastapi
import uvicorn
from routes.proxy import proxy
from routes.anthropic import proxy as anthropic_proxy
from routes.open_ai import proxy as open_ai_proxy
app = fastapi.FastAPI()
router = fastapi.APIRouter(prefix="/api/v1")
router.include_router(proxy, prefix="/proxy", tags=["proxy"])
router.include_router(open_ai_proxy, prefix="/proxy", tags=["open_ai_proxy"])
router.include_router(anthropic_proxy, prefix="/proxy", tags=["anthropic_proxy"])
app.include_router(router)