youcom-haystack 0.0.1__py3-none-any.whl

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.
File without changes
@@ -0,0 +1,7 @@
1
+ # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from haystack_integrations.components.websearch.youcom.youcom_websearch import YouComError, YouComWebSearch
6
+
7
+ __all__ = ["YouComError", "YouComWebSearch"]
@@ -0,0 +1,283 @@
1
+ # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from typing import Any
7
+
8
+ import httpx
9
+ from haystack import ComponentError, Document, component, logging
10
+ from haystack.utils import Secret
11
+ from haystack.utils.requests_utils import async_request_with_retry, request_with_retry
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ YOUCOM_KEYED_SEARCH_URL = "https://api.you.com/v1/search"
16
+ YOUCOM_KEYLESS_SEARCH_URL = "https://api.you.com/v1/agents/search"
17
+
18
+ API_KEY_ENV_VAR = "YOUDOTCOM_API_KEY"
19
+
20
+ try:
21
+ _VERSION = version("youcom-haystack")
22
+ except PackageNotFoundError: # pragma: no cover
23
+ _VERSION = "0.0.0-dev"
24
+
25
+ USER_AGENT = f"youcom-haystack/{_VERSION} youdotcom-integration/deepset-ai-haystack-core-integrations"
26
+
27
+ _RATE_LIMIT_STATUSES = (402, 429)
28
+ _UPGRADE_HINT = (
29
+ "You.com keyless free-tier limit reached. Set the YOUDOTCOM_API_KEY environment variable "
30
+ "(or pass api_key) for higher limits — get a free API key at https://you.com/platform."
31
+ )
32
+
33
+
34
+ class YouComError(ComponentError):
35
+ """An error occurred while querying the You.com Search API."""
36
+
37
+
38
+ @component
39
+ class YouComWebSearch:
40
+ """
41
+ A component that uses the You.com Search API to search the web and return results as Haystack Documents.
42
+
43
+ Works with zero configuration: when no API key is available, searches use You.com's
44
+ [keyless free tier](https://you.com/docs/api-reference/search/v1-agents-search) (rate limited
45
+ per IP), so getting-started pipelines run without any setup. Set the `YOUDOTCOM_API_KEY`
46
+ environment variable (or pass `api_key`) to use the keyed
47
+ [You.com Search API](https://you.com/docs/api-reference/search/v1-search) with higher limits.
48
+
49
+ Pass `keyless_fallback=False` to require a key and fail fast instead of degrading to the
50
+ keyless tier — useful in production pipelines where a missing key should surface as an error.
51
+
52
+ ### Usage example
53
+
54
+ ```python
55
+ from haystack_integrations.components.websearch.youcom import YouComWebSearch
56
+
57
+ websearch = YouComWebSearch(top_k=5) # no API key needed to get started
58
+ result = websearch.run(query="What is Haystack by deepset?")
59
+ documents = result["documents"]
60
+ links = result["links"]
61
+ ```
62
+ """
63
+
64
+ def __init__(
65
+ self,
66
+ api_key: Secret = Secret.from_env_var(API_KEY_ENV_VAR, strict=False),
67
+ keyless_fallback: bool = True,
68
+ top_k: int | None = 10,
69
+ freshness: str | None = None,
70
+ country: str | None = None,
71
+ search_lang: str | None = None,
72
+ safesearch: str | None = None,
73
+ extra_params: dict[str, Any] | None = None,
74
+ timeout: int = 10,
75
+ max_retries: int = 3,
76
+ ) -> None:
77
+ """
78
+ Initialize the YouComWebSearch component.
79
+
80
+ :param api_key:
81
+ You.com API key. Defaults to the `YOUDOTCOM_API_KEY` environment variable. Resolved
82
+ leniently, so an unset key is not an error — see `keyless_fallback` for what happens then.
83
+ :param keyless_fallback:
84
+ What to do when no API key resolves. When `True` (the default), search the
85
+ [keyless free tier](https://you.com/docs/api-reference/search/v1-agents-search),
86
+ which needs no credentials but is rate limited per IP; the component logs which
87
+ endpoint it selected. When `False`, raise `YouComError` instead, so a missing key
88
+ fails fast rather than silently degrading.
89
+ :param top_k:
90
+ Maximum number of results to return per section (web, news). Maps to the
91
+ `count` parameter in the You.com API (1-100).
92
+ :param freshness:
93
+ Only return results from within the given window: `"day"`, `"week"`, `"month"`,
94
+ `"year"`, or a date range in the format `"YYYY-MM-DDtoYYYY-MM-DD"`.
95
+ :param country:
96
+ 2-letter country code determining the geographical focus of web results (e.g. `"US"`, `"DE"`).
97
+ :param search_lang:
98
+ Language of the returned web results in BCP 47 format (e.g. `"EN"`, `"PT-BR"`).
99
+ Maps to the `language` parameter in the You.com API.
100
+ :param safesearch:
101
+ Content moderation level: `"off"`, `"moderate"`, or `"strict"`.
102
+ :param extra_params:
103
+ Additional query parameters passed directly to the You.com Search API
104
+ (e.g. `{"include_domains": "nytimes.com,bbc.com"}`).
105
+ :param timeout:
106
+ Timeout in seconds for the HTTP request. Defaults to 10.
107
+ :param max_retries:
108
+ Maximum number of retry attempts on transient failures. Defaults to 3.
109
+ """
110
+ self.api_key = api_key
111
+ self.keyless_fallback = keyless_fallback
112
+ self.top_k = top_k
113
+ self.freshness = freshness
114
+ self.country = country
115
+ self.search_lang = search_lang
116
+ self.safesearch = safesearch
117
+ self.extra_params = extra_params
118
+ self.timeout = timeout
119
+ self.max_retries = max_retries
120
+
121
+ @component.output_types(documents=list[Document], links=list[str])
122
+ def run(
123
+ self,
124
+ query: str,
125
+ top_k: int | None = None,
126
+ ) -> dict[str, Any]:
127
+ """
128
+ Search the web using the You.com Search API and return results as Documents.
129
+
130
+ :param query: Search query string.
131
+ :param top_k:
132
+ Optional per-run override of the maximum number of results.
133
+ If not provided, the init-time `top_k` is used.
134
+ :returns: A dictionary with:
135
+ - `documents`: List of Documents containing search result content.
136
+ - `links`: List of URLs from the search results.
137
+ :raises YouComError: If the You.com Search API request fails.
138
+ """
139
+ url, headers = self._build_request()
140
+ params = self._build_params(query=query, top_k=top_k)
141
+
142
+ try:
143
+ response = request_with_retry(
144
+ attempts=self.max_retries,
145
+ method="GET",
146
+ url=url,
147
+ params=params,
148
+ headers=headers,
149
+ timeout=self.timeout,
150
+ )
151
+ except httpx.HTTPError as error:
152
+ raise YouComError(self._error_message(error, headers)) from error
153
+ return self._parse_response(response.json())
154
+
155
+ @component.output_types(documents=list[Document], links=list[str])
156
+ async def run_async(
157
+ self,
158
+ query: str,
159
+ top_k: int | None = None,
160
+ ) -> dict[str, Any]:
161
+ """
162
+ Asynchronously search the web using the You.com Search API and return results as Documents.
163
+
164
+ :param query: Search query string.
165
+ :param top_k:
166
+ Optional per-run override of the maximum number of results.
167
+ If not provided, the init-time `top_k` is used.
168
+ :returns: A dictionary with:
169
+ - `documents`: List of Documents containing search result content.
170
+ - `links`: List of URLs from the search results.
171
+ :raises YouComError: If the You.com Search API request fails.
172
+ """
173
+ url, headers = self._build_request()
174
+ params = self._build_params(query=query, top_k=top_k)
175
+
176
+ try:
177
+ response = await async_request_with_retry(
178
+ attempts=self.max_retries,
179
+ method="GET",
180
+ url=url,
181
+ params=params,
182
+ headers=headers,
183
+ timeout=self.timeout,
184
+ )
185
+ except httpx.HTTPError as error:
186
+ raise YouComError(self._error_message(error, headers)) from error
187
+ return self._parse_response(response.json())
188
+
189
+ def _build_request(self) -> tuple[str, dict[str, str]]:
190
+ """
191
+ Select the endpoint and headers based on API key availability.
192
+
193
+ With a resolvable API key, requests go to the keyed You.com Search API. Without one,
194
+ requests fall back to the keyless free tier, unless `keyless_fallback` is disabled.
195
+
196
+ :raises YouComError: If no API key resolves and `keyless_fallback` is `False`.
197
+ """
198
+ headers = {
199
+ "Accept": "application/json",
200
+ "User-Agent": USER_AGENT,
201
+ }
202
+ api_key = self.api_key.resolve_value() if self.api_key else None
203
+ if api_key:
204
+ headers["X-API-Key"] = api_key
205
+ return YOUCOM_KEYED_SEARCH_URL, headers
206
+
207
+ if not self.keyless_fallback:
208
+ msg = (
209
+ "No You.com API key resolved and keyless_fallback is disabled. Set the "
210
+ f"{API_KEY_ENV_VAR} environment variable, pass api_key explicitly, "
211
+ "or enable keyless_fallback to use the rate-limited keyless tier."
212
+ )
213
+ raise YouComError(msg)
214
+
215
+ logger.debug(
216
+ "No You.com API key resolved; using the keyless free tier at {url}, which is rate "
217
+ "limited per IP. Set keyless_fallback=False to require a key instead.",
218
+ url=YOUCOM_KEYLESS_SEARCH_URL,
219
+ )
220
+ return YOUCOM_KEYLESS_SEARCH_URL, headers
221
+
222
+ def _build_params(self, query: str, top_k: int | None) -> dict[str, Any]:
223
+ effective_top_k = top_k if top_k is not None else self.top_k
224
+ params: dict[str, Any] = {"query": query}
225
+ if effective_top_k is not None:
226
+ params["count"] = effective_top_k
227
+ if self.freshness is not None:
228
+ params["freshness"] = self.freshness
229
+ if self.country is not None:
230
+ params["country"] = self.country
231
+ if self.search_lang is not None:
232
+ params["language"] = self.search_lang
233
+ if self.safesearch is not None:
234
+ params["safesearch"] = self.safesearch
235
+ if self.extra_params:
236
+ params.update(self.extra_params)
237
+ return params
238
+
239
+ @staticmethod
240
+ def _error_message(error: httpx.HTTPError, headers: dict[str, str]) -> str:
241
+ """
242
+ Build the `YouComError` message, adding upgrade guidance for keyless rate-limit responses.
243
+ """
244
+ message = f"An error occurred while querying the You.com Search API. Error: {error}"
245
+ if not isinstance(error, httpx.HTTPStatusError):
246
+ return message
247
+
248
+ message = f"{message}, Response: {error.response.text}"
249
+ if error.response.status_code in _RATE_LIMIT_STATUSES and "X-API-Key" not in headers:
250
+ message = f"{message} — {_UPGRADE_HINT}"
251
+ return message
252
+
253
+ @staticmethod
254
+ def _parse_response(response: dict[str, Any]) -> dict[str, Any]:
255
+ """
256
+ Convert a You.com Search API response to Haystack Documents and links.
257
+
258
+ Web results come first, then news results. Document content is the joined
259
+ text snippets when available, falling back to the result description.
260
+
261
+ :param response: You.com Search API response dictionary.
262
+ :returns: Dictionary with `documents` and `links` keys.
263
+ """
264
+ documents: list[Document] = []
265
+ links: list[str] = []
266
+
267
+ results = response.get("results", {})
268
+ for section in ("web", "news"):
269
+ for result in results.get(section) or []:
270
+ url = result.get("url", "")
271
+ title = result.get("title", "")
272
+ snippets = result.get("snippets") or []
273
+ content = "\n".join(snippets) if snippets else result.get("description", "")
274
+
275
+ meta: dict[str, Any] = {"title": title, "url": url, "source": section}
276
+ if result.get("page_age"):
277
+ meta["page_age"] = result["page_age"]
278
+
279
+ documents.append(Document(content=content, meta=meta))
280
+ if url:
281
+ links.append(url)
282
+
283
+ return {"documents": documents, "links": links}
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.5
2
+ Name: youcom-haystack
3
+ Version: 0.0.1
4
+ Summary: Haystack integration for the You.com Search API
5
+ Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/youcom#readme
6
+ Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
7
+ Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/youcom
8
+ Author-email: deepset GmbH <info@deepset.ai>, "You.com" <developers@you.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE.txt
11
+ Keywords: AI Search,Haystack,Web Search,You.com
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: haystack-ai>=2.24.1
24
+ Requires-Dist: httpx>=0.27.0
25
+ Description-Content-Type: text/markdown
26
+
27
+ # youcom-haystack
28
+
29
+ [![PyPI - Version](https://img.shields.io/pypi/v/youcom-haystack.svg)](https://pypi.org/project/youcom-haystack)
30
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/youcom-haystack.svg)](https://pypi.org/project/youcom-haystack)
31
+
32
+ - [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/youcom/CHANGELOG.md)
33
+
34
+ ---
35
+
36
+ ## Usage
37
+
38
+ `YouComWebSearch` runs without any configuration: with no API key available it uses the You.com
39
+ [keyless free tier](https://you.com/docs/api-reference/search/v1-agents-search) (rate limited per IP).
40
+ Set the `YOUDOTCOM_API_KEY` environment variable to use the keyed
41
+ [You.com Search API](https://you.com/docs/api-reference/search/v1-search) with higher limits.
42
+
43
+ ```python
44
+ from haystack_integrations.components.websearch.youcom import YouComWebSearch
45
+
46
+ websearch = YouComWebSearch(top_k=5)
47
+ result = websearch.run(query="What is Haystack by deepset?")
48
+ result["documents"] # list[Document]
49
+ result["links"] # list[str]
50
+ ```
51
+
52
+ To require a key instead of silently degrading to the keyless tier, pass `keyless_fallback=False`;
53
+ the component then raises `YouComError` when no key resolves.
54
+
55
+ ## Contributing
56
+
57
+ Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
58
+
59
+ The unit tests are fully mocked and need no credentials. The integration tests include one live keyless
60
+ search that needs no key; to also run the keyed tests, export the `YOUDOTCOM_API_KEY` environment variable.
@@ -0,0 +1,7 @@
1
+ haystack_integrations/components/websearch/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ haystack_integrations/components/websearch/youcom/__init__.py,sha256=Q1C0EgHd49zTFC6MotAO-jsY3eRbz6SmrQIXpZtPPQM,265
3
+ haystack_integrations/components/websearch/youcom/youcom_websearch.py,sha256=0qDy_bJlDRhsGw1oDkqb_2eaG5Qgb-UGydCUUCdcJrM,11724
4
+ youcom_haystack-0.0.1.dist-info/METADATA,sha256=ac-Jff7MNQbnffOrv_06TMRJV8V6_U78zzoSdarlnHE,2823
5
+ youcom_haystack-0.0.1.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
6
+ youcom_haystack-0.0.1.dist-info/licenses/LICENSE.txt,sha256=OrAtTu4aPmrTjKDSTzkSPgo_ji6NOMWO2N9JOTFyAzM,11350
7
+ youcom_haystack-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2023-present deepset GmbH
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.