Skip to content

Commit

Permalink
update pydantic model validator
Browse files Browse the repository at this point in the history
  • Loading branch information
knowsuchagency committed Jan 3, 2025
1 parent 768dec0 commit 3039a3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions promptic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from jsonschema import validate as validate_json_schema
from pydantic import BaseModel

__version__ = "4.0.0"
__version__ = "4.0.1"

SystemPrompt = Optional[Union[str, List[str], List[Dict[str, str]]]]

Expand Down Expand Up @@ -193,7 +193,7 @@ def _parse_and_validate_response(self, generated_text: str, return_type: Any):
self.state.add_message(
{"content": json_result, "role": "assistant"}
)
return return_type.model_validate_json(json_result)
return return_type.model_validate(json.loads(json_result))
raise ValueError("Failed to extract JSON result from the generated text.")

# Handle json_schema if provided
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3039a3b

Please sign in to comment.