Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"enum_type": "forward_compatible_python_enums"
}
},
"originGitCommit": "a5c1143a7b724689db7c5e4cee897834882c9d69",
"sdkVersion": "1.17.0"
"originGitCommit": "204f01f5a6e9ad6585d71b0ad6315aef1be1f537",
"sdkVersion": "1.18.0"
}
917 changes: 914 additions & 3 deletions .fern/replay.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dynamic = ["version"]

[tool.poetry]
name = "extend_ai"
version = "1.17.0"
version = "1.18.0"
description = "Official Python SDK for Extend (extend.ai) — the document processing API. Parse, extract, classify, split, and edit PDFs and 35+ file types"
readme = "README.md"
authors = []
Expand Down
2 changes: 1 addition & 1 deletion reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7150,7 +7150,7 @@ Example: `"invoice"`

Run a workflow. A workflow is a sequence of steps that process files and data in a specific order to achieve a desired outcome.

Pass `file` for a single document, or `package` to process 2-50 files together as one package in a single run. Exactly one of `file` or `package` must be provided.
Pass `file` for a single document use case (more common), or `package` to process 2-50 files together as one package in a single run where context across files is used together to determine final output. Exactly one of `file` or `package` must be provided.

The request returns immediately with a `PROCESSING` status. Use webhooks or poll the Get Workflow Run endpoint for results.
</dd>
Expand Down
12 changes: 12 additions & 0 deletions src/extend_ai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@
ParseRunFailedWebhookEvent,
ParseRunMetrics,
ParseRunOutput,
ParseRunOutputMetadata,
ParseRunOutputMetadataPagesItem,
ParseRunOutputOcr,
ParseRunOutputOcrWordsItem,
ParseRunProcessedWebhookEvent,
Expand Down Expand Up @@ -767,6 +769,8 @@
ParseResultParams,
ParseRunFailedWebhookEventParams,
ParseRunMetricsParams,
ParseRunOutputMetadataPagesItemParams,
ParseRunOutputMetadataParams,
ParseRunOutputOcrParams,
ParseRunOutputOcrWordsItemParams,
ParseRunOutputParams,
Expand Down Expand Up @@ -1440,6 +1444,10 @@
"ParseRunMetrics": ".types",
"ParseRunMetricsParams": ".requests",
"ParseRunOutput": ".types",
"ParseRunOutputMetadata": ".types",
"ParseRunOutputMetadataPagesItem": ".types",
"ParseRunOutputMetadataPagesItemParams": ".requests",
"ParseRunOutputMetadataParams": ".requests",
"ParseRunOutputOcr": ".types",
"ParseRunOutputOcrParams": ".requests",
"ParseRunOutputOcrWordsItem": ".types",
Expand Down Expand Up @@ -2335,6 +2343,10 @@ def __dir__():
"ParseRunMetrics",
"ParseRunMetricsParams",
"ParseRunOutput",
"ParseRunOutputMetadata",
"ParseRunOutputMetadataPagesItem",
"ParseRunOutputMetadataPagesItemParams",
"ParseRunOutputMetadataParams",
"ParseRunOutputOcr",
"ParseRunOutputOcrParams",
"ParseRunOutputOcrWordsItem",
Expand Down
4 changes: 2 additions & 2 deletions src/extend_ai/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform

