langchain-human-in-the-loop 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.
- langchain_human_in_the_loop/__init__.py +3 -0
- langchain_human_in_the_loop/fallback.py +36 -0
- langchain_human_in_the_loop-0.0.1.dist-info/METADATA +53 -0
- langchain_human_in_the_loop-0.0.1.dist-info/RECORD +7 -0
- langchain_human_in_the_loop-0.0.1.dist-info/WHEEL +5 -0
- langchain_human_in_the_loop-0.0.1.dist-info/licenses/LICENSE +21 -0
- langchain_human_in_the_loop-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Callable, Optional
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@dataclass(frozen=True)
|
|
6
|
+
class HumanFallbackConfig:
|
|
7
|
+
"""Configuration used by `with_human_fallback`."""
|
|
8
|
+
|
|
9
|
+
enabled: bool = True
|
|
10
|
+
reason: str = "fallback requested"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def with_human_fallback(
|
|
14
|
+
primary_handler: Callable[..., Any],
|
|
15
|
+
human_handler: Callable[..., Any],
|
|
16
|
+
*,
|
|
17
|
+
config: Optional[HumanFallbackConfig] = None,
|
|
18
|
+
) -> Callable[..., Any]:
|
|
19
|
+
"""
|
|
20
|
+
Wrap `primary_handler` with a human fallback.
|
|
21
|
+
|
|
22
|
+
If the primary handler raises an exception and fallback is enabled,
|
|
23
|
+
the human handler is called with the original args/kwargs plus
|
|
24
|
+
`error=<exception>`.
|
|
25
|
+
"""
|
|
26
|
+
cfg = config or HumanFallbackConfig()
|
|
27
|
+
|
|
28
|
+
def wrapped(*args: Any, **kwargs: Any) -> Any:
|
|
29
|
+
try:
|
|
30
|
+
return primary_handler(*args, **kwargs)
|
|
31
|
+
except Exception as exc: # pragma: no cover
|
|
32
|
+
if not cfg.enabled:
|
|
33
|
+
raise
|
|
34
|
+
return human_handler(*args, **kwargs, error=exc)
|
|
35
|
+
|
|
36
|
+
return wrapped
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-human-in-the-loop
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Utilities for adding human fallback flows to LangChain apps.
|
|
5
|
+
Author: CodeVF LLC
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/codevfllc/langchain-human-in-the-loop
|
|
8
|
+
Project-URL: Repository, https://github.com/codevfllc/langchain-human-in-the-loop
|
|
9
|
+
Project-URL: Issues, https://github.com/codevfllc/langchain-human-in-the-loop/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# langchain-human-in-the-loop
|
|
26
|
+
|
|
27
|
+
`langchain-human-in-the-loop` is a small Python package scaffold for human-in-the-loop fallback patterns in LangChain-style applications.
|
|
28
|
+
|
|
29
|
+
## Install (local)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python3 -m pip install -e .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Build package artifacts
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python3 -m pip install --upgrade build
|
|
39
|
+
python3 -m build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This creates:
|
|
43
|
+
- `dist/langchain_human_in_the_loop-<version>.tar.gz`
|
|
44
|
+
- `dist/langchain_human_in_the_loop-<version>-py3-none-any.whl`
|
|
45
|
+
|
|
46
|
+
## Publish to PyPI
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python3 -m pip install --upgrade twine
|
|
50
|
+
python3 -m twine upload dist/*
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Tip: publish once ASAP with this name to claim it, then iterate on functionality in later releases.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
langchain_human_in_the_loop/__init__.py,sha256=1djpuLDRWuPPZaMU7xQyLIjv5zUQ65rkndvKYmxUsoY,121
|
|
2
|
+
langchain_human_in_the_loop/fallback.py,sha256=wkpE5IL63XbUBYY-gGkXabMI0UMh-IswvFLvJauyld4,1017
|
|
3
|
+
langchain_human_in_the_loop-0.0.1.dist-info/licenses/LICENSE,sha256=LCVKPsvziPEQfM-SBEqZEReCGkaKAb8HXnUdoEhvzR8,1067
|
|
4
|
+
langchain_human_in_the_loop-0.0.1.dist-info/METADATA,sha256=DhruqBzB8icFUrm0qiJ_6lsCrnndA3siaXJOPxd9sjE,1688
|
|
5
|
+
langchain_human_in_the_loop-0.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
+
langchain_human_in_the_loop-0.0.1.dist-info/top_level.txt,sha256=5ELhus1qLsyXjFGWhLjOvwmoO3owROqbDyisA2mGKWI,28
|
|
7
|
+
langchain_human_in_the_loop-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CodeVF LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
langchain_human_in_the_loop
|