Skip to content

Commit

Permalink
feat: promote ModelExtractor
Browse files Browse the repository at this point in the history
  • Loading branch information
thorwhalen committed Sep 10, 2024
1 parent d7c54f9 commit a7916f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ju/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ju.json_schema import function_to_json_schema, json_schema_to_signature
from ju.util import truncate_dict_values
from ju.pydantic_util import (
ModelExtractor, # Extracts key paths and corresponding values from data based on matching Pydantic models.
is_valid_wrt_model,
valid_models,
data_to_pydantic_model, # data to pydantic model
Expand Down
3 changes: 3 additions & 0 deletions ju/pydantic_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ def recurse_model(model: Type[BaseModel], prefix: str = '') -> Dict[str, Type[An
from pydantic import BaseModel


# TODO: Not sure the use of ObjectClassifier and is_valid_wrt_model is a good thing
# here. We could just directly implement the logic of it to be more explicit and
# self-contained. We would then not need verifiers and model_classifier.
@dataclass
class ModelExtractor:
"""
Expand Down

0 comments on commit a7916f6

Please sign in to comment.