From 3fb2f3bf91c3686e64769ad34e385595e709ea7e Mon Sep 17 00:00:00 2001 From: moe-berri Date: Sat, 24 Oct 2026 22:27:50 -0700 Subject: [PATCH] test(chatgpt): construct immutable request parameters --- .../chat/test_chatgpt_chat_transformation.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py b/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py index 675e14923a0..fcac7778fe2 100644 --- a/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py +++ b/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py @@ -1,6 +1,7 @@ import asyncio import json from pathlib import Path +from types import MappingProxyType from typing import Final import httpx @@ -191,13 +192,13 @@ async def test_requests_use_selected_subscription( ) async def request(index: int, path: Path) -> str: - params: Final = ( - {"model": f"account-{index}"} - if router - else {"model": "chatgpt/gpt-6.1-sol", "chatgpt_auth_file": str(path)} + params: Final = MappingProxyType( + { + "model": f"account-{index}" if router else "chatgpt/gpt-6.1-sol", + **({"chatgpt_auth_file": str(path)} if router is None else {}), + **({"prompt_id": "account-check"} if with_prompt else {}), + } ) - if with_prompt: - params["prompt_id"] = "account-check" if endpoint == "chat": result: Final = await (router.acompletion if router else litellm.acompletion)( **params, messages=[{"role": "user", "content": "Hello"}]