Skip to content

Commit 401f967

Browse files
Fix router muxing, add detected client (#943)
1 parent 133546b commit 401f967

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/codegate/muxing/router.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import structlog
44
from fastapi import APIRouter, HTTPException, Request
55

6+
from codegate.clients.detector import DetectClient
67
from codegate.muxing import rulematcher
78
from codegate.muxing.adapter import BodyAdapter, ResponseAdapter
89
from codegate.providers.registry import ProviderRegistry
@@ -38,6 +39,7 @@ def _ensure_path_starts_with_slash(self, path: str) -> str:
3839
def _setup_routes(self):
3940

4041
@self.router.post(f"/{self.route_name}/{{rest_of_path:path}}")
42+
@DetectClient()
4143
async def route_to_dest_provider(
4244
request: Request,
4345
rest_of_path: str = "",
@@ -73,7 +75,9 @@ async def route_to_dest_provider(
7375
api_key = model_route.auth_material.auth_blob
7476

7577
# Send the request to the destination provider. It will run the pipeline
76-
response = await provider.process_request(new_data, api_key, rest_of_path)
78+
response = await provider.process_request(
79+
new_data, api_key, rest_of_path, request.state.detected_client
80+
)
7781
# Format the response to the client always using the OpenAI format
7882
return self._response_adapter.format_response_to_client(
7983
response, model_route.endpoint.provider_type

0 commit comments

Comments
 (0)