File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,8 @@ def initialize_all(app: FastAPI, args):
197
197
if args .callbacks :
198
198
configure_custom_callbacks (args .callbacks , app )
199
199
200
+ app .state .drop_params = parse_comma_separated_args (args .drop_params )
201
+
200
202
initialize_routing_logic (
201
203
args .routing_logic ,
202
204
session_key = args .session_key ,
Original file line number Diff line number Diff line change @@ -228,6 +228,16 @@ def parse_args():
228
228
help = "The request rewriter to use. Default is 'noop' (no rewriting)." ,
229
229
)
230
230
231
+ # Drop params arguments
232
+ parser .add_argument (
233
+ "--drop-params" ,
234
+ type = str ,
235
+ default = None ,
236
+ help = "Comma-separated list of OpenAI parameters to drop from requests. "
237
+ "This allows dropping unsupported parameters by your LLM provider. "
238
+ "Example: 'frequency_penalty,logit_bias'" ,
239
+ )
240
+
231
241
# Batch API
232
242
# TODO(gaocegege): Make these batch api related arguments to a separate config.
233
243
parser .add_argument (
Original file line number Diff line number Diff line change @@ -203,6 +203,13 @@ async def route_general_request(
203
203
status_code = 400 , detail = "Request body is not JSON parsable."
204
204
)
205
205
206
+ if hasattr (request .app .state , "drop_params" ) and request .app .state .drop_params :
207
+ for param in request .app .state .drop_params :
208
+ request_json .pop (param , None )
209
+ logger .debug (f"Dropped param { param } from request" )
210
+ request_body = json .dumps (request_json )
211
+ update_content_length (request , request_body )
212
+
206
213
# TODO (ApostaC): merge two awaits into one
207
214
service_discovery = get_service_discovery ()
208
215
endpoints = service_discovery .get_endpoint_info ()
You can’t perform that action at this time.
0 commit comments