headers: typing.Dict[str, str] = {
"User-Agent": "extend_ai/1.17.0",
"User-Agent": "extend_ai/1.18.0",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "extend_ai",
"X-Fern-SDK-Version": "1.17.0",
"X-Fern-SDK-Version": "1.18.0",
**(self.get_custom_headers() or {}),
}
headers["Authorization"] = f"Bearer {self._get_token()}"
Expand Down
6 changes: 6 additions & 0 deletions src/extend_ai/requests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@
from .parse_run_failed_webhook_event import ParseRunFailedWebhookEventParams
from .parse_run_metrics import ParseRunMetricsParams
from .parse_run_output import ParseRunOutputParams
from .parse_run_output_metadata import ParseRunOutputMetadataParams
from .parse_run_output_metadata_pages_item import ParseRunOutputMetadataPagesItemParams
from .parse_run_output_ocr import ParseRunOutputOcrParams
from .parse_run_output_ocr_words_item import ParseRunOutputOcrWordsItemParams
from .parse_run_processed_webhook_event import ParseRunProcessedWebhookEventParams
Expand Down Expand Up @@ -724,6 +726,8 @@
"ParseResultParams": ".parse_result",
"ParseRunFailedWebhookEventParams": ".parse_run_failed_webhook_event",
"ParseRunMetricsParams": ".parse_run_metrics",
"ParseRunOutputMetadataPagesItemParams": ".parse_run_output_metadata_pages_item",
"ParseRunOutputMetadataParams": ".parse_run_output_metadata",
"ParseRunOutputOcrParams": ".parse_run_output_ocr",
"ParseRunOutputOcrWordsItemParams": ".parse_run_output_ocr_words_item",
"ParseRunOutputParams": ".parse_run_output",
Expand Down Expand Up @@ -1172,6 +1176,8 @@ def __dir__():
"ParseResultParams",
"ParseRunFailedWebhookEventParams",
"ParseRunMetricsParams",
"ParseRunOutputMetadataPagesItemParams",
"ParseRunOutputMetadataParams",
"ParseRunOutputOcrParams",
"ParseRunOutputOcrWordsItemParams",
"ParseRunOutputParams",
Expand Down
2 changes: 1 addition & 1 deletion src/extend_ai/requests/data_retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DataRetentionParams(typing_extensions.TypedDict):
"""
Controls data retention for this run. When omitted or set to `workspace_default`, Extend uses your workspace's configured retention policy. Set `mode` to `zero` to request zero data retention for the run, which deletes supported run data after processing instead of retaining it under the workspace policy.

Zero data retention is only available for eligible organizations and plans. If your organization is not eligible, the request will fail with a 400 error.
Zero data retention is available to all customers on paid plans upon request. If you're on a free plan, the request will fail with a 400 error. If you'd like to request ZDR to be enabled, please reach out to support@extend.ai.
"""

mode: typing_extensions.NotRequired[DataRetentionMode]
Expand Down
6 changes: 6 additions & 0 deletions src/extend_ai/requests/parse_run_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import typing_extensions
from .chunk import ChunkParams
from .parse_run_output_metadata import ParseRunOutputMetadataParams
from .parse_run_output_ocr import ParseRunOutputOcrParams


Expand All @@ -23,3 +24,8 @@ class ParseRunOutputParams(typing_extensions.TypedDict):
"""
Raw OCR data from the parsing process. Only included when `returnOcr` is configured in the parse config's advanced options.
"""

metadata: typing_extensions.NotRequired[typing.Optional[ParseRunOutputMetadataParams]]
"""
Rotation, dimension, and file-type metadata about the parse output. `null` for parse runs that completed before this field was introduced.
"""
32 changes: 32 additions & 0 deletions src/extend_ai/requests/parse_run_output_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import typing_extensions
from ..core.serialization import FieldMetadata
from .parse_run_output_metadata_pages_item import ParseRunOutputMetadataPagesItemParams


class ParseRunOutputMetadataParams(typing_extensions.TypedDict):
"""
Rotation, dimension, and file-type metadata about the parse output. `null` for parse runs that completed before this field was introduced.
"""

original_mime_type: typing_extensions.NotRequired[
typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="originalMimeType")]
]
"""
The file's media type before any format conversion.
"""

final_mime_type: typing_extensions.NotRequired[
typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="finalMimeType")]
]
"""
The file's media type after any format conversion.
"""

pages: typing_extensions.NotRequired[typing.Optional[typing.Sequence[ParseRunOutputMetadataPagesItemParams]]]
"""
Per-page rotation and original-dimension info. Set when file is a PDF or was converted to PDF.
"""
33 changes: 33 additions & 0 deletions src/extend_ai/requests/parse_run_output_metadata_pages_item.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import typing_extensions
from ..core.serialization import FieldMetadata


class ParseRunOutputMetadataPagesItemParams(typing_extensions.TypedDict):
number: int
"""
The page number this entry describes.
"""

