File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 3
3
import structlog
4
4
from fastapi import APIRouter , HTTPException , Request
5
5
6
+ from codegate .clients .detector import DetectClient
6
7
from codegate .muxing import rulematcher
7
8
from codegate .muxing .adapter import BodyAdapter , ResponseAdapter
8
9
from codegate .providers .registry import ProviderRegistry
@@ -38,6 +39,7 @@ def _ensure_path_starts_with_slash(self, path: str) -> str:
38
39
def _setup_routes (self ):
39
40
40
41
@self .router .post (f"/{ self .route_name } /{{rest_of_path:path}}" )
42
+ @DetectClient ()
41
43
async def route_to_dest_provider (
42
44
request : Request ,
43
45
rest_of_path : str = "" ,
@@ -73,7 +75,9 @@ async def route_to_dest_provider(
73
75
api_key = model_route .auth_material .auth_blob
74
76
75
77
# 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
+ )
77
81
# Format the response to the client always using the OpenAI format
78
82
return self ._response_adapter .format_response_to_client (
79
83
response , model_route .endpoint .provider_type
You can’t perform that action at this time.
0 commit comments