Skip to content

Commit 570f8b3

Browse files
committed
Update mock_server.py
1 parent e961bcf commit 570f8b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/mock_server.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,14 @@ async def generate(self, req_data: GenerationRequest, initial_request_id: str):
345345
if params.tools:
346346
openai_params["tools"] = params.tools
347347
if params.tool_choice:
348+
if isinstance(params.tool_choice, str) and params.tool_choice == "null":
349+
return JSONResponse(
350+
status_code=400,
351+
content={
352+
"code": "InvalidParameter",
353+
"message": "<400> InternalError.Algo.InvalidParameter: Invalid tool_choice. It must be 'none', 'auto', or a valid object, not the string 'null'."
354+
}
355+
)
348356
openai_params["tool_choice"] = params.tool_choice
349357

350358
if params.max_tokens is not None:

0 commit comments

Comments
 (0)