Skip to content

Commit 4969272

Browse files
fix: allow DocumentIntelligenceConverter api_version to default to None
The converter previously hardcoded api_version='2024-07-31-preview' as the default, which overrode the SDK's own default (2024-11-30). This caused 404 errors for users who didn't specify an api_version. Now api_version defaults to None, and the SDK uses its own built-in default version. Users can still set api_version explicitly when needed. Fixes #1904
1 parent e144e0a commit 4969272

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

packages/markitdown/src/markitdown/converters/_doc_intel_converter.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def __init__(
134134
self,
135135
*,
136136
endpoint: str,
137-
api_version: str = "2024-07-31-preview",
137+
api_version: str | None = None,
138138
credential: AzureKeyCredential | TokenCredential | None = None,
139139
file_types: List[DocumentIntelligenceFileType] = [
140140
DocumentIntelligenceFileType.DOCX,
@@ -152,7 +152,9 @@ def __init__(
152152
153153
Args:
154154
endpoint (str): The endpoint for the Document Intelligence service.
155-
api_version (str): The API version to use. Defaults to "2024-07-31-preview".
155+
api_version (str | None): The API version to use. When None (the default),
156+
the Document Intelligence SDK uses its own built-in default version.
157+
Set this explicitly only if you need a specific API version.
156158
credential (AzureKeyCredential | TokenCredential | None): The credential to use for authentication.
157159
file_types (List[DocumentIntelligenceFileType]): The file types to accept. Defaults to all supported file types.
158160
"""
@@ -180,11 +182,15 @@ def __init__(
180182

181183
self.endpoint = endpoint
182184
self.api_version = api_version
183-
self.doc_intel_client = DocumentIntelligenceClient(
184-
endpoint=self.endpoint,
185-
api_version=self.api_version,
186-
credential=credential,
187-
)
185+
186+
client_kwargs: dict[str, Any] = {
187+
"endpoint": self.endpoint,
188+
"credential": credential,
189+
}
190+
if self.api_version is not None:
191+
client_kwargs["api_version"] = self.api_version
192+
193+
self.doc_intel_client = DocumentIntelligenceClient(**client_kwargs)
188194

189195
def accepts(
190196
self,

0 commit comments

Comments
 (0)