Compare commits

...

2 Commits

Author SHA1 Message Date
Adrian Lyjak b22bb1b4b7 update version to 0.6.69 2025-09-21 11:52:25 -04:00
Adrian Lyjak f20cf5c8b9 Handle reasoning field conflict 2025-09-21 11:51:28 -04:00
5 changed files with 61 additions and 11 deletions
@@ -222,12 +222,16 @@ def parse_extracted_field_metadata(
return {
k: _parse_extracted_field_metadata_recursive(v)
for k, v in field_metadata.items()
if k not in _METADATA_FIELDS_SIBLING_TO_LEAF
and k not in _ADDITIONAL_ROOT_METADATA_FIELDS
if not _is_reasoning_field(k, v) and k not in _ADDITIONAL_ROOT_METADATA_FIELDS
}
_METADATA_FIELDS_SIBLING_TO_LEAF = {"reasoning"}
def _is_reasoning_field(field_name: str, field_value: Any) -> bool:
# There can either be a user specified reasoning field (from the schema), or a reasoning metadata field for the
# dict of values
return field_name == "reasoning" and isinstance(field_value, str)
_ADDITIONAL_ROOT_METADATA_FIELDS = {"error"}
@@ -257,14 +261,12 @@ def _parse_extracted_field_metadata_recursive(
except ValidationError:
pass
additional_fields = {
k: v
for k, v in field_value.items()
if k in _METADATA_FIELDS_SIBLING_TO_LEAF
k: v for k, v in field_value.items() if _is_reasoning_field(k, v)
}
return {
k: _parse_extracted_field_metadata_recursive(v, additional_fields)
for k, v in field_value.items()
if k not in _METADATA_FIELDS_SIBLING_TO_LEAF
if not _is_reasoning_field(k, v)
}
elif isinstance(field_value, list):
return [_parse_extracted_field_metadata_recursive(item) for item in field_value]
+2 -2
View File
@@ -11,13 +11,13 @@ dev = [
[project]
name = "llama-parse"
version = "0.6.68"
version = "0.6.69"
description = "Parse files into RAG-Optimized formats."
authors = [{name = "Logan Markewich", email = "logan@llamaindex.ai"}]
requires-python = ">=3.9,<4.0"
readme = "README.md"
license = "MIT"
dependencies = ["llama-cloud-services>=0.6.68"]
dependencies = ["llama-cloud-services>=0.6.69"]
[project.scripts]
llama-parse = "llama_parse.cli.main:parse"
+1 -1
View File
@@ -19,7 +19,7 @@ dev = [
[project]
name = "llama-cloud-services"
version = "0.6.68"
version = "0.6.69"
description = "Tailored SDK clients for LlamaCloud services."
authors = [{name = "Logan Markewich", email = "logan@runllama.ai"}]
requires-python = ">=3.9,<4.0"
@@ -613,3 +613,51 @@ def test_parses_field_metadata_with_error_field():
}
assert parsed.metadata.get("field_errors") == "This is an error"
assert parsed.metadata.get("job_id") == "job-123"
REASONING_IN_SCHEMA = {
"majority_opinion": {
"type": {
"citation": [
{
"page": 4,
"matching_text": "BARRETT, J., delivered the opinion for a unanimous Court.",
},
{"page": 11, "matching_text": "Opinion of the Court"},
],
"parsing_confidence": 1.0,
"extraction_confidence": 0.9999998919950147,
"confidence": 0.9999998919950147,
},
"reasoning": {
"citation": [
{
"page": 15,
"matching_text": "We hold that §5110(b)(1) is not subject to equitable tolling and affirm the judg...",
}
],
"parsing_confidence": 1.0,
"extraction_confidence": 0.414292785946868,
"confidence": 0.414292785946868,
},
},
"reasoning": {
"citation": [
{
"page": 15,
"matching_text": "We hold that §5110(b)(1) is not subject to equitable tolling and affirm the judg...",
}
],
"parsing_confidence": 1.0,
"extraction_confidence": 0.414292785946868,
"confidence": 0.414292785946868,
},
}
def test_field_conflict_in_schema():
extracted = parse_extracted_field_metadata(REASONING_IN_SCHEMA)
assert isinstance(extracted["reasoning"], ExtractedFieldMetadata)
assert isinstance(
extracted["majority_opinion"]["reasoning"], ExtractedFieldMetadata
)
Generated
+1 -1
View File
@@ -1596,7 +1596,7 @@ wheels = [
[[package]]
name = "llama-cloud-services"
version = "0.6.67"
version = "0.6.68"
source = { editable = "." }
dependencies = [
{ name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },