fix(responses): handle invalid input types

This commit is contained in:
vanika02 2026-08-14 16:31:43 +00:00
parent 40cf96e780
commit 2decf0dfe0

View file

@ -465,7 +465,7 @@ async def aresponses(
) and litellm_logging_obj.should_run_prompt_management_hooks(prompt_id=prompt_id, non_default_params=kwargs):
if isinstance(input, str):
client_input: list[AllMessageValues] = [{"role": "user", "content": input}]
elif not isinstance(input, list):
elif not isinstance(input, list): # pyright: ignore[reportUnnecessaryIsInstance]
raise litellm.BadRequestError(
message=f"'input' must be a string or list of input items, got {type(input).__name__}",
model=model,
@ -585,7 +585,7 @@ def _apply_prompt_management_to_responses_call(
if isinstance(input, str):
client_input: list[AllMessageValues] = [{"role": "user", "content": input}]
elif not isinstance(input, list):
elif not isinstance(input, list): # pyright: ignore[reportUnnecessaryIsInstance]
raise litellm.BadRequestError(
message=f"'input' must be a string or list of input items, got {type(input).__name__}",
model=model,