Skip to content

Commit

Permalink
Merge pull request #4 from christo-olivier/bug/process-response-excep…
Browse files Browse the repository at this point in the history
…tions

Fixed match pattern bug that would still raise errors even if a model is returned by one of the patterns but not the others.
  • Loading branch information
christo-olivier authored Mar 25, 2024
2 parents 52741e2 + d850541 commit 6858adc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
maintainers = ["Christo Olivier <[email protected]>"]
Expand Down
5 changes: 3 additions & 2 deletions src/modelsmith/forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6858adc

Please sign in to comment.