Skip to content

Commit 6858adc

Browse files
Merge pull request #4 from christo-olivier/bug/process-response-exceptions
Fixed match pattern bug that would still raise errors even if a model is returned by one of the patterns but not the others.
2 parents 52741e2 + d850541 commit 6858adc

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "modelsmith"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "Get Pydantic models and Python types as LLM responses from Google Vertex AI models."
55
authors = ["Christo Olivier <mail@christoolivier.com>"]
66
maintainers = ["Christo Olivier <mail@christoolivier.com>"]

src/modelsmith/forge.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@ def _process_response(
158158
except ValidationError as e:
159159
exceptions.append(e)
160160

161-
# Raise any errors that occurred during the JSON validation
162-
if exceptions:
161+
# Raise any errors that occurred during the JSON validation if a valid model
162+
# was not returned
163+
if exceptions and model is None:
163164
raise CombinedException(exceptions)
164165

165166
return model

0 commit comments

Comments
 (0)