azure-doc-intelligence-haystack 1.1.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. azure_doc_intelligence_haystack-1.2.0/CHANGELOG.md +36 -0
  2. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/PKG-INFO +1 -1
  3. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/src/haystack_integrations/components/converters/azure_doc_intelligence/converter.py +7 -2
  4. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/test_azure_document_intelligence_converter.py +50 -7
  5. azure_doc_intelligence_haystack-1.1.0/CHANGELOG.md +0 -9
  6. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/.gitignore +0 -0
  7. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/LICENSE.txt +0 -0
  8. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/README.md +0 -0
  9. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/pydoc/config_docusaurus.yml +0 -0
  10. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/pyproject.toml +0 -0
  11. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/src/haystack_integrations/components/converters/azure_doc_intelligence/__init__.py +0 -0
  12. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/src/haystack_integrations/components/converters/py.typed +0 -0
  13. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/__init__.py +0 -0
  14. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/test_files/docx/sample.docx +0 -0
  15. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/test_files/images/sample_text.jpg +0 -0
  16. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/test_files/pdf/sample_pdf_1.pdf +0 -0
  17. {azure_doc_intelligence_haystack-1.1.0 → azure_doc_intelligence_haystack-1.2.0}/tests/test_files/pdf/sample_pdf_2.pdf +0 -0
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ ## [integrations/azure_doc_intelligence-v1.1.0] - 2026-08-17
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Fix new issues raised by ruff 0.16.0 (#3670)
8
+ - Standardize license files (#3771)
9
+ - Azure Document Intelligence - fix default model (#3769)
10
+
11
+ ### 📚 Documentation
12
+
13
+ - Simplify pydoc configs (#2855)
14
+
15
+ ### 🧪 Testing
16
+
17
+ - Test compatible integrations with python 3.14; update pyproject (#3001)
18
+ - Track test coverage for all integrations (#3065)
19
+ - AzureDocumentIntelligenceConverter - add tests (#3205)
20
+
21
+ ### 🧹 Chores
22
+
23
+ - Remove unused allow-direct-references (#2866)
24
+ - Enable ANN ruff ruleset for azure_doc_intelligence integration (#2981)
25
+ - Enforce ruff docstring rules (D102/D103/D205/D209/D213/D417/D419) in first 10 integrations (#3008)
26
+ - Improve consistency of integrations folder structure (#3430)
27
+ - Re-standardize READMEs (#3768)
28
+
29
+
30
+ ## [integrations/azure_doc_intelligence-v1.0.0] - 2026-01-19
31
+
32
+ ### 🚀 Features
33
+
34
+ - Add azure-doc-intelligence integration (#2717)
35
+
36
+ <!-- generated by git-cliff -->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: azure-doc-intelligence-haystack
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Haystack integration for Azure Document Intelligence
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/azure_doc_intelligence#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -101,6 +101,12 @@ class AzureDocumentIntelligenceConverter:
101
101
  endpoint=self.endpoint, credential=AzureKeyCredential(self.api_key.resolve_value() or "")
102
102
  )
103
103
 
104
+ def close(self) -> None:
105
+ """Close the Azure Document Intelligence client."""
106
+ if self.client is not None:
107
+ self.client.close()
108
+ self.client = None
109
+
104
110
  @component.output_types(documents=list[Document], raw_azure_response=list[dict])
105
111
  def run(
106
112
  self,
@@ -124,8 +130,7 @@ class AzureDocumentIntelligenceConverter:
124
130
  - `documents`: List of created Documents
125
131
  - `raw_azure_response`: List of raw Azure responses used to create the Documents
126
132
  """
127
- if self.client is None:
128
- self.warm_up()
133
+ self.warm_up()
129
134
 
130
135
  documents = []
131
136
  azure_responses = []
@@ -32,7 +32,7 @@ def warmed_converter():
32
32
  return converter
33
33
 
34
34
 
35
- class TestAzureDocumentIntelligenceConverter:
35
+ class TestAzureDocumentIntelligenceConverterInitSerde:
36
36
  def test_init_default(self):
37
37
  """Test basic initialization with defaults"""
38
38
  converter = AzureDocumentIntelligenceConverter(
@@ -43,6 +43,7 @@ class TestAzureDocumentIntelligenceConverter:
43
43
  assert converter.endpoint == "https://test.cognitiveservices.azure.com/"
44
44
  assert converter.model_id == "prebuilt-layout"
45
45
  assert converter.store_full_path is False
46
+ assert converter.client is None
46
47
 
47
48
  def test_init_custom_params(self):
48
49
  """Test initialization with custom parameters"""
@@ -56,6 +57,7 @@ class TestAzureDocumentIntelligenceConverter:
56
57
  assert converter.endpoint == "https://test.cognitiveservices.azure.com/"
57
58
  assert converter.model_id == "prebuilt-read"
58
59
  assert converter.store_full_path is True
60
+ assert converter.client is None
59
61
 
60
62
  def test_to_dict(self):
61
63
  """Test serialization with Secret handling"""
@@ -116,23 +118,64 @@ class TestAzureDocumentIntelligenceConverter:
116
118
  assert converter.endpoint == "https://test.cognitiveservices.azure.com/"
117
119
  assert converter.model_id == "prebuilt-read"
118
120
  assert converter.store_full_path is False
121
+ assert converter.client is None
122
+
119
123
 
120
- def test_warm_up_initializes_client_only_once(self):
124
+ class TestComponentLifecycle:
125
+ def test_key_resolved_at_warm_up_not_init(self, monkeypatch):
126
+ monkeypatch.delenv("MISSING_AZURE_DI_API_KEY", raising=False)
121
127
  converter = AzureDocumentIntelligenceConverter(
122
128
  endpoint="https://test.cognitiveservices.azure.com/",
123
- api_key=Secret.from_token("test_api_key"),
129
+ api_key=Secret.from_env_var("MISSING_AZURE_DI_API_KEY"),
124
130
  )
131
+
125
132
  assert converter.client is None
133
+ with pytest.raises(ValueError, match="MISSING_AZURE_DI_API_KEY"):
134
+ converter.warm_up()
135
+
136
+ def test_sync_lifecycle(self):
137
+ converter = AzureDocumentIntelligenceConverter(
138
+ endpoint="https://test.cognitiveservices.azure.com/",
139
+ api_key=Secret.from_token("test_api_key"),
140
+ )
141
+ with patch(
142
+ "haystack_integrations.components.converters.azure_doc_intelligence.converter.DocumentIntelligenceClient"
143
+ ) as mock_client_cls:
144
+ client = mock_client_cls.return_value
145
+ converter.warm_up()
146
+ assert converter.client is client
147
+ converter.close()
148
+ client.close.assert_called_once_with()
149
+ assert converter.client is None
150
+ converter.warm_up()
151
+ assert mock_client_cls.call_count == 2
152
+
153
+ def test_warm_up_is_idempotent(self):
154
+ converter = AzureDocumentIntelligenceConverter(
155
+ endpoint="https://test.cognitiveservices.azure.com/",
156
+ api_key=Secret.from_token("test_api_key"),
157
+ )
126
158
  with patch(
127
159
  "haystack_integrations.components.converters.azure_doc_intelligence.converter.DocumentIntelligenceClient"
128
160
  ) as mock_client_cls:
129
161
  converter.warm_up()
130
- assert converter.client is mock_client_cls.return_value
131
- mock_client_cls.assert_called_once()
132
162
  converter.warm_up()
133
- mock_client_cls.assert_called_once()
134
163
 
135
- def test_run_calls_warm_up_when_client_is_none(self):
164
+ mock_client_cls.assert_called_once()
165
+
166
+ def test_close_is_safe_without_warm_up(self):
167
+ converter = AzureDocumentIntelligenceConverter(
168
+ endpoint="https://test.cognitiveservices.azure.com/",
169
+ api_key=Secret.from_token("test_api_key"),
170
+ )
171
+
172
+ converter.close()
173
+
174
+ assert converter.client is None
175
+
176
+
177
+ class TestAzureDocumentIntelligenceConverterRun:
178
+ def test_run_calls_warm_up(self):
136
179
  converter = AzureDocumentIntelligenceConverter(
137
180
  endpoint="https://test.cognitiveservices.azure.com/",
138
181
  api_key=Secret.from_token("test_api_key"),
@@ -1,9 +0,0 @@
1
- # Changelog
2
-
3
- ## [integrations/azure_doc_intelligence-v1.0.0] - 2026-01-19
4
-
5
- ### 🚀 Features
6
-
7
- - Add azure-doc-intelligence integration (#2717)
8
-
9
- <!-- generated by git-cliff -->