Skip to content

Commit 84cab2c

Browse files
committed
add vlm test
1 parent 12d4a15 commit 84cab2c

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

_test_unstructured_client/integration/test_integration_freemium.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from unstructured_client.utils.retries import BackoffStrategy, RetryConfig
1414

1515

16-
FREEMIUM_URL = "https://api.unstructured.io"
16+
# FREEMIUM_URL = "https://api.unstructured.io"
17+
FREEMIUM_URL = "http://127.0.0.1:5000"
1718

1819

1920
@pytest.fixture(scope="module")
@@ -233,3 +234,35 @@ async def call_api():
233234
uvloop.install()
234235
elements = asyncio.run(call_api())
235236
assert len(elements) > 0
237+
238+
239+
# TODO (klaijan) - still cannot test against vlm if the updated client vlm is generated
240+
# `vlm_model cannot be empty for vlm requests.` because partition_parameters do not have the param.
241+
@pytest.mark.parametrize("split_pdf", [True, False])
242+
@pytest.mark.parametrize("vlm_model", ["gpt-4o"])
243+
@pytest.mark.parametrize("vlm_model_provider", ["openai"])
244+
def test_partition_strategy_vlm(split_pdf, vlm_model, vlm_model_provider, client, doc_path):
245+
filename = "layout-parser-paper-fast.pdf"
246+
with open(doc_path / filename, "rb") as f:
247+
files = shared.Files(
248+
content=f.read(),
249+
file_name=filename,
250+
)
251+
252+
req = operations.PartitionRequest(
253+
partition_parameters=shared.PartitionParameters(
254+
files=files,
255+
strategy="vlm",
256+
vlm_model=vlm_model,
257+
vlm_model_provider=vlm_model_provider,
258+
# languages=["eng"],
259+
# split_pdf_page=split_pdf,
260+
)
261+
)
262+
263+
response = client.general.partition(
264+
server_url=FREEMIUM_URL,
265+
request=req
266+
)
267+
assert response.status_code == 200
268+
assert len(response.elements)

0 commit comments

Comments
 (0)