monty-haystack 1.0.0__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.
- haystack_integrations/tools/monty/__init__.py +7 -0
- haystack_integrations/tools/monty/python_tool.py +223 -0
- haystack_integrations/tools/py.typed +0 -0
- monty_haystack-1.0.0.dist-info/METADATA +38 -0
- monty_haystack-1.0.0.dist-info/RECORD +7 -0
- monty_haystack-1.0.0.dist-info/WHEEL +4 -0
- monty_haystack-1.0.0.dist-info/licenses/LICENSE.txt +201 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
import threading
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from haystack.core.serialization import generate_qualified_class_name
|
|
9
|
+
from haystack.tools import Tool
|
|
10
|
+
from pydantic_monty import (
|
|
11
|
+
CollectString,
|
|
12
|
+
Monty,
|
|
13
|
+
MontyCrashedError,
|
|
14
|
+
MontyRuntimeError,
|
|
15
|
+
MontySyntaxError,
|
|
16
|
+
MontyTypingError,
|
|
17
|
+
ResourceLimits,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
_DEFAULT_RESOURCE_LIMITS: ResourceLimits = {"max_feed_duration_secs": 30.0, "max_memory": 256 * 1024 * 1024}
|
|
21
|
+
|
|
22
|
+
_DEFAULT_DESCRIPTION = (
|
|
23
|
+
"Run Python code in an isolated sandbox and get back what it printed and the value of its last expression. "
|
|
24
|
+
"Use it for calculations, data processing, and anything else that is more reliable to compute than to guess.\n"
|
|
25
|
+
"- Every call starts a fresh interpreter: variables, functions, and imports from earlier calls are gone, so each "
|
|
26
|
+
"snippet must be self-contained.\n"
|
|
27
|
+
"- The sandbox has no file system, network, environment variables, or subprocesses, and no third-party packages. "
|
|
28
|
+
"Only these standard library modules can be imported, some of them partially: asyncio, base64, binascii, "
|
|
29
|
+
"collections, copy, dataclasses, datetime, functools, itertools, json, math, random, re, sys, time, typing, "
|
|
30
|
+
"unicodedata.\n"
|
|
31
|
+
"- The interpreter supports a subset of Python: functions, lambdas, closures, comprehensions, simple classes, "
|
|
32
|
+
"dataclasses, try/except, f-strings, and async/await. Class inheritance (including custom exception classes), "
|
|
33
|
+
"generators (`yield`), `match`, `del`, and method decorators such as `@property` or `@staticmethod` are not "
|
|
34
|
+
"supported.\n"
|
|
35
|
+
"- Use `print()` for intermediate output. Errors come back as a traceback, so you can fix the code and retry."
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _truncate(text: str, max_chars: int, *, keep_tail: bool = False) -> str:
|
|
40
|
+
if len(text) <= max_chars:
|
|
41
|
+
return text
|
|
42
|
+
note = f"[... {len(text) - max_chars} characters truncated]"
|
|
43
|
+
if keep_tail:
|
|
44
|
+
return f"{note}\n{text[-max_chars:]}"
|
|
45
|
+
return f"{text[:max_chars]}\n{note}"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _format_output(*, output: str, result: Any, error: str | None, max_chars: int) -> str:
|
|
49
|
+
"""Render the printed output, the final expression value, and any error as text for the LLM."""
|
|
50
|
+
sections = []
|
|
51
|
+
if output:
|
|
52
|
+
sections.append(f"output:\n{_truncate(output.rstrip(), max_chars)}")
|
|
53
|
+
if result is not None:
|
|
54
|
+
sections.append(f"result:\n{_truncate(repr(result), max_chars)}")
|
|
55
|
+
if error is not None:
|
|
56
|
+
# The exception type and message are on the last line of a traceback, so keep the tail
|
|
57
|
+
sections.append(f"error:\n{_truncate(error, max_chars, keep_tail=True)}")
|
|
58
|
+
return "\n\n".join(sections) or "The code ran successfully and produced no output."
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class MontyPythonTool(Tool):
|
|
62
|
+
"""
|
|
63
|
+
A Haystack `Tool` that lets an `Agent` run Python code in a [Monty](https://pydantic.dev/docs/monty/) sandbox.
|
|
64
|
+
|
|
65
|
+
Monty is a minimal Python interpreter written in Rust. The tool keeps a pool of Monty worker processes and runs
|
|
66
|
+
every call in a fresh interpreter, so nothing leaks between calls, users, or concurrent tool invocations. The
|
|
67
|
+
tool returns what the code printed, the `repr()` of its last expression, and any error as a traceback, so the
|
|
68
|
+
LLM can read the result and fix its code.
|
|
69
|
+
|
|
70
|
+
### Security model
|
|
71
|
+
|
|
72
|
+
Monty is a language-level sandbox: its interpreter implements no operation that reaches the host, so code has
|
|
73
|
+
no access to files, the network, environment variables, or subprocesses. It runs in worker subprocesses started
|
|
74
|
+
with an empty environment, so a crash never takes down the host process. The tool mounts no directories and
|
|
75
|
+
exposes no host functions to the sandbox. Execution time and heap memory are capped by `resource_limits`.
|
|
76
|
+
|
|
77
|
+
### Usage example
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from haystack.components.agents import Agent
|
|
81
|
+
from haystack.components.generators.chat import OpenAIChatGenerator
|
|
82
|
+
from haystack.dataclasses import ChatMessage
|
|
83
|
+
from haystack_integrations.tools.monty import MontyPythonTool
|
|
84
|
+
|
|
85
|
+
# Requires the OPENAI_API_KEY environment variable
|
|
86
|
+
agent = Agent(chat_generator=OpenAIChatGenerator(), tools=[MontyPythonTool()])
|
|
87
|
+
result = agent.run(messages=[ChatMessage.from_user("What is the sum of the first 100 prime numbers?")])
|
|
88
|
+
print(result["last_message"].text)
|
|
89
|
+
# >> The sum of the first 100 prime numbers is 24133.
|
|
90
|
+
```
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
def __init__(
|
|
94
|
+
self,
|
|
95
|
+
*,
|
|
96
|
+
name: str = "run_python",
|
|
97
|
+
description: str | None = None,
|
|
98
|
+
resource_limits: ResourceLimits | None = None,
|
|
99
|
+
type_check: bool = False,
|
|
100
|
+
max_output_chars: int = 20_000,
|
|
101
|
+
) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Create a MontyPythonTool.
|
|
104
|
+
|
|
105
|
+
:param name: Tool name exposed to the LLM.
|
|
106
|
+
:param description: Tool description exposed to the LLM. If `None`, a description of the sandbox and the
|
|
107
|
+
supported Python subset is used.
|
|
108
|
+
:param resource_limits: Monty resource limits for each call, merged over the defaults of 30 seconds of
|
|
109
|
+
execution time (`max_feed_duration_secs`) and 256 MiB of heap memory (`max_memory`). Set a key to `None`
|
|
110
|
+
to disable that limit. See `pydantic_monty.ResourceLimits` for the available keys.
|
|
111
|
+
:param type_check: If `True`, type-check the code with Monty's bundled type checker before running it, and
|
|
112
|
+
return type errors to the LLM instead of executing the code.
|
|
113
|
+
:param max_output_chars: Maximum number of characters kept from each of the printed output, the result, and
|
|
114
|
+
the error before they are returned to the LLM. The output and the result keep their beginning, the error
|
|
115
|
+
keeps its end, where the exception is.
|
|
116
|
+
:raises ValueError: If `resource_limits` contains a key that Monty doesn't support, or `max_output_chars` is
|
|
117
|
+
less than 1.
|
|
118
|
+
"""
|
|
119
|
+
unknown_limits = set(resource_limits or {}) - set(ResourceLimits.__annotations__)
|
|
120
|
+
if unknown_limits:
|
|
121
|
+
msg = (
|
|
122
|
+
f"Unknown resource limits: {sorted(unknown_limits)}. "
|
|
123
|
+
f"Supported keys are: {sorted(ResourceLimits.__annotations__)}."
|
|
124
|
+
)
|
|
125
|
+
raise ValueError(msg)
|
|
126
|
+
if max_output_chars < 1:
|
|
127
|
+
msg = f"max_output_chars must be at least 1, got {max_output_chars}."
|
|
128
|
+
raise ValueError(msg)
|
|
129
|
+
|
|
130
|
+
self._resource_limits: ResourceLimits = {**_DEFAULT_RESOURCE_LIMITS}
|
|
131
|
+
self._resource_limits.update(resource_limits or {})
|
|
132
|
+
self._type_check = type_check
|
|
133
|
+
self._max_output_chars = max_output_chars
|
|
134
|
+
self._pool: Monty | None = None
|
|
135
|
+
self._pool_lock = threading.Lock()
|
|
136
|
+
|
|
137
|
+
parameters = {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"code": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "The Python code to run. The value of the last expression is returned.",
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"required": ["code"],
|
|
146
|
+
}
|
|
147
|
+
super().__init__(
|
|
148
|
+
name=name,
|
|
149
|
+
description=description or _DEFAULT_DESCRIPTION,
|
|
150
|
+
parameters=parameters,
|
|
151
|
+
function=self._invoke,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def warm_up(self) -> None:
|
|
155
|
+
"""Start the pool of Monty worker processes. Called by `Agent.warm_up()`; safe to call more than once."""
|
|
156
|
+
self._get_pool()
|
|
157
|
+
|
|
158
|
+
def close(self) -> None:
|
|
159
|
+
"""
|
|
160
|
+
Shut down the pool of Monty worker processes.
|
|
161
|
+
|
|
162
|
+
Safe to call more than once. The tool starts a new pool if it is invoked again.
|
|
163
|
+
"""
|
|
164
|
+
with self._pool_lock:
|
|
165
|
+
if self._pool is not None:
|
|
166
|
+
self._pool.__exit__(None, None, None)
|
|
167
|
+
self._pool = None
|
|
168
|
+
|
|
169
|
+
def _get_pool(self) -> Monty:
|
|
170
|
+
with self._pool_lock:
|
|
171
|
+
if self._pool is None:
|
|
172
|
+
pool = Monty()
|
|
173
|
+
# Monty only exposes its pool lifecycle as a context manager. The tool keeps the pool open across
|
|
174
|
+
# calls, so it enters the context here and exits it in `close()`.
|
|
175
|
+
pool.__enter__()
|
|
176
|
+
self._pool = pool
|
|
177
|
+
return self._pool
|
|
178
|
+
|
|
179
|
+
def _invoke(self, code: str) -> str:
|
|
180
|
+
pool = self._get_pool()
|
|
181
|
+
collector = CollectString()
|
|
182
|
+
result = None
|
|
183
|
+
error = None
|
|
184
|
+
try:
|
|
185
|
+
with pool.checkout(limits=self._resource_limits, type_check=self._type_check) as session:
|
|
186
|
+
result = session.feed_run(code, print_callback=collector)
|
|
187
|
+
except (MontySyntaxError, MontyRuntimeError, MontyTypingError) as e:
|
|
188
|
+
error = e.display()
|
|
189
|
+
except MontyCrashedError as e:
|
|
190
|
+
# Code stuck inside a long-running builtin, such as a huge integer power, can't be interrupted by the
|
|
191
|
+
# sandbox's own time limit; the pool then kills the worker and replaces it.
|
|
192
|
+
if e.timed_out:
|
|
193
|
+
error = f"TimeoutError: the code exceeded the time limit and the sandbox was stopped ({e})"
|
|
194
|
+
else:
|
|
195
|
+
error = f"The sandbox process crashed and was restarted ({e})"
|
|
196
|
+
return _format_output(output=collector.output, result=result, error=error, max_chars=self._max_output_chars)
|
|
197
|
+
|
|
198
|
+
def to_dict(self) -> dict[str, Any]:
|
|
199
|
+
"""
|
|
200
|
+
Serialize the tool to a dictionary.
|
|
201
|
+
|
|
202
|
+
:returns: Dictionary with serialized data.
|
|
203
|
+
"""
|
|
204
|
+
return {
|
|
205
|
+
"type": generate_qualified_class_name(type(self)),
|
|
206
|
+
"data": {
|
|
207
|
+
"name": self.name,
|
|
208
|
+
"description": self.description,
|
|
209
|
+
"resource_limits": self._resource_limits,
|
|
210
|
+
"type_check": self._type_check,
|
|
211
|
+
"max_output_chars": self._max_output_chars,
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@classmethod
|
|
216
|
+
def from_dict(cls, data: dict[str, Any]) -> "MontyPythonTool":
|
|
217
|
+
"""
|
|
218
|
+
Deserialize the tool from a dictionary.
|
|
219
|
+
|
|
220
|
+
:param data: Dictionary to deserialize from.
|
|
221
|
+
:returns: Deserialized tool.
|
|
222
|
+
"""
|
|
223
|
+
return cls(**data["data"])
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: monty-haystack
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Sandboxed Python code execution tool for Haystack Agents, powered by Pydantic Monty
|
|
5
|
+
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/monty#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/monty
|
|
8
|
+
Author-email: deepset GmbH <info@deepset.ai>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE.txt
|
|
11
|
+
Keywords: agents,code-execution,haystack,monty,pydantic,sandbox,tools
|
|
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
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: haystack-ai>=3.0.0
|
|
23
|
+
Requires-Dist: pydantic-monty>=1.0.0
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# monty-haystack
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/monty-haystack)
|
|
29
|
+
[](https://pypi.org/project/monty-haystack)
|
|
30
|
+
|
|
31
|
+
- [Integration page](https://haystack.deepset.ai/integrations/monty)
|
|
32
|
+
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/monty/CHANGELOG.md)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Contributing
|
|
37
|
+
|
|
38
|
+
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
haystack_integrations/tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
haystack_integrations/tools/monty/__init__.py,sha256=Io9VQ-1Pu6Tna-bCsbZ1dm7rgWSanA_HDRF-V8z_TSM,216
|
|
3
|
+
haystack_integrations/tools/monty/python_tool.py,sha256=-Jrh57t1lq1I_7RWY78SxgGZzPjmFelN16DflSLf64U,10043
|
|
4
|
+
monty_haystack-1.0.0.dist-info/METADATA,sha256=xTj95d0or5gsiJxBbC2KRh3UREnHmdtTxkMTpaMhtF4,1843
|
|
5
|
+
monty_haystack-1.0.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
6
|
+
monty_haystack-1.0.0.dist-info/licenses/LICENSE.txt,sha256=OrAtTu4aPmrTjKDSTzkSPgo_ji6NOMWO2N9JOTFyAzM,11350
|
|
7
|
+
monty_haystack-1.0.0.dist-info/RECORD,,
|
|
@@ -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.
|