diff --git a/libs/ape-common/ape/common/prompt/prompt_base.py b/libs/ape-common/ape/common/prompt/prompt_base.py index 1e76521..73ad709 100644 --- a/libs/ape-common/ape/common/prompt/prompt_base.py +++ b/libs/ape-common/ape/common/prompt/prompt_base.py @@ -198,7 +198,9 @@ async def __call__( if self.response_format["type"] == "text": return res_text parsed_outputs: Dict[str, Any] - if isinstance(self.response_format, BaseModel): + if isinstance(self.response_format, type) and issubclass( + self.response_format, BaseModel + ): parsed_outputs = json.loads(res_text) parsed_outputs = self.response_format.model_validate(parsed_outputs) else: @@ -285,7 +287,7 @@ def dump(self) -> str: """ response_format_cache = None - if isinstance(self.response_format, BaseModel): + if isinstance(self.response_format, type) and issubclass(self.response_format, BaseModel): response_format_cache = self.response_format self.response_format = type_to_response_format_param(self.response_format) diff --git a/libs/ape-common/pyproject.toml b/libs/ape-common/pyproject.toml index 0bf4602..4e6db15 100644 --- a/libs/ape-common/pyproject.toml +++ b/libs/ape-common/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "ape-common" -version = "0.2.0" +version = "0.2.1" description = "Common utilities for Ape: your AI prompt engineer" readme = "README.md" requires-python = ">=3.10"