ebaml 0.4.0__tar.gz → 0.4.2__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.
- {ebaml-0.4.0 → ebaml-0.4.2}/PKG-INFO +5 -1
- {ebaml-0.4.0 → ebaml-0.4.2}/pyproject.toml +43 -2
- {ebaml-0.4.0 → ebaml-0.4.2}/pyproject.toml.orig +27 -3
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/core/custom_types.py +11 -3
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/local/facts.py +6 -3
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/model_store.py +56 -16
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/read_tools.py +2 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/server.py +39 -13
- {ebaml-0.4.0 → ebaml-0.4.2}/LICENSE +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/README.md +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/.baml-generator-output-root +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/.baml-generator-output.json +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/.gitignore +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_baml_sources.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_function_registry.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_inlinedbaml.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_invocation_types.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_invocation_types.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/_typemap.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/clients/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/clients/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/content/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/content/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/errors/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/errors/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/events/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/events/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/mcp/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/mcp/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/stream/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/stream/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/tools/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/tools/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/wire/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/ai/wire/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/crypto/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/crypto/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/csv/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/csv/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/env/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/env/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/errors/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/errors/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/fs/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/fs/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/future/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/future/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/glob/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/glob/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/hash/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/hash/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/host/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/host/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/http/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/http/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/io/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/io/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/iter/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/iter/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/json/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/json/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/media/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/media/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/net/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/net/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/ops/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/ops/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/panics/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/panics/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/random/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/random/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/regex/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/regex/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/sap/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/sap/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/spawn/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/spawn/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/sys/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/sys/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/time/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/time/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/toml/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/toml/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/ws/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/ws/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/yaml/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/baml/yaml/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/experimental/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/experimental/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/py.typed +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/class_/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/class_/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/enum/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/enum/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/errors/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/errors/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/function/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/function/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/interface/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/reflect/interface/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/anthropic/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/anthropic/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/anthropic/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/anthropic/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/assert_/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/assert_/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/aws/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/aws/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/aws/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/aws/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/claude_code/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/claude_code/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/claude_code/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/claude_code/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/google/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/google/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/google/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/google/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/testing/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/testing/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/trace/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/trace/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/typesafeai/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/typesafeai/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/vercel/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/vercel/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/vercel/internal/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/baml_sdk/vendor/vercel/internal/__init__.pyi +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/benchmark.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/core/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/core/exceptions.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/ebm_graph.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/graph_text.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/model_kinds.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/request_text.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/terms.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/token_budget.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/graphs/token_weights.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/descriptors.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/options.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/provider_errors.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/retry.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/sdk_setup.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/token_learning.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/llm/token_weights.json +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/local/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/local/audience.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/local/fact_text.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/__init__.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/explain_tools.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/mcp/llm_tools.py +0 -0
- {ebaml-0.4.0 → ebaml-0.4.2}/src/ebaml/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ebaml
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: BAML for Explainable Boosting Machines: talk to your EBM.
|
|
5
5
|
Keywords: baml,llm,explainable-ai,explainable-boosting-machine,interpretml
|
|
6
6
|
Author: Johnny Godoy
|
|
@@ -17,13 +17,17 @@ Requires-Dist: attrs>=26.1.0
|
|
|
17
17
|
Requires-Dist: baml-bridge>=0.23.0
|
|
18
18
|
Requires-Dist: beartype>=0.23.1
|
|
19
19
|
Requires-Dist: interpret>=0.7.8
|
|
20
|
+
Requires-Dist: narwhals>=2.27.1
|
|
20
21
|
Requires-Dist: numpy>=2.5.4
|
|
21
22
|
Requires-Dist: orjson>=3.13.0
|
|
22
23
|
Requires-Dist: pandas>=3.0.6
|
|
23
24
|
Requires-Dist: scipy>=1.18.1
|
|
24
25
|
Requires-Dist: structlog>=26.1.0
|
|
26
|
+
Requires-Dist: cyclopts>=5.2.0 ; extra == 'mcp'
|
|
25
27
|
Requires-Dist: joblib>=1.5.0 ; extra == 'mcp'
|
|
26
28
|
Requires-Dist: mcp>=1.30.0 ; extra == 'mcp'
|
|
29
|
+
Requires-Dist: polars>=2.0.0 ; extra == 'mcp'
|
|
30
|
+
Requires-Dist: skops>=0.16.0 ; extra == 'mcp'
|
|
27
31
|
Requires-Python: >=3.13
|
|
28
32
|
Project-URL: Documentation, https://johnny-godoy.github.io/EBaMl/
|
|
29
33
|
Project-URL: Source, https://github.com/johnny-godoy/EBaMl
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -26,6 +26,7 @@ dependencies = [
|
|
|
26
26
|
"baml-bridge>=0.23.0",
|
|
27
27
|
"beartype>=0.23.1",
|
|
28
28
|
"interpret>=0.7.8",
|
|
29
|
+
"narwhals>=2.27.1",
|
|
29
30
|
"numpy>=2.5.4",
|
|
30
31
|
"orjson>=3.13.0",
|
|
31
32
|
"pandas>=3.0.6",
|
|
@@ -39,8 +40,11 @@ email = "johnny.godoy@ing.uchile.cl"
|
|
|
39
40
|
|
|
40
41
|
[project.optional-dependencies]
|
|
41
42
|
mcp = [
|
|
43
|
+
"cyclopts>=5.2.0",
|
|
42
44
|
"joblib>=1.5.0",
|
|
43
45
|
"mcp>=1.30.0",
|
|
46
|
+
"polars>=2.0.0",
|
|
47
|
+
"skops>=0.16.0",
|
|
44
48
|
]
|
|
45
49
|
|
|
46
50
|
[project.scripts]
|
|
@@ -119,6 +123,36 @@ ignore = ["missing-copyright-notice"]
|
|
|
119
123
|
preview = true
|
|
120
124
|
select = ["ALL"]
|
|
121
125
|
|
|
126
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.argparse]
|
|
127
|
+
msg = "Use cyclopts. See .claude/rules/libraries.md."
|
|
128
|
+
|
|
129
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.cloudpickle]
|
|
130
|
+
msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
131
|
+
|
|
132
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.dataclasses]
|
|
133
|
+
msg = "Use attrs. See .claude/rules/libraries.md."
|
|
134
|
+
|
|
135
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.dill]
|
|
136
|
+
msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
137
|
+
|
|
138
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.joblib]
|
|
139
|
+
msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.json]
|
|
142
|
+
msg = "Use orjson. See .claude/rules/libraries.md."
|
|
143
|
+
|
|
144
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.logging]
|
|
145
|
+
msg = "Use structlog. See .claude/rules/libraries.md."
|
|
146
|
+
|
|
147
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.pandas]
|
|
148
|
+
msg = "Take a frame with narwhals, or read data with polars. See .claude/rules/libraries.md."
|
|
149
|
+
|
|
150
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.pickle]
|
|
151
|
+
msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
152
|
+
|
|
153
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api.shelve]
|
|
154
|
+
msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
155
|
+
|
|
122
156
|
[tool.ruff.lint.per-file-ignores]
|
|
123
157
|
"tests/**/*.py" = [
|
|
124
158
|
"undocumented-public-function",
|
|
@@ -141,6 +175,8 @@ ignore_decorators = [
|
|
|
141
175
|
"@pytest.fixture",
|
|
142
176
|
"@server.tool",
|
|
143
177
|
"@server.resource",
|
|
178
|
+
"@app.default",
|
|
179
|
+
"@app.command*",
|
|
144
180
|
]
|
|
145
181
|
ignore_names = [
|
|
146
182
|
"pytestmark",
|
|
@@ -304,6 +340,7 @@ build-backend = "uv_build"
|
|
|
304
340
|
[dependency-groups]
|
|
305
341
|
dev = [
|
|
306
342
|
"cosmic-ray>=8.7.0",
|
|
343
|
+
"cyclopts>=5.2.0",
|
|
307
344
|
"deptry>=0.25.1",
|
|
308
345
|
"hypothesis>=6.170.1",
|
|
309
346
|
"import-linter>=2.15",
|
|
@@ -318,6 +355,7 @@ dev = [
|
|
|
318
355
|
"ruff>=0.17.0",
|
|
319
356
|
"scipy-stubs>=1.18.1.1",
|
|
320
357
|
"semgrep>=1.181.0",
|
|
358
|
+
"skops>=0.16.0",
|
|
321
359
|
"sybil>=10.1.0",
|
|
322
360
|
"types-pyyaml>=6.0.12.20260906",
|
|
323
361
|
"typst>=0.15.0",
|
|
@@ -329,5 +367,8 @@ docs = [
|
|
|
329
367
|
"mkdocstrings[python]>=1.0.7",
|
|
330
368
|
"zensical>=0.0.71",
|
|
331
369
|
]
|
|
332
|
-
commits = [
|
|
370
|
+
commits = [
|
|
371
|
+
"commitizen>=4.19.2",
|
|
372
|
+
"cyclopts>=5.2.0",
|
|
373
|
+
]
|
|
333
374
|
release = ["scriv>=1.8.0"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -23,8 +23,10 @@ dependencies = [
|
|
|
23
23
|
"baml-bridge>=0.23.0",
|
|
24
24
|
"beartype>=0.23.1",
|
|
25
25
|
"interpret>=0.7.8",
|
|
26
|
+
"narwhals>=2.27.1",
|
|
26
27
|
"numpy>=2.5.4",
|
|
27
28
|
"orjson>=3.13.0",
|
|
29
|
+
# only ebaml.core.custom_types imports it, for the type of pd.NA
|
|
28
30
|
"pandas>=3.0.6",
|
|
29
31
|
"scipy>=1.18.1",
|
|
30
32
|
"structlog>=26.1.0",
|
|
@@ -34,8 +36,12 @@ dependencies = [
|
|
|
34
36
|
# The server for agents. Only ebaml.mcp imports these packages. The lower bound of mcp matches the override in
|
|
35
37
|
# the uv override list, so the extra keeps the fixed release after the override goes away.
|
|
36
38
|
mcp = [
|
|
39
|
+
"cyclopts>=5.2.0",
|
|
37
40
|
"joblib>=1.5.0",
|
|
38
41
|
"mcp>=1.30.0",
|
|
42
|
+
# ebaml.mcp reads the CSV file of --data with polars
|
|
43
|
+
"polars>=2.0.0",
|
|
44
|
+
"skops>=0.16.0",
|
|
39
45
|
]
|
|
40
46
|
|
|
41
47
|
[project.scripts]
|
|
@@ -127,6 +133,20 @@ ignore = [
|
|
|
127
133
|
preview = true
|
|
128
134
|
select = ["ALL"]
|
|
129
135
|
|
|
136
|
+
# Each banned module names its replacement. Ruff fails in the editor and shows the message; an exception is an inline
|
|
137
|
+
# `# ruff: ignore[banned-api] -- <reason>` on the import.
|
|
138
|
+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
|
|
139
|
+
"argparse".msg = "Use cyclopts. See .claude/rules/libraries.md."
|
|
140
|
+
"cloudpickle".msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
141
|
+
"dataclasses".msg = "Use attrs. See .claude/rules/libraries.md."
|
|
142
|
+
"dill".msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
143
|
+
"joblib".msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
144
|
+
"json".msg = "Use orjson. See .claude/rules/libraries.md."
|
|
145
|
+
"logging".msg = "Use structlog. See .claude/rules/libraries.md."
|
|
146
|
+
"pandas".msg = "Take a frame with narwhals, or read data with polars. See .claude/rules/libraries.md."
|
|
147
|
+
"pickle".msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
148
|
+
"shelve".msg = "Use skops.io. See .claude/rules/libraries.md."
|
|
149
|
+
|
|
130
150
|
[tool.ruff.lint.per-file-ignores]
|
|
131
151
|
# reason: recurring pattern in tests/: pytest tests use bare assert, literal expected values and private members by design,
|
|
132
152
|
# and are not public API, so docstrings are not required.
|
|
@@ -147,6 +167,7 @@ select = ["ALL"]
|
|
|
147
167
|
[dependency-groups]
|
|
148
168
|
dev = [
|
|
149
169
|
"cosmic-ray>=8.7.0",
|
|
170
|
+
"cyclopts>=5.2.0",
|
|
150
171
|
"deptry>=0.25.1",
|
|
151
172
|
"hypothesis>=6.170.1",
|
|
152
173
|
"import-linter>=2.15",
|
|
@@ -161,6 +182,7 @@ dev = [
|
|
|
161
182
|
"ruff>=0.17.0",
|
|
162
183
|
"scipy-stubs>=1.18.1.1",
|
|
163
184
|
"semgrep>=1.181.0",
|
|
185
|
+
"skops>=0.16.0",
|
|
164
186
|
"sybil>=10.1.0",
|
|
165
187
|
"types-pyyaml>=6.0.12.20260906",
|
|
166
188
|
"typst>=0.15.0",
|
|
@@ -175,6 +197,7 @@ docs = [
|
|
|
175
197
|
# the commit-msg hook and the commits workflow install only this group to check commit messages
|
|
176
198
|
commits = [
|
|
177
199
|
"commitizen>=4.19.2",
|
|
200
|
+
"cyclopts>=5.2.0",
|
|
178
201
|
]
|
|
179
202
|
# the release workflow installs only this group to collect the changelog fragments
|
|
180
203
|
release = [
|
|
@@ -183,8 +206,9 @@ release = [
|
|
|
183
206
|
|
|
184
207
|
[tool.vulture]
|
|
185
208
|
# reason: recurring patterns: fixtures are used through pytest's name-based injection, and the functions that
|
|
186
|
-
# @server.tool and @server.resource register are called by the MCP SDK by name
|
|
187
|
-
|
|
209
|
+
# @server.tool and @server.resource register are called by the MCP SDK by name, and cyclopts calls the functions that
|
|
210
|
+
# @app.default and @app.command register from the command line. Vulture cannot see any of them.
|
|
211
|
+
ignore_decorators = ["@pytest.fixture", "@server.tool", "@server.resource", "@app.default", "@app.command*"]
|
|
188
212
|
# reason: pytest reads pytestmark and the pytest_* hooks of a conftest.py by name, code never references them, so vulture
|
|
189
213
|
# reports them as unused.
|
|
190
214
|
ignore_names = ["pytestmark", "pytest_*"]
|
|
@@ -4,18 +4,25 @@ import enum
|
|
|
4
4
|
from collections.abc import Iterable, Mapping, Sequence
|
|
5
5
|
from collections.abc import Set as AbstractSet
|
|
6
6
|
from decimal import Decimal
|
|
7
|
+
from typing import Any
|
|
7
8
|
|
|
9
|
+
import narwhals as nw
|
|
8
10
|
import numpy as np
|
|
9
11
|
from interpret.glassbox import (
|
|
10
12
|
ExplainableBoostingClassifier, # pyrefly: ignore[implicit-reexport] -- interpret.glassbox has no __all__, so pyrefly reads its public classes as private imports
|
|
11
13
|
ExplainableBoostingRegressor, # pyrefly: ignore[implicit-reexport] -- interpret.glassbox has no __all__, so pyrefly reads its public classes as private imports
|
|
12
14
|
)
|
|
13
|
-
from pandas.api.typing import NAType
|
|
15
|
+
from pandas.api.typing import NAType # ruff: ignore[banned-api] -- pd.NA has a type of its own, and only pandas exports it
|
|
14
16
|
|
|
15
17
|
from ebaml.core.exceptions import InvalidOptionError
|
|
16
18
|
|
|
17
19
|
ExplainableBoostingModel = ExplainableBoostingClassifier | ExplainableBoostingRegressor
|
|
18
20
|
|
|
21
|
+
# The type of pd.NA. This is the only place in ebaml that imports pandas, so the rest of the code stays neutral.
|
|
22
|
+
PANDAS_NA_TYPE: type[NAType] = NAType
|
|
23
|
+
|
|
24
|
+
# A data frame of any library that narwhals supports.
|
|
25
|
+
type Frame = nw.DataFrame[Any]
|
|
19
26
|
# A label of a class, as NumPy's tolist() and item() return it. The numeric tower lets float cover int and bool.
|
|
20
27
|
type ClassLabel = str | float
|
|
21
28
|
# A value of one feature of an instance. A row of a pandas DataFrame gives NumPy scalars, a nullable column gives pd.NA,
|
|
@@ -23,8 +30,9 @@ type ClassLabel = str | float
|
|
|
23
30
|
type FeatureValue = str | float | Decimal | np.generic | NAType | None
|
|
24
31
|
# A JSON value of the texts for the prompts. The abstract containers keep a list[str] or a dict[str, float] assignable,
|
|
25
32
|
# so the hint also accepts a Sequence or a Mapping that orjson cannot write (a range, a MappingProxyType). orjson raises
|
|
26
|
-
# for those when it writes the text.
|
|
27
|
-
type
|
|
33
|
+
# for those when it writes the text. The numeric tower already lets float cover bool, but JSON has true and false as a
|
|
34
|
+
# type of its own, so the hint names bool.
|
|
35
|
+
type JSONValue = str | bool | float | Sequence[JSONValue] | Mapping[str, JSONValue] | None
|
|
28
36
|
|
|
29
37
|
|
|
30
38
|
class Normalization(enum.StrEnum):
|
|
@@ -28,9 +28,8 @@ import attrs
|
|
|
28
28
|
import numpy as np
|
|
29
29
|
import numpy.typing as npt
|
|
30
30
|
from interpret.utils._clean_x import _densify_categorical # ruff: ignore[import-private-name] -- interpret has no public function that writes a value as the text of its category
|
|
31
|
-
from pandas.api.typing import NAType
|
|
32
31
|
|
|
33
|
-
from ebaml.core.custom_types import ClassLabel, ExplainableBoostingModel, FeatureValue
|
|
32
|
+
from ebaml.core.custom_types import PANDAS_NA_TYPE, ClassLabel, ExplainableBoostingModel, FeatureValue
|
|
34
33
|
from ebaml.core.exceptions import InvalidInstanceError, OptionRangeError, UnsupportedModelError
|
|
35
34
|
from ebaml.graphs.ebm_graph import EBMGraph
|
|
36
35
|
from ebaml.graphs.model_kinds import BinaryClassifier, model_kind
|
|
@@ -264,7 +263,11 @@ def _bin_index(ebm: ExplainableBoostingModel, feature_index: int, graph: EBMGrap
|
|
|
264
263
|
|
|
265
264
|
"""
|
|
266
265
|
# the missing markers of a FeatureValue: None, pd.NA, and a NaN of Python or of any NumPy float type
|
|
267
|
-
if
|
|
266
|
+
if (
|
|
267
|
+
value is None
|
|
268
|
+
or isinstance(value, PANDAS_NA_TYPE)
|
|
269
|
+
or (isinstance(value, float | np.floating) and math.isnan(value))
|
|
270
|
+
):
|
|
268
271
|
msg = f"Feature {graph.feature_name!r} is missing; local explanations need every input."
|
|
269
272
|
raise InvalidInstanceError(msg)
|
|
270
273
|
if graph.feature_type == "continuous":
|
|
@@ -4,13 +4,17 @@ The user gives the paths at start. No tool argument names a path, so an agent ca
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import os
|
|
7
|
+
import zipfile
|
|
7
8
|
|
|
8
9
|
import attrs
|
|
9
|
-
import joblib
|
|
10
|
-
import
|
|
10
|
+
import joblib # ruff: ignore[banned-api] -- ebaml-mcp also loads the joblib files that users saved, and the user trusts the file by naming its path
|
|
11
|
+
import narwhals as nw
|
|
12
|
+
import polars as pl
|
|
13
|
+
import skops.io
|
|
14
|
+
import skops.io.exceptions
|
|
11
15
|
from interpret.glassbox import ExplainableBoostingClassifier, ExplainableBoostingRegressor # pyrefly: ignore[implicit-reexport] -- interpret.glassbox has no __all__, so pyrefly reads its public classes as private imports
|
|
12
16
|
|
|
13
|
-
from ebaml.core.custom_types import ExplainableBoostingModel, FeatureValue
|
|
17
|
+
from ebaml.core.custom_types import ExplainableBoostingModel, FeatureValue, Frame
|
|
14
18
|
from ebaml.core.exceptions import InvalidInstanceError, UnsupportedModelError
|
|
15
19
|
|
|
16
20
|
|
|
@@ -22,15 +26,16 @@ class ModelStore:
|
|
|
22
26
|
----------
|
|
23
27
|
ebm: ExplainableBoostingModel
|
|
24
28
|
The fitted EBM.
|
|
25
|
-
data:
|
|
26
|
-
The rows that the ``row`` argument of the explain tool indexes.
|
|
29
|
+
data: Frame | None
|
|
30
|
+
The rows that the ``row`` argument of the explain tool indexes. Wrap a pandas or polars frame with
|
|
31
|
+
``narwhals.from_native``.
|
|
27
32
|
model_description: str | None
|
|
28
33
|
The output of ``describe_ebm``. The first call computes it and the next calls reuse it.
|
|
29
34
|
|
|
30
35
|
"""
|
|
31
36
|
|
|
32
37
|
ebm: ExplainableBoostingModel
|
|
33
|
-
data:
|
|
38
|
+
data: Frame | None = None
|
|
34
39
|
model_description: str | None = None
|
|
35
40
|
|
|
36
41
|
def feature_index(self, feature: str) -> int:
|
|
@@ -89,14 +94,49 @@ class ModelStore:
|
|
|
89
94
|
if missing:
|
|
90
95
|
msg = f"The data has no column for these features: {missing}."
|
|
91
96
|
raise InvalidInstanceError(msg)
|
|
92
|
-
|
|
97
|
+
values = dict(zip(self.data.columns, self.data.row(row), strict=True))
|
|
98
|
+
return {name: values[name] for name in names}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
_EBM_CLASSES = (ExplainableBoostingClassifier, ExplainableBoostingRegressor)
|
|
102
|
+
# skops loads only the types that the caller names. The EBM classes are the only types that the file may need.
|
|
103
|
+
_TRUSTED_TYPES = [f"{cls.__module__}.{cls.__qualname__}" for cls in _EBM_CLASSES]
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _load_skops(
|
|
107
|
+
path: str | os.PathLike[str],
|
|
108
|
+
) -> object: # nosemgrep: ebaml-no-object-type -- a file of any content, which the caller checks
|
|
109
|
+
"""Load a skops file and trust only the EBM classes.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
path: str | os.PathLike[str]
|
|
114
|
+
The skops file.
|
|
115
|
+
|
|
116
|
+
Returns
|
|
117
|
+
-------
|
|
118
|
+
object
|
|
119
|
+
The object in the file.
|
|
120
|
+
|
|
121
|
+
Raises
|
|
122
|
+
------
|
|
123
|
+
UnsupportedModelError
|
|
124
|
+
If the file holds a type other than an EBM class.
|
|
125
|
+
|
|
126
|
+
"""
|
|
127
|
+
try:
|
|
128
|
+
return skops.io.load(os.fspath(path), trusted=_TRUSTED_TYPES)
|
|
129
|
+
except skops.io.exceptions.UntrustedTypesFoundException as error:
|
|
130
|
+
msg = f"The file {os.fspath(path)!r} holds types that the server does not trust: {error}"
|
|
131
|
+
raise UnsupportedModelError(msg) from error
|
|
93
132
|
|
|
94
133
|
|
|
95
134
|
def load_model(path: str | os.PathLike[str]) -> ExplainableBoostingModel:
|
|
96
|
-
"""Load a pickled or joblib
|
|
135
|
+
"""Load an EBM from a skops file, or from a pickled or joblib file, of the path that the user gave.
|
|
97
136
|
|
|
98
|
-
|
|
99
|
-
|
|
137
|
+
A skops file is a zip archive. The loader trusts only the EBM classes, so a skops file runs no code. A pickled or
|
|
138
|
+
joblib file runs code from the file. Call this function only with a path from the command line of the user, never
|
|
139
|
+
with a path from a tool argument.
|
|
100
140
|
|
|
101
141
|
Parameters
|
|
102
142
|
----------
|
|
@@ -111,17 +151,17 @@ def load_model(path: str | os.PathLike[str]) -> ExplainableBoostingModel:
|
|
|
111
151
|
Raises
|
|
112
152
|
------
|
|
113
153
|
UnsupportedModelError
|
|
114
|
-
If the file does not hold an EBM.
|
|
154
|
+
If the file does not hold an EBM, or a skops file holds an untrusted type.
|
|
115
155
|
|
|
116
156
|
"""
|
|
117
|
-
model = joblib.load(path)
|
|
118
|
-
if not isinstance(model,
|
|
157
|
+
model = _load_skops(path) if zipfile.is_zipfile(path) else joblib.load(path)
|
|
158
|
+
if not isinstance(model, _EBM_CLASSES):
|
|
119
159
|
msg = f"The file {os.fspath(path)!r} does not hold an EBM. It holds a {type(model).__name__}."
|
|
120
160
|
raise UnsupportedModelError(msg)
|
|
121
161
|
return model
|
|
122
162
|
|
|
123
163
|
|
|
124
|
-
def load_data(path: str | os.PathLike[str]) ->
|
|
164
|
+
def load_data(path: str | os.PathLike[str]) -> Frame:
|
|
125
165
|
"""Read the CSV file of the data.
|
|
126
166
|
|
|
127
167
|
Parameters
|
|
@@ -131,8 +171,8 @@ def load_data(path: str | os.PathLike[str]) -> pd.DataFrame:
|
|
|
131
171
|
|
|
132
172
|
Returns
|
|
133
173
|
-------
|
|
134
|
-
|
|
174
|
+
Frame
|
|
135
175
|
The rows.
|
|
136
176
|
|
|
137
177
|
"""
|
|
138
|
-
return
|
|
178
|
+
return nw.from_native(pl.read_csv(os.fspath(path))) # pyrefly: ignore[no-matching-overload] -- pyrefly rejects every overload of narwhals.from_native for a polars frame
|
|
@@ -11,6 +11,7 @@ from ebaml.core.custom_types import ClassLabel, Normalization
|
|
|
11
11
|
from ebaml.graphs.ebm_graph import EBMGraph
|
|
12
12
|
from ebaml.graphs.model_kinds import model_kind
|
|
13
13
|
from ebaml.graphs.terms import main_effect_features, main_term
|
|
14
|
+
from ebaml.graphs.token_budget import check_token_budget
|
|
14
15
|
from ebaml.mcp.model_store import ModelStore
|
|
15
16
|
|
|
16
17
|
|
|
@@ -152,4 +153,5 @@ def graph_text( # ruff: ignore[too-many-arguments] -- one argument for each opt
|
|
|
152
153
|
x_axis_precision=x_axis_precision,
|
|
153
154
|
y_axis_precision=y_axis_precision,
|
|
154
155
|
max_tokens=max_tokens,
|
|
156
|
+
check_budget=check_token_budget,
|
|
155
157
|
)
|
|
@@ -4,14 +4,16 @@ Each tool is a thin adapter. It calls a function of a lower layer and turns the
|
|
|
4
4
|
(``EBaMlError``) becomes a tool error with its message.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import argparse
|
|
8
7
|
import contextlib
|
|
8
|
+
import sys
|
|
9
9
|
from collections.abc import Generator, Mapping, Sequence
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
from typing import Literal
|
|
12
12
|
|
|
13
13
|
import attrs
|
|
14
|
+
import cyclopts
|
|
14
15
|
import orjson
|
|
16
|
+
import structlog
|
|
15
17
|
from mcp.server.fastmcp import FastMCP
|
|
16
18
|
from mcp.server.fastmcp.exceptions import ToolError
|
|
17
19
|
|
|
@@ -207,6 +209,41 @@ def _register_llm_tools(server: FastMCP, store: ModelStore, llm: ModelOptions) -
|
|
|
207
209
|
return llm_tools.describe_model(store, llm)
|
|
208
210
|
|
|
209
211
|
|
|
212
|
+
app: cyclopts.App = cyclopts.App(
|
|
213
|
+
name="ebaml-mcp",
|
|
214
|
+
help="Serve a fitted EBM to an MCP client.",
|
|
215
|
+
result_action="return_value",
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
@app.default
|
|
220
|
+
def serve(
|
|
221
|
+
*,
|
|
222
|
+
model: Path,
|
|
223
|
+
data: Path | None = None,
|
|
224
|
+
llm: str | None = None,
|
|
225
|
+
transport: Literal["stdio", "streamable-http"] = "stdio",
|
|
226
|
+
) -> None:
|
|
227
|
+
"""Load the EBM and run the MCP server.
|
|
228
|
+
|
|
229
|
+
Parameters
|
|
230
|
+
----------
|
|
231
|
+
model: Path
|
|
232
|
+
EBM in a skops file, which runs no code, or in a pickled or joblib file, which does.
|
|
233
|
+
data: Path, optional
|
|
234
|
+
CSV file with the rows for the row argument.
|
|
235
|
+
llm: str, optional
|
|
236
|
+
PROVIDER/MODEL of the LLM tools. Without it the server has none.
|
|
237
|
+
transport: Literal["stdio", "streamable-http"]
|
|
238
|
+
How the server talks to the client.
|
|
239
|
+
|
|
240
|
+
"""
|
|
241
|
+
# structlog prints to stdout by default, and a stdio server speaks JSON-RPC there, so a log line would corrupt it
|
|
242
|
+
structlog.configure(logger_factory=structlog.PrintLoggerFactory(file=sys.stderr))
|
|
243
|
+
store = ModelStore(ebm=load_model(model), data=load_data(data) if data else None)
|
|
244
|
+
create_server(store, ModelOptions.parse(llm) if llm else None).run(transport=transport)
|
|
245
|
+
|
|
246
|
+
|
|
210
247
|
def main(argv: Sequence[str] | None = None) -> None:
|
|
211
248
|
"""Run the ``ebaml-mcp`` command.
|
|
212
249
|
|
|
@@ -216,15 +253,4 @@ def main(argv: Sequence[str] | None = None) -> None:
|
|
|
216
253
|
The arguments. The default is the command line.
|
|
217
254
|
|
|
218
255
|
"""
|
|
219
|
-
|
|
220
|
-
parser.add_argument("--model", required=True, type=Path, help="pickled or joblib EBM; loading it runs code")
|
|
221
|
-
parser.add_argument("--data", type=Path, help="CSV file with the rows for the row argument")
|
|
222
|
-
parser.add_argument("--llm", help="PROVIDER/MODEL of the LLM tools; without it the server has none")
|
|
223
|
-
parser.add_argument("--transport", choices=["stdio", "streamable-http"], default="stdio")
|
|
224
|
-
arguments = parser.parse_args(argv)
|
|
225
|
-
store = ModelStore(
|
|
226
|
-
ebm=load_model(arguments.model),
|
|
227
|
-
data=load_data(arguments.data) if arguments.data else None,
|
|
228
|
-
)
|
|
229
|
-
llm = ModelOptions.parse(arguments.llm) if arguments.llm else None
|
|
230
|
-
create_server(store, llm).run(transport=arguments.transport)
|
|
256
|
+
app(None if argv is None else list(argv))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|