mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user