morphik 0.2.2__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {morphik-0.2.2 → morphik-0.2.3}/PKG-INFO +1 -1
- {morphik-0.2.2 → morphik-0.2.3}/morphik/rules.py +16 -1
- {morphik-0.2.2 → morphik-0.2.3}/pyproject.toml +1 -1
- {morphik-0.2.2 → morphik-0.2.3}/.gitignore +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/README.md +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/__init__.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/_internal.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/async_.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/exceptions.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/models.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/sync.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/README.md +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/__init__.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/example_usage.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/test_async.py +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/test_docs/sample1.txt +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/test_docs/sample2.txt +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/test_docs/sample3.txt +0 -0
- {morphik-0.2.2 → morphik-0.2.3}/morphik/tests/test_sync.py +0 -0
@@ -36,7 +36,22 @@ class MetadataExtractionRule(Rule):
|
|
36
36
|
def to_dict(self) -> Dict[str, Any]:
|
37
37
|
if isinstance(self.schema, type) and issubclass(self.schema, BaseModel):
|
38
38
|
# Convert Pydantic model to dict schema
|
39
|
-
|
39
|
+
json_schema = self.schema.model_json_schema()
|
40
|
+
# Extract the properties from the JSON schema format
|
41
|
+
# to match the expected server format
|
42
|
+
schema_dict = {}
|
43
|
+
if "properties" in json_schema:
|
44
|
+
for field_name, field_info in json_schema["properties"].items():
|
45
|
+
# Get field description from the Pydantic field
|
46
|
+
description = field_info.get("description", f"No description for {field_name}")
|
47
|
+
field_type = field_info.get("type", "string")
|
48
|
+
schema_dict[field_name] = {
|
49
|
+
"type": field_type,
|
50
|
+
"description": description
|
51
|
+
}
|
52
|
+
else:
|
53
|
+
# Fallback if properties not found
|
54
|
+
schema_dict = json_schema
|
40
55
|
else:
|
41
56
|
# Assume it's already a dict schema
|
42
57
|
schema_dict = self.schema
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|