Skip to content

Commit 799817b

Browse files
cbrummclaude
andcommitted
fix: use v1 sources format instead of deprecated http_sources for URL conversion
The /v1/convert/source endpoint requires the new discriminated union format with "sources": [{"kind": "http", "url": ...}] instead of the deprecated "http_sources" field. Updated both sync and async code paths and tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6f4efad commit 799817b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

integrations/docling_serve/src/haystack_integrations/components/converters/docling_serve/converter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def _convert_url_sync(
182182
url = f"{self.base_url}{_SOURCE_CONVERT_PATH}"
183183
payload: dict[str, Any] = {
184184
"options": self.convert_options,
185-
"http_sources": [{"url": source_url}],
185+
"sources": [{"kind": "http", "url": source_url}],
186186
}
187187

188188
with httpx.Client(timeout=self.timeout) as client:
@@ -218,7 +218,7 @@ async def _convert_url_async(
218218
url = f"{self.base_url}{_SOURCE_CONVERT_PATH}"
219219
payload: dict[str, Any] = {
220220
"options": self.convert_options,
221-
"http_sources": [{"url": source_url}],
221+
"sources": [{"kind": "http", "url": source_url}],
222222
}
223223

224224
async with httpx.AsyncClient(timeout=self.timeout) as client:

integrations/docling_serve/tests/test_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_converts_url(self):
202202
call_kwargs = mock_post.call_args
203203
assert "/v1/convert/source" in call_kwargs.args[0]
204204
body = call_kwargs.kwargs["json"]
205-
assert body["http_sources"] == [{"url": url}]
205+
assert body["sources"] == [{"kind": "http", "url": url}]
206206

207207
def test_http_url_detected(self):
208208
converter = DoclingServeConverter(api_key=None)

0 commit comments

Comments
 (0)