Skip to content

client.split() fails in v1.6.0 #76

@cmaloney111

Description

@cmaloney111

SDK v1.6.0 client.split() fails with 422 when following the exact example from docs. split_class is serialized as flat multipart fields instead of JSON string. See MRE below (just the example in the docs):

from landingai_ade import LandingAIADE

client = LandingAIADE()

split_class = [
    {
        "name": "Bank Statement",
        "description": "Document from a bank that summarizes all account activity over a period of time."
    },
    {
        "name": "Pay Stub",
        "description": "Document that details an employee's earnings, deductions, and net pay for a specific pay period.",
        "identifier": "Pay Stub Date"
    }
]

split_response = client.split(
    split_class=split_class,
    markdown="This is a bank statement for account ending in 1234.",
    model="split-latest"
)

Error:

Traceback (most recent call last):
  File "/tmp/ade_mre.py", line 17, in <module>
    split_response = client.split(
                     ^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/landingai_ade/_client.py", line 534, in split
    result = self.post(
             ^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/landingai_ade/_base_client.py", line 1280, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/landingai_ade/_base_client.py", line 1067, in request
    raise self._make_status_error_from_response(err.response) from None
landingai_ade.UnprocessableEntityError: Error code: 422 - {'message': '[{\'type\': \'missing\', \'loc\': (\'body\', \'split_class\'), \'msg\': \'Field required\', \'input\': {\'markdown\': UploadFile(filename=\'upload\', size=52, headers=Headers({\'content-disposition\': \'form-data; name="markdown"; filename="upload"\', \'content-type\': \'application/octet-stream\'})), \'model\': \'split-latest\', \'split_class[0][name]\': \'Bank Statement\', \'split_class[0][description]\': \'Document from a bank that summarizes all account activity over a period of time.\', \'split_class[1][name]\': \'Pay Stub\', \'split_class[1][description]\': "Document that details an employee\'s earnings, deductions, and net pay for a specific pay period.", \'split_class[1][identifier]\': \'Pay Stub Date\'}}]'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions