mirror of
https://github.com/invariantlabs-ai/invariant-gateway.git
synced 2026-08-16 05:50:21 +02:00
Update comments and rename files. Add anthropic.py for Anthropic API proxy.
This commit is contained in:
@@ -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
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user