predikit 0.4.1__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- predikit-0.4.3/.claude/settings.local.json +15 -0
- {predikit-0.4.1 → predikit-0.4.3}/.gitignore +1 -0
- {predikit-0.4.1 → predikit-0.4.3}/CHANGELOG.md +14 -0
- {predikit-0.4.1 → predikit-0.4.3}/PKG-INFO +58 -28
- {predikit-0.4.1 → predikit-0.4.3}/README.md +361 -331
- predikit-0.4.3/docs/logo.gif +0 -0
- predikit-0.4.3/docs/logo.png +0 -0
- predikit-0.4.3/mlruns/1/models/m-27a74bc0ab2f40e09dc3d6c4f026cc1e/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-27a74bc0ab2f40e09dc3d6c4f026cc1e/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-27a74bc0ab2f40e09dc3d6c4f026cc1e/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-27a74bc0ab2f40e09dc3d6c4f026cc1e/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-27a74bc0ab2f40e09dc3d6c4f026cc1e/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-28173468f0874040a705d2d3820a4f5c/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-28173468f0874040a705d2d3820a4f5c/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-28173468f0874040a705d2d3820a4f5c/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-28173468f0874040a705d2d3820a4f5c/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-28173468f0874040a705d2d3820a4f5c/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-3eabd93b6ac447808321a1d58fef2b9b/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-3eabd93b6ac447808321a1d58fef2b9b/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-3eabd93b6ac447808321a1d58fef2b9b/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-3eabd93b6ac447808321a1d58fef2b9b/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-3eabd93b6ac447808321a1d58fef2b9b/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-4816da14ba9c47c2b69d7d959f186d4e/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-4816da14ba9c47c2b69d7d959f186d4e/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-4816da14ba9c47c2b69d7d959f186d4e/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-4816da14ba9c47c2b69d7d959f186d4e/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-4816da14ba9c47c2b69d7d959f186d4e/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-4deda032d5434d74888edc6f4df2e642/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-4deda032d5434d74888edc6f4df2e642/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-4deda032d5434d74888edc6f4df2e642/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-4deda032d5434d74888edc6f4df2e642/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-4deda032d5434d74888edc6f4df2e642/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-6988b8fc759d4a6d9ba42b3ef9c5bbad/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-6988b8fc759d4a6d9ba42b3ef9c5bbad/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-6988b8fc759d4a6d9ba42b3ef9c5bbad/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-6988b8fc759d4a6d9ba42b3ef9c5bbad/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-6988b8fc759d4a6d9ba42b3ef9c5bbad/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-885ed3e972dd4583aa9b4c518b369316/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-885ed3e972dd4583aa9b4c518b369316/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-885ed3e972dd4583aa9b4c518b369316/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-885ed3e972dd4583aa9b4c518b369316/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-885ed3e972dd4583aa9b4c518b369316/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-936aa30d653c4e79920e98dd23b2e352/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-936aa30d653c4e79920e98dd23b2e352/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-936aa30d653c4e79920e98dd23b2e352/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-936aa30d653c4e79920e98dd23b2e352/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-936aa30d653c4e79920e98dd23b2e352/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-9c8120122eb744128b3c91e724536d7e/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-9c8120122eb744128b3c91e724536d7e/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-9c8120122eb744128b3c91e724536d7e/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-9c8120122eb744128b3c91e724536d7e/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-9c8120122eb744128b3c91e724536d7e/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-bc53e68577e64ed5b64b173ae23eb99d/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-bc53e68577e64ed5b64b173ae23eb99d/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-bc53e68577e64ed5b64b173ae23eb99d/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-bc53e68577e64ed5b64b173ae23eb99d/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-bc53e68577e64ed5b64b173ae23eb99d/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-d5e1b20e8a9a4414b74b95d613362ae0/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-d5e1b20e8a9a4414b74b95d613362ae0/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-d5e1b20e8a9a4414b74b95d613362ae0/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-d5e1b20e8a9a4414b74b95d613362ae0/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-d5e1b20e8a9a4414b74b95d613362ae0/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-e368d86129cb416cbdc24ce1f4d4062b/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-e368d86129cb416cbdc24ce1f4d4062b/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-e368d86129cb416cbdc24ce1f4d4062b/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-e368d86129cb416cbdc24ce1f4d4062b/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-e368d86129cb416cbdc24ce1f4d4062b/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-e71aea9d1d2646f0970b78d821200719/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-e71aea9d1d2646f0970b78d821200719/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-e71aea9d1d2646f0970b78d821200719/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-e71aea9d1d2646f0970b78d821200719/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-e71aea9d1d2646f0970b78d821200719/artifacts/requirements.txt +15 -0
- predikit-0.4.3/mlruns/1/models/m-f374e93dce4f4be498ccf04e1fb1ac9e/artifacts/MLmodel +23 -0
- predikit-0.4.3/mlruns/1/models/m-f374e93dce4f4be498ccf04e1fb1ac9e/artifacts/conda.yaml +22 -0
- predikit-0.4.3/mlruns/1/models/m-f374e93dce4f4be498ccf04e1fb1ac9e/artifacts/model.skops +0 -0
- predikit-0.4.3/mlruns/1/models/m-f374e93dce4f4be498ccf04e1fb1ac9e/artifacts/python_env.yaml +7 -0
- predikit-0.4.3/mlruns/1/models/m-f374e93dce4f4be498ccf04e1fb1ac9e/artifacts/requirements.txt +15 -0
- {predikit-0.4.1 → predikit-0.4.3}/pyproject.toml +2 -2
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/__init__.py +1 -1
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/cli.py +2 -1
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/exporters/langchain.py +2 -1
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/exporters/openai.py +3 -2
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/loaders/mlflow.py +2 -2
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/loaders/snowflake.py +5 -1
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/tool.py +12 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_confidence.py +3 -3
- predikit-0.4.3/uv.lock +5166 -0
- predikit-0.4.1/.claude/settings.local.json +0 -9
- {predikit-0.4.1 → predikit-0.4.3}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/.github/workflows/publish.yml +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/.github/workflows/test.yml +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/.pre-commit-config.yaml +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/CLAUDE.md +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/CONTRIBUTING.md +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/LICENSE +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/01_basic_sklearn.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/02_xgboost_regression.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/03_orlando_real_estate.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/04_confidence_routing.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/05_multi_model_ensemble.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/06_mlflow_loader.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/examples/07_snowflake_loader.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/coerce.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/ensemble.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/exceptions.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/exporters/__init__.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/introspect.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/loaders/__init__.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/src/predikit/registry.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/__init__.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_cli.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_coerce.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_ensemble.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_exporters_openai.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_introspect.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_loaders_mlflow.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_loaders_snowflake.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_logging.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_registry.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_tool.py +0 -0
- {predikit-0.4.1 → predikit-0.4.3}/tests/test_weighted_ensemble.py +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(git add *)",
|
|
5
|
+
"Bash(git commit -m ' *)",
|
|
6
|
+
"Bash(python -m pytest tests/ -v --tb=short --cov=src/predikit --cov-report=term-missing)",
|
|
7
|
+
"WebFetch(domain:github.com)",
|
|
8
|
+
"PowerShell(python -m pip install mypy -q)",
|
|
9
|
+
"PowerShell(python -m mypy src/predikit)",
|
|
10
|
+
"Bash(python -m pytest --tb=short -q)",
|
|
11
|
+
"Bash(uv run *)",
|
|
12
|
+
"PowerShell(C:\\\\AI\\\\predikit\\\\.venv\\\\Scripts\\\\python.exe -m ensurepip --upgrade)"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.4.2] - 2026-06-13
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Redesigned PyPI/README hero: logo, centered tagline, and badges in a unified `<p align="center">` block
|
|
13
|
+
- Tagline moved from a `##` heading to a proper descriptive paragraph
|
|
14
|
+
- Badges converted to centered HTML `<img>` links for consistent rendering on PyPI
|
|
15
|
+
- Quick code teaser repositioned directly below badges (before Table of Contents)
|
|
16
|
+
- "Field naming rule" added to Table of Contents
|
|
17
|
+
- `ainvoke()` added to `ModelTool` Core API reference table
|
|
18
|
+
- `ModelEnsemble` Core API subsection added with constructor signature and full strategy table
|
|
19
|
+
- Project Traffic / download badge moved to bottom of README
|
|
20
|
+
- Development Status classifier bumped from `3 - Alpha` to `4 - Beta` in `pyproject.toml`
|
|
21
|
+
- Removed CI test status badge from README
|
|
22
|
+
|
|
9
23
|
## [0.4.1] - 2026-06-02
|
|
10
24
|
|
|
11
25
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: predikit
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Turn any trained sklearn/XGBoost model into an LLM-callable tool with auto-generated schemas and typed I/O.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Tejas-TA/predikit
|
|
6
6
|
Project-URL: Repository, https://github.com/Tejas-TA/predikit
|
|
@@ -10,7 +10,7 @@ Author-email: Tejas Tumakuru Ashok <tejasta@gmail.com>
|
|
|
10
10
|
License: MIT
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Keywords: agents,function-calling,llm,ml-tools,sklearn,xgboost
|
|
13
|
-
Classifier: Development Status ::
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
15
15
|
Classifier: Intended Audience :: Science/Research
|
|
16
16
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -48,34 +48,46 @@ Provides-Extra: xgboost
|
|
|
48
48
|
Requires-Dist: xgboost>=1.7; extra == 'xgboost'
|
|
49
49
|
Description-Content-Type: text/markdown
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
<p align="center">
|
|
52
|
+
<picture>
|
|
53
|
+
<source srcset="https://raw.githubusercontent.com/Tejas-TA/predikit/main/docs/logo.gif">
|
|
54
|
+
<img src="https://raw.githubusercontent.com/Tejas-TA/predikit/main/docs/logo.png" alt="predikit" width="500"/>
|
|
55
|
+
</picture>
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
Turn any trained scikit-learn or XGBoost model into an LLM-callable tool —<br/>
|
|
60
|
+
auto-generated JSON schemas, typed I/O, zero boilerplate.
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
<p align="center">
|
|
64
|
+
<a href="https://pypi.org/project/predikit/"><img src="https://img.shields.io/pypi/v/predikit.svg" alt="PyPI version"/></a>
|
|
65
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python 3.10+"/></a>
|
|
66
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-green.svg" alt="License: MIT"/></a>
|
|
67
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"/></a>
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<a href="https://pepy.tech/project/predikit"><img src="https://static.pepy.tech/personalized-badge/predikit?period=week&units=international_system&left_color=grey&right_color=blue&left_text=weekly+downloads" alt="Weekly Downloads"/></a>
|
|
72
|
+
<a href="https://pepy.tech/project/predikit"><img src="https://static.pepy.tech/personalized-badge/predikit?period=month&units=international_system&left_color=grey&right_color=blue&left_text=monthly+downloads" alt="Monthly Downloads"/></a>
|
|
73
|
+
<a href="https://pepy.tech/project/predikit"><img src="https://static.pepy.tech/personalized-badge/predikit?period=total&units=international_system&left_color=grey&right_color=blue&left_text=total+downloads" alt="Total Downloads"/></a>
|
|
74
|
+
</p>
|
|
57
75
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
```python
|
|
77
|
+
tool = ModelTool(model=clf, name="classify_iris", ...)
|
|
78
|
+
tool.to_openai() # OpenAI function schema, ready to pass to the API
|
|
79
|
+
tool.invoke({"sqft": 2200}) # → {"price_usd": 370730}
|
|
80
|
+
```
|
|
62
81
|
|
|
63
82
|
## Table of Contents
|
|
64
83
|
- [Install](#install)
|
|
65
84
|
- [30-second example](#30-second-example)
|
|
66
85
|
- [Core API](#core-api)
|
|
86
|
+
- [Field naming rule](#field-naming-rule)
|
|
67
87
|
- [Cookbook](#cookbook)
|
|
68
88
|
- [Contributing](#contributing)
|
|
69
89
|
- [License](#license)
|
|
70
90
|
|
|
71
|
-
## Turn any trained scikit-learn or XGBoost model into an LLM-callable tool — auto-generated JSON schemas, typed I/O, zero boilerplate.
|
|
72
|
-
|
|
73
|
-
```python
|
|
74
|
-
tool = ModelTool(model=clf, name="classify_iris", ...)
|
|
75
|
-
tool.to_openai() # OpenAI function schema, ready to pass to the API
|
|
76
|
-
tool.invoke({"sqft": 2200}) # → {"price_usd": 370730}
|
|
77
|
-
```
|
|
78
|
-
|
|
79
91
|
## Install
|
|
80
92
|
|
|
81
93
|
```bash
|
|
@@ -153,6 +165,7 @@ ModelTool(
|
|
|
153
165
|
| Method | Returns | What it does |
|
|
154
166
|
|--------|---------|--------------|
|
|
155
167
|
| `.invoke(input_dict)` | `dict` | Validates → predicts → returns `{output_name: value}` |
|
|
168
|
+
| `.ainvoke(input_dict)` | `dict` | Async version of `.invoke()` |
|
|
156
169
|
| `.to_openai()` | `dict` | OpenAI function-calling schema |
|
|
157
170
|
| `.to_langchain()` | `StructuredTool` | LangChain tool |
|
|
158
171
|
| `.to_callable()` | `Callable` | Plain Python function |
|
|
@@ -168,6 +181,30 @@ registry.to_langchain() # → list[StructuredTool]
|
|
|
168
181
|
registry.get("name") # → ModelTool
|
|
169
182
|
```
|
|
170
183
|
|
|
184
|
+
### `ModelEnsemble`
|
|
185
|
+
|
|
186
|
+
Call multiple models and reconcile their outputs in one step:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
ModelEnsemble(
|
|
190
|
+
tools: list[ModelTool], # models to run in parallel
|
|
191
|
+
name: str, # ensemble tool name the LLM sees
|
|
192
|
+
description: str,
|
|
193
|
+
strategy: str, # "collect" | "mean" | "vote" | "weighted_mean" | "weighted_vote"
|
|
194
|
+
weights: list[float], # optional, for weighted strategies
|
|
195
|
+
)
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
| Strategy | Behaviour |
|
|
199
|
+
|----------|-----------|
|
|
200
|
+
| `"collect"` | Merges all outputs into one dict (tools can have different `output_name`) |
|
|
201
|
+
| `"mean"` | Averages numeric outputs (all tools must share `output_name`) |
|
|
202
|
+
| `"vote"` | Majority class vote (all tools must share `output_name`) |
|
|
203
|
+
| `"weighted_mean"` | Weighted average — provide a `weights` list |
|
|
204
|
+
| `"weighted_vote"` | Weighted majority vote — provide a `weights` list |
|
|
205
|
+
|
|
206
|
+
`ModelEnsemble` exposes the same `.invoke()`, `.ainvoke()`, `.to_openai()`, and `.to_langchain()` interface as `ModelTool`.
|
|
207
|
+
|
|
171
208
|
## Field naming rule
|
|
172
209
|
|
|
173
210
|
**Your Pydantic schema field names must exactly match the column names the model was trained on.**
|
|
@@ -287,8 +324,6 @@ Only applies to classifiers that implement `predict_proba`. Regressors are unaff
|
|
|
287
324
|
|
|
288
325
|
### Multi-model ensemble
|
|
289
326
|
|
|
290
|
-
Call multiple models and reconcile their outputs in one step:
|
|
291
|
-
|
|
292
327
|
```python
|
|
293
328
|
from predikit import ModelEnsemble, ToolRegistry
|
|
294
329
|
|
|
@@ -303,12 +338,6 @@ result = ensemble.invoke(inputs) # → {"price_usd": 370112}
|
|
|
303
338
|
schema = ensemble.to_openai() # works exactly like ModelTool
|
|
304
339
|
```
|
|
305
340
|
|
|
306
|
-
| strategy | behaviour |
|
|
307
|
-
|----------|-----------|
|
|
308
|
-
| `"collect"` | merges all outputs into one dict (tools can have different `output_name`) |
|
|
309
|
-
| `"mean"` | averages numeric outputs (all tools must share `output_name`) |
|
|
310
|
-
| `"vote"` | majority class vote (all tools must share `output_name`) |
|
|
311
|
-
|
|
312
341
|
Register ensembles alongside individual tools:
|
|
313
342
|
|
|
314
343
|
```python
|
|
@@ -379,3 +408,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, code style, and PR
|
|
|
379
408
|
## License
|
|
380
409
|
|
|
381
410
|
MIT © Tejas Tumakuru Ashok
|
|
411
|
+
|