provared-langchain 0.1.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.
- provared_langchain/__init__.py +276 -0
- provared_langchain-0.1.0.dist-info/METADATA +165 -0
- provared_langchain-0.1.0.dist-info/RECORD +7 -0
- provared_langchain-0.1.0.dist-info/WHEEL +5 -0
- provared_langchain-0.1.0.dist-info/licenses/LICENSE +202 -0
- provared_langchain-0.1.0.dist-info/licenses/LICENSE-CC-BY-4.0.txt +396 -0
- provared_langchain-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# A LangChain middleware that puts every tool call of an agent behind
|
|
2
|
+
# Provared's stub writer.
|
|
3
|
+
#
|
|
4
|
+
# Each call asks the check before acting first, runs the tool only if the
|
|
5
|
+
# person's slip allows the action, and leaves a signed stub that names the
|
|
6
|
+
# fingerprint of the call's arguments. A call that the slip does not allow
|
|
7
|
+
# is not run, and the model is told why, as the tool's answer.
|
|
8
|
+
#
|
|
9
|
+
# It uses only the public interface of the "provared" package (record_tools,
|
|
10
|
+
# NotTaken, Refusal) and LangChain's own middleware hooks.
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import contextvars
|
|
14
|
+
import threading
|
|
15
|
+
import warnings
|
|
16
|
+
from collections.abc import Mapping
|
|
17
|
+
|
|
18
|
+
import pydantic
|
|
19
|
+
from langchain.agents.middleware import AgentMiddleware
|
|
20
|
+
from langchain_core.messages import ToolMessage
|
|
21
|
+
from provared import NotTaken, Refusal, record_tools
|
|
22
|
+
|
|
23
|
+
__all__ = ['ProvaredMiddleware']
|
|
24
|
+
__version__ = '0.1.0'
|
|
25
|
+
|
|
26
|
+
_UNLISTED = ('refuse', 'run')
|
|
27
|
+
_MEMBERS = ('action', 'with', 'amount', 'details', 'countersign', 'approve')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class _ToolAnsweredWithError(Exception):
|
|
31
|
+
"""The tool answered with an error: it did not do what was asked, so its
|
|
32
|
+
stub is not written. The answer is handed back to the model as it is."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, answer):
|
|
35
|
+
super().__init__('the tool answered with an error')
|
|
36
|
+
self.answer = answer
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ProvaredMiddleware(AgentMiddleware):
|
|
40
|
+
"""Records every tool call of a LangChain agent with Provared.
|
|
41
|
+
|
|
42
|
+
writer: the stub writer (provared.open_recorder), for the slip the
|
|
43
|
+
person signed for this agent.
|
|
44
|
+
tools: a dict of the agent's tools by name. For each tool, the action
|
|
45
|
+
name the slip uses for what it does, or a dict as for a tool of
|
|
46
|
+
provared.record_tools, without "run": "action", and where they apply
|
|
47
|
+
"with", "amount", "details", "countersign" and "approve".
|
|
48
|
+
unlisted: what to do with a call of a tool that is not in "tools":
|
|
49
|
+
"refuse" (the default: the tool is not run, the model is told so, and
|
|
50
|
+
a RuntimeWarning is given) or "run" (the tool is run, and no stub is
|
|
51
|
+
written).
|
|
52
|
+
on_stub: a function of the stub and the tool's name, called after each
|
|
53
|
+
stub is written, for example to keep the book.
|
|
54
|
+
|
|
55
|
+
It must come last among the middleware that wrap tool calls, so that
|
|
56
|
+
nothing between it and the tool can change the call or answer in the
|
|
57
|
+
tool's place; otherwise the first call raises provared.Refusal.
|
|
58
|
+
|
|
59
|
+
A call's arguments are first checked against the tool's schema, as
|
|
60
|
+
LangChain would check them, and written in their JSON form: that form
|
|
61
|
+
is what is fingerprinted, what the functions above are handed, and
|
|
62
|
+
what the tool is run with. A call that does not fit the schema, that
|
|
63
|
+
the slip does not allow, or that cannot be recorded, is not run: the
|
|
64
|
+
model is handed a failed tool answer that says why. A tool that answers
|
|
65
|
+
with an error, or raises, leaves no stub; its exception is passed on.
|
|
66
|
+
Raises provared.Refusal, "bad-field", if a tool is not described as set
|
|
67
|
+
out above."""
|
|
68
|
+
|
|
69
|
+
def __init__(self, writer, tools, *, unlisted='refuse', on_stub=None):
|
|
70
|
+
super().__init__()
|
|
71
|
+
self._recorded, self._handler = _described(writer, tools, unlisted, on_stub, 'middleware')
|
|
72
|
+
self._unlisted = unlisted
|
|
73
|
+
|
|
74
|
+
def wrap_tool_call(self, request, handler):
|
|
75
|
+
_must_be_last(handler)
|
|
76
|
+
tool = self._recorded.get(request.tool_call['name'])
|
|
77
|
+
if tool is None:
|
|
78
|
+
return handler(request) if self._unlisted == 'run' else _undescribed(request)
|
|
79
|
+
args = _checked(request)
|
|
80
|
+
if isinstance(args, ToolMessage):
|
|
81
|
+
return args
|
|
82
|
+
ran = []
|
|
83
|
+
|
|
84
|
+
def run(copy):
|
|
85
|
+
ran.append(True)
|
|
86
|
+
return _answered(handler(_with_args(request, copy)), request.tool_call['id'])
|
|
87
|
+
|
|
88
|
+
return self._recorded_call(request, tool, args, run, ran)
|
|
89
|
+
|
|
90
|
+
async def awrap_tool_call(self, request, handler):
|
|
91
|
+
_must_be_last(handler)
|
|
92
|
+
tool = self._recorded.get(request.tool_call['name'])
|
|
93
|
+
if tool is None:
|
|
94
|
+
return (await handler(request)) if self._unlisted == 'run' else _undescribed(request)
|
|
95
|
+
args = _checked(request)
|
|
96
|
+
if isinstance(args, ToolMessage):
|
|
97
|
+
return args
|
|
98
|
+
call = _OnTheLoop(asyncio.get_running_loop())
|
|
99
|
+
|
|
100
|
+
def run(copy):
|
|
101
|
+
return _answered(call.run_tool(lambda: handler(_with_args(request, copy))), request.tool_call['id'])
|
|
102
|
+
|
|
103
|
+
return await call.run_writer(lambda: self._recorded_call(request, tool, args, run, call.ran))
|
|
104
|
+
|
|
105
|
+
def _recorded_call(self, request, tool, args, run, ran):
|
|
106
|
+
token = self._handler.set(run)
|
|
107
|
+
try:
|
|
108
|
+
return tool(args)
|
|
109
|
+
except (NotTaken, Refusal) as e:
|
|
110
|
+
# Raised by the tool itself, once it was run: passed on, as any error of the tool.
|
|
111
|
+
if ran:
|
|
112
|
+
raise
|
|
113
|
+
return _not_run(request, e.message) if isinstance(e, Refusal) else _failed(request, e.message)
|
|
114
|
+
except _ToolAnsweredWithError as e:
|
|
115
|
+
return e.answer
|
|
116
|
+
finally:
|
|
117
|
+
self._handler.reset(token)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class _OnTheLoop:
|
|
121
|
+
"""One recorded call in an asynchronous agent. The stub writer is an
|
|
122
|
+
ordinary function that may wait, so it is run in a thread of its own,
|
|
123
|
+
not one of the event loop's shared threads, which the tool itself may
|
|
124
|
+
need. The tool is run on the event loop, in the context of that thread,
|
|
125
|
+
which carries the writer's mark, so a tool that calls the writer is
|
|
126
|
+
refused at once. Cancelling the call cancels the tool, as it would
|
|
127
|
+
without the writer: no stub is written, and the writer goes on."""
|
|
128
|
+
|
|
129
|
+
def __init__(self, loop):
|
|
130
|
+
self._loop = loop
|
|
131
|
+
self._guard = threading.Lock()
|
|
132
|
+
self._tool = None
|
|
133
|
+
self._cancelled = False
|
|
134
|
+
self.ran = []
|
|
135
|
+
|
|
136
|
+
def run_tool(self, start):
|
|
137
|
+
with self._guard:
|
|
138
|
+
if self._cancelled:
|
|
139
|
+
raise RuntimeError('The call was cancelled before the tool ran.')
|
|
140
|
+
coroutine = start()
|
|
141
|
+
try:
|
|
142
|
+
self._tool = asyncio.run_coroutine_threadsafe(coroutine, self._loop)
|
|
143
|
+
except BaseException:
|
|
144
|
+
coroutine.close()
|
|
145
|
+
raise
|
|
146
|
+
self.ran.append(True)
|
|
147
|
+
return self._tool.result()
|
|
148
|
+
|
|
149
|
+
async def run_writer(self, work):
|
|
150
|
+
future = self._loop.create_future()
|
|
151
|
+
context = contextvars.copy_context()
|
|
152
|
+
|
|
153
|
+
def settle(value, error):
|
|
154
|
+
if future.done():
|
|
155
|
+
return
|
|
156
|
+
if error is None:
|
|
157
|
+
future.set_result(value)
|
|
158
|
+
else:
|
|
159
|
+
future.set_exception(error)
|
|
160
|
+
|
|
161
|
+
def job():
|
|
162
|
+
value, error = None, None
|
|
163
|
+
try:
|
|
164
|
+
value = context.run(work)
|
|
165
|
+
except Exception as e:
|
|
166
|
+
error = e
|
|
167
|
+
except BaseException as e: # noqa: BLE001
|
|
168
|
+
error = RuntimeError(f'The stub writer stopped with {type(e).__name__}.')
|
|
169
|
+
try:
|
|
170
|
+
self._loop.call_soon_threadsafe(settle, value, error)
|
|
171
|
+
except RuntimeError:
|
|
172
|
+
pass # the event loop has closed
|
|
173
|
+
|
|
174
|
+
threading.Thread(target=job, daemon=True, name='provared-writer').start()
|
|
175
|
+
try:
|
|
176
|
+
return await future
|
|
177
|
+
except asyncio.CancelledError:
|
|
178
|
+
with self._guard:
|
|
179
|
+
self._cancelled = True
|
|
180
|
+
if self._tool is not None:
|
|
181
|
+
self._tool.cancel()
|
|
182
|
+
raise
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _described(writer, tools, unlisted, on_stub, what):
|
|
186
|
+
"""Each tool's description, checked and fixed: a mistake shows when the agent is built."""
|
|
187
|
+
if not isinstance(tools, Mapping):
|
|
188
|
+
raise Refusal('bad-field', 'tools: must be a dict of the tools by name.')
|
|
189
|
+
if unlisted not in _UNLISTED:
|
|
190
|
+
raise Refusal('bad-field', 'unlisted: must be "refuse" or "run".')
|
|
191
|
+
handler = contextvars.ContextVar(f'provared_{what}_{id(tools)}')
|
|
192
|
+
described = {}
|
|
193
|
+
for name, spec in tools.items():
|
|
194
|
+
if isinstance(spec, str):
|
|
195
|
+
spec = {'action': spec}
|
|
196
|
+
if not isinstance(spec, Mapping):
|
|
197
|
+
raise Refusal('bad-field', f'tools.{name}: must be an action name, or a dict that describes the tool.')
|
|
198
|
+
for member in spec:
|
|
199
|
+
if member == 'run':
|
|
200
|
+
raise Refusal('bad-field', f'tools.{name}.run: is not given here. The {what} runs the tool that the framework calls.')
|
|
201
|
+
if member not in _MEMBERS:
|
|
202
|
+
hint = ' (write "with", not "with_")' if member == 'with_' else ''
|
|
203
|
+
raise Refusal('bad-field', f'tools.{name}.{member}: is not a member of a tool\'s description{hint}. They are: {", ".join(_MEMBERS)}.')
|
|
204
|
+
described[name] = {**spec, 'run': lambda args: handler.get()(args)}
|
|
205
|
+
return record_tools(writer, described, on_stub=on_stub), handler
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def _must_be_last(handler):
|
|
209
|
+
# When another middleware that wraps tool calls comes after this one,
|
|
210
|
+
# LangChain hands this one a function of its own chain, not the tool.
|
|
211
|
+
if getattr(handler, '__module__', None) == 'langchain.agents.factory' and getattr(handler, '__qualname__', '').endswith('.call_inner'):
|
|
212
|
+
raise Refusal('bad-field', 'middleware: ProvaredMiddleware must come last among the middleware that wrap tool calls, '
|
|
213
|
+
'so that nothing between it and the tool can change the call. Move it to the end of the list.')
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def _checked(request):
|
|
217
|
+
"""The arguments, checked against the tool's schema as LangChain checks
|
|
218
|
+
them, in their JSON form; or the failed answer where they do not fit."""
|
|
219
|
+
args = request.tool_call['args']
|
|
220
|
+
schema = getattr(request.tool, 'tool_call_schema', None) if request.tool is not None else None
|
|
221
|
+
if not (isinstance(schema, type) and issubclass(schema, pydantic.BaseModel)):
|
|
222
|
+
return args
|
|
223
|
+
try:
|
|
224
|
+
return schema.model_validate(args).model_dump(mode='json')
|
|
225
|
+
except pydantic.ValidationError as e:
|
|
226
|
+
found = '; '.join(f"{'.'.join(str(p) for p in error['loc']) or 'the arguments'}: {error['msg']}" for error in e.errors())
|
|
227
|
+
return _not_run(request, f'Its arguments do not fit what the tool takes ({found}).')
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _undescribed(request):
|
|
231
|
+
name = request.tool_call['name']
|
|
232
|
+
warnings.warn(f'ProvaredMiddleware: the agent called the tool "{name}", which is not described to it, so it was not run.',
|
|
233
|
+
RuntimeWarning, stacklevel=3)
|
|
234
|
+
return _not_run(request, 'Provared records no tool of that name.')
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _with_args(request, args):
|
|
238
|
+
"""The request, with the copy of the arguments that was fingerprinted."""
|
|
239
|
+
return request.override(tool_call={**request.tool_call, 'args': args})
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def _answered(answer, call_id):
|
|
243
|
+
"""The tool's answer; raises where it is an error, given as a message or
|
|
244
|
+
as a Command whose update holds the error message for this call."""
|
|
245
|
+
if isinstance(answer, ToolMessage):
|
|
246
|
+
failed = answer.status == 'error'
|
|
247
|
+
else:
|
|
248
|
+
failed = any(isinstance(m, ToolMessage) and m.status == 'error' and m.tool_call_id == call_id for m in _messages_of(answer))
|
|
249
|
+
if failed:
|
|
250
|
+
raise _ToolAnsweredWithError(answer)
|
|
251
|
+
return answer
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def _messages_of(command):
|
|
255
|
+
"""The messages that a Command's update holds, in any of the forms LangGraph takes."""
|
|
256
|
+
update = getattr(command, 'update', None)
|
|
257
|
+
if isinstance(update, dict):
|
|
258
|
+
pairs = update.items()
|
|
259
|
+
elif isinstance(update, (list, tuple)):
|
|
260
|
+
pairs = [pair for pair in update if isinstance(pair, tuple) and len(pair) == 2]
|
|
261
|
+
else:
|
|
262
|
+
pairs = [('messages', getattr(update, 'messages', None))]
|
|
263
|
+
found = []
|
|
264
|
+
for key, value in pairs:
|
|
265
|
+
if key == 'messages':
|
|
266
|
+
found.extend(value if isinstance(value, (list, tuple)) else [value])
|
|
267
|
+
return found
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def _failed(request, message):
|
|
271
|
+
call = request.tool_call
|
|
272
|
+
return ToolMessage(content=message, name=call['name'], tool_call_id=call['id'], status='error')
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def _not_run(request, why):
|
|
276
|
+
return _failed(request, f'The tool "{request.tool_call["name"]}" was not run. {why}')
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: provared-langchain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A LangChain middleware that checks each tool call of an agent against the permission a person signed, and records it with Provared. Evidence, not a verdict.
|
|
5
|
+
Author: Pavel Izmaylov
|
|
6
|
+
License-Expression: Apache-2.0 AND CC-BY-4.0
|
|
7
|
+
Project-URL: Source, https://github.com/provared/provared
|
|
8
|
+
Project-URL: Documentation, https://github.com/provared/provared/tree/main/python/integrations/provared-langchain
|
|
9
|
+
Project-URL: Issues, https://github.com/provared/provared/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Security :: Cryptography
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: LICENSE-CC-BY-4.0.txt
|
|
17
|
+
Requires-Dist: provared>=0.2.0
|
|
18
|
+
Requires-Dist: langchain<2,>=1.4
|
|
19
|
+
Requires-Dist: langchain-core<2,>=1.6
|
|
20
|
+
Requires-Dist: pydantic>=2
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# provared-langchain
|
|
24
|
+
|
|
25
|
+
A LangChain middleware that checks each tool call of an agent against
|
|
26
|
+
the permission a person signed, runs the tool only if the permission
|
|
27
|
+
allows it, and records the call with
|
|
28
|
+
[Provared](https://github.com/provared/provared).
|
|
29
|
+
|
|
30
|
+
*Evidence, not a verdict.*
|
|
31
|
+
|
|
32
|
+
**Version 0.1.0, a draft**, as Provared itself is. Published as it is, by
|
|
33
|
+
one author in their own time; fixes as time allows.
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
Provared is a way to prove what an AI agent was allowed to do, and what
|
|
38
|
+
it then did. A person signs a **slip** with a passkey: which agent, which
|
|
39
|
+
actions, which limits, until when. Beside the agent, Provared's stub
|
|
40
|
+
writer checks each action against the slip before it is taken and, if it
|
|
41
|
+
is allowed, writes a signed **stub** for it into a book that anyone can
|
|
42
|
+
check later.
|
|
43
|
+
|
|
44
|
+
`ProvaredMiddleware` puts every tool call of a LangChain agent
|
|
45
|
+
(`create_agent`) behind that stub writer:
|
|
46
|
+
|
|
47
|
+
- **Allowed:** the tool runs, and a stub is written. The stub names the
|
|
48
|
+
action, the amount and the other party where they apply, and the
|
|
49
|
+
SHA-256 fingerprint of the call's arguments, so the record fixes
|
|
50
|
+
exactly what was asked for without holding it.
|
|
51
|
+
- **Not allowed** (over a limit, an action the slip does not name, after
|
|
52
|
+
the slip ends or was cancelled): the tool is not run, nothing is
|
|
53
|
+
written, and the model is handed a failed tool answer that says why,
|
|
54
|
+
for example: `The tool "order_supplies" was not run. With this action
|
|
55
|
+
the total would be 280 GBP. The slip's limit is 100 GBP: over by 180.`
|
|
56
|
+
- **A tool that is not described** to the middleware is not run either,
|
|
57
|
+
unless you pass `unlisted="run"`: the model is told, and Python gives a
|
|
58
|
+
`RuntimeWarning`, so that a misspelt name shows.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
pip install provared-langchain
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
You need Python 3.11 or later. It installs `provared`, `langchain`,
|
|
67
|
+
`langchain-core` and `pydantic`.
|
|
68
|
+
|
|
69
|
+
## Use
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from langchain.agents import create_agent
|
|
73
|
+
from provared import open_recorder
|
|
74
|
+
from provared_langchain import ProvaredMiddleware
|
|
75
|
+
|
|
76
|
+
# The stub writer, on the book that holds the person's signed slip.
|
|
77
|
+
writer = open_recorder(book_text, slip_fingerprint, agent_private_keys, issuer_keys=[passkey_thumbprint])
|
|
78
|
+
|
|
79
|
+
# Last in the list: any middleware that wraps tool calls goes before it.
|
|
80
|
+
agent = create_agent(model, tools=[order_supplies, send_message], middleware=[
|
|
81
|
+
ProvaredMiddleware(writer, {
|
|
82
|
+
'order_supplies': {'action': 'supplies.order', 'with': 'supplier',
|
|
83
|
+
'amount': lambda args: {'unit': 'GBP', 'value': args['total_gbp']}},
|
|
84
|
+
'send_message': 'provared.message.send',
|
|
85
|
+
}),
|
|
86
|
+
])
|
|
87
|
+
|
|
88
|
+
agent.invoke({'messages': [{'role': 'user', 'content': 'Order paper.'}]})
|
|
89
|
+
book_text, held = writer.snapshot() # keep both together
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For each tool, give the action name the slip uses for it, or a dict as
|
|
93
|
+
for `provared.record_tools`, without `run`: `action`, and where they apply
|
|
94
|
+
`with`, `amount`, `details`, `countersign` and `approve`. Each is checked
|
|
95
|
+
when the middleware is made, so a mistake in a description, such as a
|
|
96
|
+
misspelt member, shows when the agent is built.
|
|
97
|
+
How to make a slip, a book and the agent's keys is in Provared's
|
|
98
|
+
[README](https://github.com/provared/provared/blob/main/README.md) and
|
|
99
|
+
[Python README](https://github.com/provared/provared/blob/main/python/README.md).
|
|
100
|
+
|
|
101
|
+
## What to know
|
|
102
|
+
|
|
103
|
+
- **It must come last** among the middleware that wrap tool calls (human
|
|
104
|
+
review, retries, error handling, caching): put those before it. Then a
|
|
105
|
+
reviewer's change, or each retry, is checked and recorded as the call
|
|
106
|
+
the tool receives, and nothing can answer in the tool's place after
|
|
107
|
+
the check. If it is not last, the first tool call raises
|
|
108
|
+
`provared.Refusal`.
|
|
109
|
+
- **The arguments are checked against the tool's schema first**, as
|
|
110
|
+
LangChain checks them, and written in their JSON form. That form is
|
|
111
|
+
what is fingerprinted, what the functions in a tool's description
|
|
112
|
+
(`amount`, `with` and so on) are handed, and what the tool is run
|
|
113
|
+
with; LangChain then reads it as it reads a model's arguments. So
|
|
114
|
+
`"30"` given for a whole number is recorded as `30`. A call that does
|
|
115
|
+
not fit is not run, and the model is told what is wrong.
|
|
116
|
+
- **No stub without a result.** A tool that raises leaves no stub, and
|
|
117
|
+
its error is passed on, as LangChain passes it on. A tool that answers
|
|
118
|
+
with an error leaves no stub either.
|
|
119
|
+
- **Ordinary and asynchronous agents** both work (`invoke` and
|
|
120
|
+
`ainvoke`). In an asynchronous agent the stub writer, an ordinary
|
|
121
|
+
function that may wait, runs in a thread of its own for each call, and
|
|
122
|
+
the tool runs on the event loop. Cancelling a run cancels a tool that
|
|
123
|
+
is waiting: no stub is written, and the writer goes on. An ordinary
|
|
124
|
+
tool that LangChain is already running in a thread cannot be stopped:
|
|
125
|
+
it finishes, and leaves no stub, because its call was cancelled.
|
|
126
|
+
- **In an asynchronous program, do not call the stub writer on the event
|
|
127
|
+
loop while an agent may be running**, not even `writer.snapshot()`: it
|
|
128
|
+
waits for the action it is taking, and that action needs the event
|
|
129
|
+
loop. Call it from a thread: `await asyncio.to_thread(writer.snapshot)`.
|
|
130
|
+
- **One call at a time.** The stub writer takes one call at a time and
|
|
131
|
+
holds it while the tool runs, so tools that LangChain would run side by
|
|
132
|
+
side run one after another.
|
|
133
|
+
- **A tool must not call the stub writer.** From the tool itself, such a
|
|
134
|
+
call is refused at once. From a thread that the tool starts without
|
|
135
|
+
its context, it waits until the tool ends, so the tool must not wait
|
|
136
|
+
for it.
|
|
137
|
+
- **It covers the tool calls that LangChain runs.** A tool that the
|
|
138
|
+
model's own service runs on its side, such as a built-in web search,
|
|
139
|
+
never reaches LangChain's tools and is not recorded.
|
|
140
|
+
- **A fingerprint can be guessed** where the arguments are few and easy
|
|
141
|
+
to guess, such as one short name.
|
|
142
|
+
- **What the record shows, and what it does not,** is set out in
|
|
143
|
+
Provared's README and its
|
|
144
|
+
[list of threats](https://github.com/provared/provared/blob/main/docs/threat-model.md).
|
|
145
|
+
In short: it shows what was recorded under a slip the person signed,
|
|
146
|
+
not what was left out, and not whether an action was wise or lawful.
|
|
147
|
+
|
|
148
|
+
## Tests
|
|
149
|
+
|
|
150
|
+
In a copy of the repository (the tests use the invented world in
|
|
151
|
+
`python/examples/`), from this folder, with LangChain and Provared
|
|
152
|
+
installed:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
PYTHONPATH=src python -m unittest discover -s tests
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The tests run an agent with LangChain's own stand-in model, scripted in
|
|
159
|
+
advance. No AI service is called, and a guard refuses any connection
|
|
160
|
+
outside the program while they run.
|
|
161
|
+
|
|
162
|
+
## Licences
|
|
163
|
+
|
|
164
|
+
As for the rest of the repository: the Apache License 2.0 for the code,
|
|
165
|
+
and Creative Commons Attribution 4.0 for this page.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
provared_langchain/__init__.py,sha256=3V9H-HZv10hLVpE-VJgsqrRaOH2FwNyiHve-6TDrYNI,11907
|
|
2
|
+
provared_langchain-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
3
|
+
provared_langchain-0.1.0.dist-info/licenses/LICENSE-CC-BY-4.0.txt,sha256=m6lVCtSEONCDbdqz2kgLO2n_oKrHt4eLWgA556tClBE,18657
|
|
4
|
+
provared_langchain-0.1.0.dist-info/METADATA,sha256=4FKoJ6UBaeno7_kL8Q8NW9nVjzv9snjBfwQp8Dj55jE,7781
|
|
5
|
+
provared_langchain-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
6
|
+
provared_langchain-0.1.0.dist-info/top_level.txt,sha256=vFYuBVK5-hBdelyzzYl3WQDU6CtzkEH61m_CR63ZdEs,19
|
|
7
|
+
provared_langchain-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
Attribution 4.0 International
|
|
2
|
+
|
|
3
|
+
=======================================================================
|
|
4
|
+
|
|
5
|
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
|
6
|
+
does not provide legal services or legal advice. Distribution of
|
|
7
|
+
Creative Commons public licenses does not create a lawyer-client or
|
|
8
|
+
other relationship. Creative Commons makes its licenses and related
|
|
9
|
+
information available on an "as-is" basis. Creative Commons gives no
|
|
10
|
+
warranties regarding its licenses, any material licensed under their
|
|
11
|
+
terms and conditions, or any related information. Creative Commons
|
|
12
|
+
disclaims all liability for damages resulting from their use to the
|
|
13
|
+
fullest extent possible.
|
|
14
|
+
|
|
15
|
+
Using Creative Commons Public Licenses
|
|
16
|
+
|
|
17
|
+
Creative Commons public licenses provide a standard set of terms and
|
|
18
|
+
conditions that creators and other rights holders may use to share
|
|
19
|
+
original works of authorship and other material subject to copyright
|
|
20
|
+
and certain other rights specified in the public license below. The
|
|
21
|
+
following considerations are for informational purposes only, are not
|
|
22
|
+
exhaustive, and do not form part of our licenses.
|
|
23
|
+
|
|
24
|
+
Considerations for licensors: Our public licenses are
|
|
25
|
+
intended for use by those authorized to give the public
|
|
26
|
+
permission to use material in ways otherwise restricted by
|
|
27
|
+
copyright and certain other rights. Our licenses are
|
|
28
|
+
irrevocable. Licensors should read and understand the terms
|
|
29
|
+
and conditions of the license they choose before applying it.
|
|
30
|
+
Licensors should also secure all rights necessary before
|
|
31
|
+
applying our licenses so that the public can reuse the
|
|
32
|
+
material as expected. Licensors should clearly mark any
|
|
33
|
+
material not subject to the license. This includes other CC-
|
|
34
|
+
licensed material, or material used under an exception or
|
|
35
|
+
limitation to copyright. More considerations for licensors:
|
|
36
|
+
wiki.creativecommons.org/Considerations_for_licensors
|
|
37
|
+
|
|
38
|
+
Considerations for the public: By using one of our public
|
|
39
|
+
licenses, a licensor grants the public permission to use the
|
|
40
|
+
licensed material under specified terms and conditions. If
|
|
41
|
+
the licensor's permission is not necessary for any reason--for
|
|
42
|
+
example, because of any applicable exception or limitation to
|
|
43
|
+
copyright--then that use is not regulated by the license. Our
|
|
44
|
+
licenses grant only permissions under copyright and certain
|
|
45
|
+
other rights that a licensor has authority to grant. Use of
|
|
46
|
+
the licensed material may still be restricted for other
|
|
47
|
+
reasons, including because others have copyright or other
|
|
48
|
+
rights in the material. A licensor may make special requests,
|
|
49
|
+
such as asking that all changes be marked or described.
|
|
50
|
+
Although not required by our licenses, you are encouraged to
|
|
51
|
+
respect those requests where reasonable. More considerations
|
|
52
|
+
for the public:
|
|
53
|
+
wiki.creativecommons.org/Considerations_for_licensees
|
|
54
|
+
|
|
55
|
+
=======================================================================
|
|
56
|
+
|
|
57
|
+
Creative Commons Attribution 4.0 International Public License
|
|
58
|
+
|
|
59
|
+
By exercising the Licensed Rights (defined below), You accept and agree
|
|
60
|
+
to be bound by the terms and conditions of this Creative Commons
|
|
61
|
+
Attribution 4.0 International Public License ("Public License"). To the
|
|
62
|
+
extent this Public License may be interpreted as a contract, You are
|
|
63
|
+
granted the Licensed Rights in consideration of Your acceptance of
|
|
64
|
+
these terms and conditions, and the Licensor grants You such rights in
|
|
65
|
+
consideration of benefits the Licensor receives from making the
|
|
66
|
+
Licensed Material available under these terms and conditions.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
Section 1 -- Definitions.
|
|
70
|
+
|
|
71
|
+
a. Adapted Material means material subject to Copyright and Similar
|
|
72
|
+
Rights that is derived from or based upon the Licensed Material
|
|
73
|
+
and in which the Licensed Material is translated, altered,
|
|
74
|
+
arranged, transformed, or otherwise modified in a manner requiring
|
|
75
|
+
permission under the Copyright and Similar Rights held by the
|
|
76
|
+
Licensor. For purposes of this Public License, where the Licensed
|
|
77
|
+
Material is a musical work, performance, or sound recording,
|
|
78
|
+
Adapted Material is always produced where the Licensed Material is
|
|
79
|
+
synched in timed relation with a moving image.
|
|
80
|
+
|
|
81
|
+
b. Adapter's License means the license You apply to Your Copyright
|
|
82
|
+
and Similar Rights in Your contributions to Adapted Material in
|
|
83
|
+
accordance with the terms and conditions of this Public License.
|
|
84
|
+
|
|
85
|
+
c. Copyright and Similar Rights means copyright and/or similar rights
|
|
86
|
+
closely related to copyright including, without limitation,
|
|
87
|
+
performance, broadcast, sound recording, and Sui Generis Database
|
|
88
|
+
Rights, without regard to how the rights are labeled or
|
|
89
|
+
categorized. For purposes of this Public License, the rights
|
|
90
|
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
|
91
|
+
Rights.
|
|
92
|
+
|
|
93
|
+
d. Effective Technological Measures means those measures that, in the
|
|
94
|
+
absence of proper authority, may not be circumvented under laws
|
|
95
|
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
|
96
|
+
Treaty adopted on December 20, 1996, and/or similar international
|
|
97
|
+
agreements.
|
|
98
|
+
|
|
99
|
+
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
|
100
|
+
any other exception or limitation to Copyright and Similar Rights
|
|
101
|
+
that applies to Your use of the Licensed Material.
|
|
102
|
+
|
|
103
|
+
f. Licensed Material means the artistic or literary work, database,
|
|
104
|
+
or other material to which the Licensor applied this Public
|
|
105
|
+
License.
|
|
106
|
+
|
|
107
|
+
g. Licensed Rights means the rights granted to You subject to the
|
|
108
|
+
terms and conditions of this Public License, which are limited to
|
|
109
|
+
all Copyright and Similar Rights that apply to Your use of the
|
|
110
|
+
Licensed Material and that the Licensor has authority to license.
|
|
111
|
+
|
|
112
|
+
h. Licensor means the individual(s) or entity(ies) granting rights
|
|
113
|
+
under this Public License.
|
|
114
|
+
|
|
115
|
+
i. Share means to provide material to the public by any means or
|
|
116
|
+
process that requires permission under the Licensed Rights, such
|
|
117
|
+
as reproduction, public display, public performance, distribution,
|
|
118
|
+
dissemination, communication, or importation, and to make material
|
|
119
|
+
available to the public including in ways that members of the
|
|
120
|
+
public may access the material from a place and at a time
|
|
121
|
+
individually chosen by them.
|
|
122
|
+
|
|
123
|
+
j. Sui Generis Database Rights means rights other than copyright
|
|
124
|
+
resulting from Directive 96/9/EC of the European Parliament and of
|
|
125
|
+
the Council of 11 March 1996 on the legal protection of databases,
|
|
126
|
+
as amended and/or succeeded, as well as other essentially
|
|
127
|
+
equivalent rights anywhere in the world.
|
|
128
|
+
|
|
129
|
+
k. You means the individual or entity exercising the Licensed Rights
|
|
130
|
+
under this Public License. Your has a corresponding meaning.
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
Section 2 -- Scope.
|
|
134
|
+
|
|
135
|
+
a. License grant.
|
|
136
|
+
|
|
137
|
+
1. Subject to the terms and conditions of this Public License,
|
|
138
|
+
the Licensor hereby grants You a worldwide, royalty-free,
|
|
139
|
+
non-sublicensable, non-exclusive, irrevocable license to
|
|
140
|
+
exercise the Licensed Rights in the Licensed Material to:
|
|
141
|
+
|
|
142
|
+
a. reproduce and Share the Licensed Material, in whole or
|
|
143
|
+
in part; and
|
|
144
|
+
|
|
145
|
+
b. produce, reproduce, and Share Adapted Material.
|
|
146
|
+
|
|
147
|
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
|
148
|
+
Exceptions and Limitations apply to Your use, this Public
|
|
149
|
+
License does not apply, and You do not need to comply with
|
|
150
|
+
its terms and conditions.
|
|
151
|
+
|
|
152
|
+
3. Term. The term of this Public License is specified in Section
|
|
153
|
+
6(a).
|
|
154
|
+
|
|
155
|
+
4. Media and formats; technical modifications allowed. The
|
|
156
|
+
Licensor authorizes You to exercise the Licensed Rights in
|
|
157
|
+
all media and formats whether now known or hereafter created,
|
|
158
|
+
and to make technical modifications necessary to do so. The
|
|
159
|
+
Licensor waives and/or agrees not to assert any right or
|
|
160
|
+
authority to forbid You from making technical modifications
|
|
161
|
+
necessary to exercise the Licensed Rights, including
|
|
162
|
+
technical modifications necessary to circumvent Effective
|
|
163
|
+
Technological Measures. For purposes of this Public License,
|
|
164
|
+
simply making modifications authorized by this Section 2(a)
|
|
165
|
+
(4) never produces Adapted Material.
|
|
166
|
+
|
|
167
|
+
5. Downstream recipients.
|
|
168
|
+
|
|
169
|
+
a. Offer from the Licensor -- Licensed Material. Every
|
|
170
|
+
recipient of the Licensed Material automatically
|
|
171
|
+
receives an offer from the Licensor to exercise the
|
|
172
|
+
Licensed Rights under the terms and conditions of this
|
|
173
|
+
Public License.
|
|
174
|
+
|
|
175
|
+
b. No downstream restrictions. You may not offer or impose
|
|
176
|
+
any additional or different terms or conditions on, or
|
|
177
|
+
apply any Effective Technological Measures to, the
|
|
178
|
+
Licensed Material if doing so restricts exercise of the
|
|
179
|
+
Licensed Rights by any recipient of the Licensed
|
|
180
|
+
Material.
|
|
181
|
+
|
|
182
|
+
6. No endorsement. Nothing in this Public License constitutes or
|
|
183
|
+
may be construed as permission to assert or imply that You
|
|
184
|
+
are, or that Your use of the Licensed Material is, connected
|
|
185
|
+
with, or sponsored, endorsed, or granted official status by,
|
|
186
|
+
the Licensor or others designated to receive attribution as
|
|
187
|
+
provided in Section 3(a)(1)(A)(i).
|
|
188
|
+
|
|
189
|
+
b. Other rights.
|
|
190
|
+
|
|
191
|
+
1. Moral rights, such as the right of integrity, are not
|
|
192
|
+
licensed under this Public License, nor are publicity,
|
|
193
|
+
privacy, and/or other similar personality rights; however, to
|
|
194
|
+
the extent possible, the Licensor waives and/or agrees not to
|
|
195
|
+
assert any such rights held by the Licensor to the limited
|
|
196
|
+
extent necessary to allow You to exercise the Licensed
|
|
197
|
+
Rights, but not otherwise.
|
|
198
|
+
|
|
199
|
+
2. Patent and trademark rights are not licensed under this
|
|
200
|
+
Public License.
|
|
201
|
+
|
|
202
|
+
3. To the extent possible, the Licensor waives any right to
|
|
203
|
+
collect royalties from You for the exercise of the Licensed
|
|
204
|
+
Rights, whether directly or through a collecting society
|
|
205
|
+
under any voluntary or waivable statutory or compulsory
|
|
206
|
+
licensing scheme. In all other cases the Licensor expressly
|
|
207
|
+
reserves any right to collect such royalties.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Section 3 -- License Conditions.
|
|
211
|
+
|
|
212
|
+
Your exercise of the Licensed Rights is expressly made subject to the
|
|
213
|
+
following conditions.
|
|
214
|
+
|
|
215
|
+
a. Attribution.
|
|
216
|
+
|
|
217
|
+
1. If You Share the Licensed Material (including in modified
|
|
218
|
+
form), You must:
|
|
219
|
+
|
|
220
|
+
a. retain the following if it is supplied by the Licensor
|
|
221
|
+
with the Licensed Material:
|
|
222
|
+
|
|
223
|
+
i. identification of the creator(s) of the Licensed
|
|
224
|
+
Material and any others designated to receive
|
|
225
|
+
attribution, in any reasonable manner requested by
|
|
226
|
+
the Licensor (including by pseudonym if
|
|
227
|
+
designated);
|
|
228
|
+
|
|
229
|
+
ii. a copyright notice;
|
|
230
|
+
|
|
231
|
+
iii. a notice that refers to this Public License;
|
|
232
|
+
|
|
233
|
+
iv. a notice that refers to the disclaimer of
|
|
234
|
+
warranties;
|
|
235
|
+
|
|
236
|
+
v. a URI or hyperlink to the Licensed Material to the
|
|
237
|
+
extent reasonably practicable;
|
|
238
|
+
|
|
239
|
+
b. indicate if You modified the Licensed Material and
|
|
240
|
+
retain an indication of any previous modifications; and
|
|
241
|
+
|
|
242
|
+
c. indicate the Licensed Material is licensed under this
|
|
243
|
+
Public License, and include the text of, or the URI or
|
|
244
|
+
hyperlink to, this Public License.
|
|
245
|
+
|
|
246
|
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
|
247
|
+
reasonable manner based on the medium, means, and context in
|
|
248
|
+
which You Share the Licensed Material. For example, it may be
|
|
249
|
+
reasonable to satisfy the conditions by providing a URI or
|
|
250
|
+
hyperlink to a resource that includes the required
|
|
251
|
+
information.
|
|
252
|
+
|
|
253
|
+
3. If requested by the Licensor, You must remove any of the
|
|
254
|
+
information required by Section 3(a)(1)(A) to the extent
|
|
255
|
+
reasonably practicable.
|
|
256
|
+
|
|
257
|
+
4. If You Share Adapted Material You produce, the Adapter's
|
|
258
|
+
License You apply must not prevent recipients of the Adapted
|
|
259
|
+
Material from complying with this Public License.
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
Section 4 -- Sui Generis Database Rights.
|
|
263
|
+
|
|
264
|
+
Where the Licensed Rights include Sui Generis Database Rights that
|
|
265
|
+
apply to Your use of the Licensed Material:
|
|
266
|
+
|
|
267
|
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
|
268
|
+
to extract, reuse, reproduce, and Share all or a substantial
|
|
269
|
+
portion of the contents of the database;
|
|
270
|
+
|
|
271
|
+
b. if You include all or a substantial portion of the database
|
|
272
|
+
contents in a database in which You have Sui Generis Database
|
|
273
|
+
Rights, then the database in which You have Sui Generis Database
|
|
274
|
+
Rights (but not its individual contents) is Adapted Material; and
|
|
275
|
+
|
|
276
|
+
c. You must comply with the conditions in Section 3(a) if You Share
|
|
277
|
+
all or a substantial portion of the contents of the database.
|
|
278
|
+
|
|
279
|
+
For the avoidance of doubt, this Section 4 supplements and does not
|
|
280
|
+
replace Your obligations under this Public License where the Licensed
|
|
281
|
+
Rights include other Copyright and Similar Rights.
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
|
285
|
+
|
|
286
|
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
|
287
|
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
|
288
|
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
|
289
|
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
|
290
|
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
|
291
|
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
292
|
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
|
293
|
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
|
294
|
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
|
295
|
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
|
296
|
+
|
|
297
|
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
|
298
|
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
|
299
|
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
|
300
|
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
|
301
|
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
|
302
|
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
|
303
|
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
|
304
|
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
|
305
|
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
|
306
|
+
|
|
307
|
+
c. The disclaimer of warranties and limitation of liability provided
|
|
308
|
+
above shall be interpreted in a manner that, to the extent
|
|
309
|
+
possible, most closely approximates an absolute disclaimer and
|
|
310
|
+
waiver of all liability.
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
Section 6 -- Term and Termination.
|
|
314
|
+
|
|
315
|
+
a. This Public License applies for the term of the Copyright and
|
|
316
|
+
Similar Rights licensed here. However, if You fail to comply with
|
|
317
|
+
this Public License, then Your rights under this Public License
|
|
318
|
+
terminate automatically.
|
|
319
|
+
|
|
320
|
+
b. Where Your right to use the Licensed Material has terminated under
|
|
321
|
+
Section 6(a), it reinstates:
|
|
322
|
+
|
|
323
|
+
1. automatically as of the date the violation is cured, provided
|
|
324
|
+
it is cured within 30 days of Your discovery of the
|
|
325
|
+
violation; or
|
|
326
|
+
|
|
327
|
+
2. upon express reinstatement by the Licensor.
|
|
328
|
+
|
|
329
|
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
|
330
|
+
right the Licensor may have to seek remedies for Your violations
|
|
331
|
+
of this Public License.
|
|
332
|
+
|
|
333
|
+
c. For the avoidance of doubt, the Licensor may also offer the
|
|
334
|
+
Licensed Material under separate terms or conditions or stop
|
|
335
|
+
distributing the Licensed Material at any time; however, doing so
|
|
336
|
+
will not terminate this Public License.
|
|
337
|
+
|
|
338
|
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
|
339
|
+
License.
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
Section 7 -- Other Terms and Conditions.
|
|
343
|
+
|
|
344
|
+
a. The Licensor shall not be bound by any additional or different
|
|
345
|
+
terms or conditions communicated by You unless expressly agreed.
|
|
346
|
+
|
|
347
|
+
b. Any arrangements, understandings, or agreements regarding the
|
|
348
|
+
Licensed Material not stated herein are separate from and
|
|
349
|
+
independent of the terms and conditions of this Public License.
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
Section 8 -- Interpretation.
|
|
353
|
+
|
|
354
|
+
a. For the avoidance of doubt, this Public License does not, and
|
|
355
|
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
|
356
|
+
conditions on any use of the Licensed Material that could lawfully
|
|
357
|
+
be made without permission under this Public License.
|
|
358
|
+
|
|
359
|
+
b. To the extent possible, if any provision of this Public License is
|
|
360
|
+
deemed unenforceable, it shall be automatically reformed to the
|
|
361
|
+
minimum extent necessary to make it enforceable. If the provision
|
|
362
|
+
cannot be reformed, it shall be severed from this Public License
|
|
363
|
+
without affecting the enforceability of the remaining terms and
|
|
364
|
+
conditions.
|
|
365
|
+
|
|
366
|
+
c. No term or condition of this Public License will be waived and no
|
|
367
|
+
failure to comply consented to unless expressly agreed to by the
|
|
368
|
+
Licensor.
|
|
369
|
+
|
|
370
|
+
d. Nothing in this Public License constitutes or may be interpreted
|
|
371
|
+
as a limitation upon, or waiver of, any privileges and immunities
|
|
372
|
+
that apply to the Licensor or You, including from the legal
|
|
373
|
+
processes of any jurisdiction or authority.
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
=======================================================================
|
|
377
|
+
|
|
378
|
+
Creative Commons is not a party to its public
|
|
379
|
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
|
380
|
+
its public licenses to material it publishes and in those instances
|
|
381
|
+
will be considered the “Licensor.” The text of the Creative Commons
|
|
382
|
+
public licenses is dedicated to the public domain under the CC0 Public
|
|
383
|
+
Domain Dedication. Except for the limited purpose of indicating that
|
|
384
|
+
material is shared under a Creative Commons public license or as
|
|
385
|
+
otherwise permitted by the Creative Commons policies published at
|
|
386
|
+
creativecommons.org/policies, Creative Commons does not authorize the
|
|
387
|
+
use of the trademark "Creative Commons" or any other trademark or logo
|
|
388
|
+
of Creative Commons without its prior written consent including,
|
|
389
|
+
without limitation, in connection with any unauthorized modifications
|
|
390
|
+
to any of its public licenses or any other arrangements,
|
|
391
|
+
understandings, or agreements concerning use of licensed material. For
|
|
392
|
+
the avoidance of doubt, this paragraph does not form part of the
|
|
393
|
+
public licenses.
|
|
394
|
+
|
|
395
|
+
Creative Commons may be contacted at creativecommons.org.
|
|
396
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
provared_langchain
|