Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: extend chunk meta with schema, version, origin #49

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

vagenas
Copy link
Collaborator

@vagenas vagenas commented Oct 18, 2024

No description provided.

Comment on lines +91 to +103
def check_version_is_compatible(cls, v: str) -> str:
"""Check if this meta item version is compatible with current version."""
current_match = re.match(VERSION_PATTERN, _VERSION)
doc_match = re.match(VERSION_PATTERN, v)
if (
doc_match is None
or current_match is None
or doc_match["major"] != current_match["major"]
or doc_match["minor"] > current_match["minor"]
):
raise ValueError(f"incompatible version {v} with schema version {_VERSION}")
else:
return _VERSION
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will just need to account for the fact that a validator parameter for target version should be included too as it is different for the two cases (pydantic/pydantic#2938)


schema_name: Literal["docling_core.transforms.chunker.DocMeta"] = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with setting a full path to mark the schema. We may want to do the same with DoclingDocument schema name on https://github.com/DS4SD/docling-core/blob/main/docling_core/types/doc/document.py#L784

@vagenas vagenas merged commit d09fe7e into main Oct 22, 2024
7 checks passed
@vagenas vagenas deleted the extend-chunk-meta branch October 22, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants