Skip to content

Commit a3429c3

Browse files
authored
fix sdk call (#12)
1 parent fe6d87d commit a3429c3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

libs/unstructured/langchain_unstructured/document_loaders.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from langchain_core.document_loaders.base import BaseLoader
1212
from langchain_core.documents import Document
1313
from typing_extensions import TypeAlias
14-
from unstructured_client import UnstructuredClient # type: ignore
15-
from unstructured_client.models import operations, shared # type: ignore
14+
from unstructured_client import UnstructuredClient
15+
from unstructured_client.models import operations, shared
1616

1717
Element: TypeAlias = Any
1818

@@ -255,7 +255,7 @@ def _elements_via_api(self) -> list[dict[str, Any]]:
255255
"""Retrieve a list of element dicts from the API using the SDK client."""
256256
client = self.client
257257
req = self._sdk_partition_request
258-
response = client.general.partition(req) # type: ignore
258+
response = client.general.partition(request=req)
259259
if response.status_code == 200:
260260
return json.loads(response.raw_response.text)
261261
raise ValueError(

libs/unstructured/tests/integration_tests/test_document_loaders.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77

88
from langchain_unstructured import UnstructuredLoader
99

10-
EXAMPLE_DOCS_DIRECTORY = str(
11-
Path(__file__).parent.parent.parent
12-
/ "example_docs/"
13-
)
10+
EXAMPLE_DOCS_DIRECTORY = str(Path(__file__).parent.parent.parent / "example_docs/")
1411
UNSTRUCTURED_API_KEY = os.getenv("UNSTRUCTURED_API_KEY")
1512

1613

@@ -205,7 +202,7 @@ def test_loader_partition_via_api_raises_TypeError_with_invalid_arg() -> None:
205202
mode="elements",
206203
)
207204

208-
with pytest.raises(TypeError, match="unexpected keyword argument 'mode'"):
205+
with pytest.raises(TypeError):
209206
loader.load()
210207

211208

libs/unstructured/tests/unit_tests/test_document_loaders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from unittest.mock import Mock, mock_open, patch
55

66
import pytest
7-
from unstructured.documents.elements import Text # type: ignore
7+
from unstructured.documents.elements import Text
88

99
from langchain_unstructured.document_loaders import (
1010
UnstructuredLoader,

0 commit comments

Comments
 (0)