From c9003bc760dfad2c3b38ce318011c300f97c464d Mon Sep 17 00:00:00 2001 From: Mr-Neutr0n <64578610+Mr-Neutr0n@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:31:13 +0530 Subject: [PATCH] fix(process_response): use issubclass instead of isinstance for ParallelBase check The response_model parameter is a class (type), not an instance. Using isinstance() on a class checks if that class is an instance of a type, which always returns False for user-defined classes. Changed from: if isinstance(response_model, ParallelBase): To: if inspect.isclass(response_model) and issubclass(response_model, ParallelBase): This fixes the "'generator' object has no attribute '_raw_response'" error when using ParallelTools with models like Qwen3-VL. Fixes #2049 --- instructor/processing/response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instructor/processing/response.py b/instructor/processing/response.py index e1022df7c..fc2afa907 100644 --- a/instructor/processing/response.py +++ b/instructor/processing/response.py @@ -263,7 +263,7 @@ async def process_response_async( raw_response=response, ) - if isinstance(response_model, ParallelBase): + if inspect.isclass(response_model) and issubclass(response_model, ParallelBase): logger.debug(f"Returning model from ParallelBase") model._raw_response = response return model @@ -381,7 +381,7 @@ class to parse the response into. Special DSL types supported: raw_response=response, ) - if isinstance(response_model, ParallelBase): + if inspect.isclass(response_model) and issubclass(response_model, ParallelBase): logger.debug(f"Returning model from ParallelBase") model._raw_response = response return model