Skip to content

Commit a580be0

Browse files
committed
feat!: upgrade to langchain v1
Signed-off-by: Panos Vagenas <[email protected]>
1 parent a5c37b5 commit a580be0

File tree

8 files changed

+2612
-2571
lines changed

8 files changed

+2612
-2571
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pip install langchain-docling
2121

2222
### Development setup
2323

24-
To develop for Docling Core, you need Python >=3.9 <=3.13 and uv. You can then install from your local clone's root dir:
24+
To develop for Docling LangChain, you need Python >=3.10 <=3.13 and uv. You can then install from your local clone's root dir:
2525
```bash
2626
uv sync
2727
```

examples/docling_loader.ipynb

Lines changed: 58 additions & 31 deletions
Large diffs are not rendered by default.

examples/docling_picture_description.ipynb

Lines changed: 62 additions & 45 deletions
Large diffs are not rendered by default.

langchain_docling/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def lazy_load(
131131
chunk_iter = self._chunker.chunk(dl_doc)
132132
for chunk in chunk_iter:
133133
yield Document(
134-
page_content=self._chunker.serialize(chunk=chunk),
134+
page_content=self._chunker.contextualize(chunk=chunk),
135135
metadata=self._meta_extractor.extract_chunk_meta(
136136
file_path=file_path,
137137
chunk=chunk,

langchain_docling/picture_description.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ def _annotate_images(self, images: Iterable[Image.Image]) -> Iterable[str]:
8585

8686
responses = self.llm.batch(batch_messages)
8787
for resp in responses:
88-
yield resp.text()
88+
yield resp.text

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ classifiers = [
2323
"Intended Audience :: Science/Research",
2424
"Topic :: Scientific/Engineering :: Artificial Intelligence",
2525
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.9",
2726
"Programming Language :: Python :: 3.10",
2827
"Programming Language :: Python :: 3.11",
2928
"Programming Language :: Python :: 3.12",
3029
"Programming Language :: Python :: 3.13",
30+
"Programming Language :: Python :: 3.14",
3131

3232
]
33-
requires-python = "~=3.9"
33+
requires-python = ">=3.10,<4" # syntax without tilde to prevent uv warning
3434
dependencies = [
35-
"langchain-core~=0.3.19",
36-
"docling~=2.18",
35+
"langchain-core~=1.0",
36+
"docling~=2.26",
3737
]
3838

3939
[project.urls]
@@ -78,14 +78,14 @@ langchain_docling = "langchain_docling._plugins"
7878

7979
[tool.black]
8080
line-length = 88
81-
target-version = ["py39", "py310"]
81+
target-version = ["py310"]
8282
include = '\.pyi?$'
8383
preview = true
8484

8585
[tool.isort]
8686
profile = "black"
8787
line_length = 88
88-
py_version = 39
88+
py_version = 310
8989
multi_line_output = 3
9090
include_trailing_comma = true
9191

@@ -102,7 +102,7 @@ pretty = true
102102
no_implicit_optional = true
103103
namespace_packages = true
104104
show_error_codes = true
105-
python_version = "3.9"
105+
python_version = "3.10"
106106
plugins = ["pydantic.mypy"]
107107

108108
[tool.semantic_release]

test/test_loader.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from .test_data_gen_flag import GEN_TEST_DATA
1111

1212

13-
@pytest.mark.requires("docling")
1413
def test_load_as_markdown(monkeypatch: pytest.MonkeyPatch) -> None:
1514

1615
mock_dl_doc = DoclingDocument.load_from_json("test/data/input/dl_doc_1.json")
@@ -46,7 +45,6 @@ def test_load_as_markdown(monkeypatch: pytest.MonkeyPatch) -> None:
4645
assert act_data == exp_data
4746

4847

49-
@pytest.mark.requires("docling")
5048
def test_load_as_doc_chunks(monkeypatch: pytest.MonkeyPatch) -> None:
5149

5250
mock_dl_doc = DoclingDocument.load_from_json("test/data/input/dl_doc_1.json")

uv.lock

Lines changed: 2482 additions & 2483 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)