From d850541b360545888bb7612d42ef26ea48ebdbd8 Mon Sep 17 00:00:00 2001 From: Christo Olivier Date: Mon, 25 Mar 2024 09:45:40 +0000 Subject: [PATCH] Fixed bug that would still raise errors even if a model is returned by one of the match patterns --- pyproject.toml | 2 +- src/modelsmith/forge.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2189908..958c4dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "modelsmith" -version = "0.2.1" +version = "0.2.2" description = "Get Pydantic models and Python types as LLM responses from Google Vertex AI models." authors = ["Christo Olivier "] maintainers = ["Christo Olivier "] diff --git a/src/modelsmith/forge.py b/src/modelsmith/forge.py index d1554e6..613cb8a 100644 --- a/src/modelsmith/forge.py +++ b/src/modelsmith/forge.py @@ -158,8 +158,9 @@ def _process_response( except ValidationError as e: exceptions.append(e) - # Raise any errors that occurred during the JSON validation - if exceptions: + # Raise any errors that occurred during the JSON validation if a valid model + # was not returned + if exceptions and model is None: raise CombinedException(exceptions) return model