rotation_applied: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="rotationApplied")]
"""
Degrees Extend rotated the page clockwise to make it upright. `0` if rotation detection ran and the page was already upright; `null` if rotation detection was disabled for this run.
"""

original_page_width: typing_extensions.Annotated[float, FieldMetadata(alias="originalPageWidth")]
"""
The file's true page width, independent of rendering resolution.
"""

original_page_height: typing_extensions.Annotated[float, FieldMetadata(alias="originalPageHeight")]
"""
The file's true page height, independent of rendering resolution.
"""

dpi: float
"""
The DPI that `boundingBox`/`polygon` coordinates on this page are scaled to. Multiply `originalPageWidth`/`originalPageHeight` by `dpi / 72` to convert them into that same coordinate space.
"""
5 changes: 5 additions & 0 deletions src/extend_ai/requests/parse_run_output_ocr_words_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ class ParseRunOutputOcrWordsItemParams(typing_extensions.TypedDict):
"""
The page number where the word was detected.
"""

block_id: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="blockId")]]
"""
The `id` of the block (see the `Block` schema) this word was assigned to, based on bounding-box overlap. Omitted when the word doesn't fall within any block's bounding box.
"""
2 changes: 1 addition & 1 deletion src/extend_ai/requests/workflow_run_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class WorkflowRunPackageParams(typing_extensions.TypedDict):

files: typing.Sequence[WorkflowRunPackageFilesItemParams]
"""
The files to process, in submission order. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs.
The files to process. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs.

Duplicate file IDs and duplicate URLs are rejected — each file may appear only once. A URL and a file ID are never treated as duplicates of each other, even if they resolve to the same document.
"""
6 changes: 6 additions & 0 deletions src/extend_ai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@
from .parse_run_failed_webhook_event import ParseRunFailedWebhookEvent
from .parse_run_metrics import ParseRunMetrics
from .parse_run_output import ParseRunOutput
from .parse_run_output_metadata import ParseRunOutputMetadata
from .parse_run_output_metadata_pages_item import ParseRunOutputMetadataPagesItem
from .parse_run_output_ocr import ParseRunOutputOcr
from .parse_run_output_ocr_words_item import ParseRunOutputOcrWordsItem
from .parse_run_processed_webhook_event import ParseRunProcessedWebhookEvent
Expand Down Expand Up @@ -904,6 +906,8 @@
"ParseRunFailedWebhookEvent": ".parse_run_failed_webhook_event",
"ParseRunMetrics": ".parse_run_metrics",
"ParseRunOutput": ".parse_run_output",
"ParseRunOutputMetadata": ".parse_run_output_metadata",
"ParseRunOutputMetadataPagesItem": ".parse_run_output_metadata_pages_item",
"ParseRunOutputOcr": ".parse_run_output_ocr",
"ParseRunOutputOcrWordsItem": ".parse_run_output_ocr_words_item",
"ParseRunProcessedWebhookEvent": ".parse_run_processed_webhook_event",
Expand Down Expand Up @@ -1447,6 +1451,8 @@ def __dir__():
"ParseRunFailedWebhookEvent",
"ParseRunMetrics",
"ParseRunOutput",
"ParseRunOutputMetadata",
"ParseRunOutputMetadataPagesItem",
"ParseRunOutputOcr",
"ParseRunOutputOcrWordsItem",
"ParseRunProcessedWebhookEvent",
Expand Down
2 changes: 1 addition & 1 deletion src/extend_ai/types/data_retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DataRetention(UncheckedBaseModel):
"""
Controls data retention for this run. When omitted or set to `workspace_default`, Extend uses your workspace's configured retention policy. Set `mode` to `zero` to request zero data retention for the run, which deletes supported run data after processing instead of retaining it under the workspace policy.

Zero data retention is only available for eligible organizations and plans. If your organization is not eligible, the request will fail with a 400 error.
Zero data retention is available to all customers on paid plans upon request. If you're on a free plan, the request will fail with a 400 error. If you'd like to request ZDR to be enabled, please reach out to support@extend.ai.
"""

