From b733debc3e3316738ba1e73c47b3ed0fefbee2a9 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 9 Mar 2026 22:23:42 -0400 Subject: [PATCH] Fix mypy errors for AsyncOpenAI client construction Pass arguments directly instead of unpacking a dict, which mypy couldn't reconcile with the typed constructor parameters. --- lib/galaxy/webapps/galaxy/api/plugins.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/api/plugins.py b/lib/galaxy/webapps/galaxy/api/plugins.py index 979052565bb..4e7e84f8f0b 100644 --- a/lib/galaxy/webapps/galaxy/api/plugins.py +++ b/lib/galaxy/webapps/galaxy/api/plugins.py @@ -246,11 +246,12 @@ class FastAPIPlugins: return self._create_error("Number of tools exceeded or invalid tools list.") # Build openai client with timeout - client_kwargs = dict(api_key=ai_api_key, timeout=TIMEOUT) - if ai_api_base_url: - client_kwargs["base_url"] = ai_api_base_url try: - client = AsyncOpenAI(**client_kwargs) + client = AsyncOpenAI( + api_key=ai_api_key, + timeout=TIMEOUT, + base_url=ai_api_base_url or None, + ) except Exception as e: log.debug("Failed to initialize OpenAI client.", exc_info=e) return self._create_error("Failed to initialize OpenAI client.", 500)