diff --git a/CHANGELOG.md b/CHANGELOG.md index 23aae59dc..f4f2ba6a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Features ### Fixes +* **Fix passing parameters to python-client** - Remove parsing list arguments to strings in passing arguments to python-client in Ingest workflow and `partition_via_api` **table metric bug fix** get_element_level_alignment()now will find all the matched indices in predicted table data instead of only returning the first match in the case of multiple matches for the same gt string. diff --git a/test_unstructured/partition/test_api.py b/test_unstructured/partition/test_api.py index 8d535bf86..05dbe7fa7 100644 --- a/test_unstructured/partition/test_api.py +++ b/test_unstructured/partition/test_api.py @@ -249,10 +249,12 @@ def test_partition_via_api_pass_list_type_parameters(monkeypatch): ANY, data=ANY, files=[ - ["extract_image_block_types", [None, '["image", "table"]']], + ["extract_image_block_types[]", [None, "image"]], + ["extract_image_block_types[]", [None, "table"]], ["files", ANY], - ["languages", [None, '["eng"]']], - ["skip_infer_table_types", [None, '["pdf", "docx"]']], + ["languages[]", [None, "eng"]], + ["skip_infer_table_types[]", [None, "pdf"]], + ["skip_infer_table_types[]", [None, "docx"]], ["strategy", [None, "hi_res"]], ], headers=ANY, diff --git a/unstructured/ingest/interfaces.py b/unstructured/ingest/interfaces.py index 40a6bf3b1..a8efd9b9f 100644 --- a/unstructured/ingest/interfaces.py +++ b/unstructured/ingest/interfaces.py @@ -574,14 +574,11 @@ class BaseSingleIngestDoc(BaseIngestDoc, IngestDocJsonMixin, ABC): logger.debug(f"Using remote partition ({endpoint})") - passthrough_partition_kwargs = { - k: str(v) for k, v in partition_kwargs.items() if v is not None - } elements = partition_via_api( filename=str(self.filename), api_key=partition_config.api_key, api_url=endpoint, - **passthrough_partition_kwargs, + **partition_kwargs, ) # TODO: add m_data_source_metadata to unstructured-api pipeline_api and then # pass the stringified json here diff --git a/unstructured/partition/api.py b/unstructured/partition/api.py index da22f5ff5..bd1c5f78b 100644 --- a/unstructured/partition/api.py +++ b/unstructured/partition/api.py @@ -1,7 +1,6 @@ from __future__ import annotations import contextlib -import json from typing import IO, Optional import requests @@ -84,13 +83,6 @@ def partition_via_api( ) files = shared.Files(content=file, file_name=metadata_filename) - # NOTE(christine): Converts all list type parameters to JSON formatted strings - # (e.g. ["image", "table"] -> '["image", "table"]') - # This can be removed if "speakeasy" supports passing list type parameters to FastAPI. - for k, v in request_kwargs.items(): - if isinstance(v, list): - request_kwargs[k] = json.dumps(v) - req = shared.PartitionParameters(files=files, **request_kwargs) response = sdk.general.partition(req)