mode: typing.Optional[DataRetentionMode] = pydantic.Field(default=None)
Expand Down
6 changes: 6 additions & 0 deletions src/extend_ai/types/parse_run_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel
from .chunk import Chunk
from .parse_run_output_metadata import ParseRunOutputMetadata
from .parse_run_output_ocr import ParseRunOutputOcr


Expand All @@ -28,6 +29,11 @@ class ParseRunOutput(UncheckedBaseModel):
Raw OCR data from the parsing process. Only included when `returnOcr` is configured in the parse config's advanced options.
"""

metadata: typing.Optional[ParseRunOutputMetadata] = pydantic.Field(default=None)
"""
Rotation, dimension, and file-type metadata about the parse output. `null` for parse runs that completed before this field was introduced.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
Expand Down
44 changes: 44 additions & 0 deletions src/extend_ai/types/parse_run_output_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel
from .parse_run_output_metadata_pages_item import ParseRunOutputMetadataPagesItem


class ParseRunOutputMetadata(UncheckedBaseModel):
"""
Rotation, dimension, and file-type metadata about the parse output. `null` for parse runs that completed before this field was introduced.
"""

original_mime_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="originalMimeType")] = (
pydantic.Field(alias="originalMimeType", default=None)
)
"""
The file's media type before any format conversion.
"""

final_mime_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="finalMimeType")] = (
pydantic.Field(alias="finalMimeType", default=None)
)
"""
The file's media type after any format conversion.
"""

pages: typing.Optional[typing.List[ParseRunOutputMetadataPagesItem]] = pydantic.Field(default=None)
"""
Per-page rotation and original-dimension info. Set when file is a PDF or was converted to PDF.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow
51 changes: 51 additions & 0 deletions src/extend_ai/types/parse_run_output_metadata_pages_item.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.serialization import FieldMetadata
from ..core.unchecked_base_model import UncheckedBaseModel


class ParseRunOutputMetadataPagesItem(UncheckedBaseModel):
number: int = pydantic.Field()
"""
The page number this entry describes.
"""

rotation_applied: typing_extensions.Annotated[typing.Optional[int], FieldMetadata(alias="rotationApplied")] = (
pydantic.Field(alias="rotationApplied", default=None)
)
"""
Degrees Extend rotated the page clockwise to make it upright. `0` if rotation detection ran and the page was already upright; `null` if rotation detection was disabled for this run.
"""

original_page_width: typing_extensions.Annotated[float, FieldMetadata(alias="originalPageWidth")] = pydantic.Field(
alias="originalPageWidth"
)
"""
The file's true page width, independent of rendering resolution.
"""

original_page_height: typing_extensions.Annotated[float, FieldMetadata(alias="originalPageHeight")] = (
pydantic.Field(alias="originalPageHeight")
)
"""
The file's true page height, independent of rendering resolution.
"""

dpi: float = pydantic.Field()
"""
The DPI that `boundingBox`/`polygon` coordinates on this page are scaled to. Multiply `originalPageWidth`/`originalPageHeight` by `dpi / 72` to convert them into that same coordinate space.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow
7 changes: 7 additions & 0 deletions src/extend_ai/types/parse_run_output_ocr_words_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class ParseRunOutputOcrWordsItem(UncheckedBaseModel):
The page number where the word was detected.
"""

block_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="blockId")] = pydantic.Field(
alias="blockId", default=None
)
"""
The `id` of the block (see the `Block` schema) this word was assigned to, based on bounding-box overlap. Omitted when the word doesn't fall within any block's bounding box.
"""

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
Expand Down
2 changes: 1 addition & 1 deletion src/extend_ai/types/workflow_run_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WorkflowRunPackage(UncheckedBaseModel):

files: typing.List[WorkflowRunPackageFilesItem] = pydantic.Field()
"""
The files to process, in submission order. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs.
The files to process. Each entry can be a URL or an existing Extend file ID. Raw text and base64 inputs are not supported for package runs.

Duplicate file IDs and duplicate URLs are rejected — each file may appear only once. A URL and a file ID are never treated as duplicates of each other, even if they resolve to the same document.
"""
Expand Down
Loading
Loading