ebaml 0.3.2__tar.gz → 0.4.0__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.3.2 → ebaml-0.4.0}/PKG-INFO +26 -16
- {ebaml-0.3.2 → ebaml-0.4.0}/README.md +22 -15
- {ebaml-0.3.2 → ebaml-0.4.0}/pyproject.toml +40 -6
- {ebaml-0.3.2 → ebaml-0.4.0}/pyproject.toml.orig +32 -10
- ebaml-0.4.0/src/ebaml/__init__.py +176 -0
- ebaml-0.4.0/src/ebaml/mcp/__init__.py +4 -0
- ebaml-0.4.0/src/ebaml/mcp/explain_tools.py +71 -0
- ebaml-0.4.0/src/ebaml/mcp/llm_tools.py +47 -0
- ebaml-0.4.0/src/ebaml/mcp/model_store.py +138 -0
- ebaml-0.4.0/src/ebaml/mcp/read_tools.py +155 -0
- ebaml-0.4.0/src/ebaml/mcp/server.py +230 -0
- ebaml-0.3.2/src/ebaml/__init__.py +0 -75
- {ebaml-0.3.2 → ebaml-0.4.0}/LICENSE +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/.baml-generator-output-root +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/.baml-generator-output.json +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/.gitignore +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_baml_sources.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_function_registry.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_inlinedbaml.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_invocation_types.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_invocation_types.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/_typemap.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/clients/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/clients/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/content/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/content/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/errors/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/errors/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/events/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/events/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/mcp/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/mcp/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/stream/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/stream/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/tools/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/tools/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/wire/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/ai/wire/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/crypto/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/crypto/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/csv/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/csv/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/env/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/env/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/errors/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/errors/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/fs/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/fs/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/future/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/future/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/glob/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/glob/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/hash/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/hash/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/host/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/host/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/http/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/http/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/io/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/io/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/iter/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/iter/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/json/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/json/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/media/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/media/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/net/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/net/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/ops/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/ops/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/panics/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/panics/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/random/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/random/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/regex/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/regex/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/sap/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/sap/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/spawn/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/spawn/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/sys/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/sys/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/time/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/time/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/toml/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/toml/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/ws/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/ws/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/yaml/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/baml/yaml/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/experimental/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/experimental/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/py.typed +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/class_/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/class_/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/enum/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/enum/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/errors/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/errors/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/function/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/function/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/interface/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/reflect/interface/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/anthropic/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/anthropic/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/anthropic/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/anthropic/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/assert_/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/assert_/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/aws/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/aws/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/aws/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/aws/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/claude_code/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/claude_code/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/claude_code/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/claude_code/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/google/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/google/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/google/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/google/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/internal/decisions/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/openai/internal/decisions/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/testing/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/testing/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/trace/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/trace/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/typesafeai/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/typesafeai/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/typesafeai/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/typesafeai/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/vercel/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/vercel/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/vercel/internal/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/baml_sdk/vendor/vercel/internal/__init__.pyi +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/benchmark.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/core/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/core/custom_types.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/core/exceptions.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/ebm_graph.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/graph_text.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/model_kinds.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/request_text.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/terms.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/token_budget.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/graphs/token_weights.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/descriptors.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/options.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/provider_errors.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/retry.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/sdk_setup.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/token_learning.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/llm/token_weights.json +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/local/__init__.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/local/audience.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/local/fact_text.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/local/facts.py +0 -0
- {ebaml-0.3.2 → ebaml-0.4.0}/src/ebaml/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ebaml
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
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
|
|
@@ -22,11 +22,14 @@ Requires-Dist: orjson>=3.13.0
|
|
|
22
22
|
Requires-Dist: pandas>=3.0.6
|
|
23
23
|
Requires-Dist: scipy>=1.18.1
|
|
24
24
|
Requires-Dist: structlog>=26.1.0
|
|
25
|
+
Requires-Dist: joblib>=1.5.0 ; extra == 'mcp'
|
|
26
|
+
Requires-Dist: mcp>=1.30.0 ; extra == 'mcp'
|
|
25
27
|
Requires-Python: >=3.13
|
|
26
28
|
Project-URL: Documentation, https://johnny-godoy.github.io/EBaMl/
|
|
27
29
|
Project-URL: Source, https://github.com/johnny-godoy/EBaMl
|
|
28
30
|
Project-URL: Issues, https://github.com/johnny-godoy/EBaMl/issues
|
|
29
31
|
Project-URL: Changelog, https://github.com/johnny-godoy/EBaMl/blob/main/CHANGELOG.md
|
|
32
|
+
Provides-Extra: mcp
|
|
30
33
|
Description-Content-Type: text/markdown
|
|
31
34
|
|
|
32
35
|
# EBaMl
|
|
@@ -52,11 +55,13 @@ LLM calls go through [OpenRouter](https://openrouter.ai)'s free router (`openrou
|
|
|
52
55
|
| Model summary (`describe_ebm`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
53
56
|
| Graph text (`EBMGraph`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
54
57
|
| Local explanations (`explain_instance`) | ✅ | ❌ | ❌ | ❌ |
|
|
58
|
+
| MCP server (`ebaml-mcp`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
55
59
|
|
|
56
60
|
✅ supported. ⚠️ partly supported: the main effects are described, and the interaction terms are skipped.
|
|
57
61
|
`describe_graph` and `describe_ebm` log an `interactions_skipped` warning that names them. ❌ not supported yet. Full support is on the
|
|
58
62
|
[roadmap](https://github.com/johnny-godoy/EBaMl/blob/main/ROADMAP.md).
|
|
59
63
|
<!-- --8<-- [end:supported-models] -->
|
|
64
|
+
The MCP server reads every kind of model. Its explain tool works for binary classifiers only.
|
|
60
65
|
## Setup
|
|
61
66
|
|
|
62
67
|
<!-- --8<-- [start:setup] -->
|
|
@@ -124,10 +129,10 @@ baml generate
|
|
|
124
129
|
This writes the `src/baml_sdk/` package from `baml_src/`, next to `ebaml`, so it imports wherever the project is
|
|
125
130
|
installed. Rerun it every time a `.baml` file changes, including when you change the provider.
|
|
126
131
|
|
|
127
|
-
If `src/baml_sdk/` does not exist,
|
|
128
|
-
|
|
129
|
-
`baml
|
|
130
|
-
again with `--agent-skill-check off`. If none of this works, `SDKUnavailableError` lists the steps that fix the cause.
|
|
132
|
+
If `src/baml_sdk/` does not exist, the first use of `describe_graph`, `describe_ebm` or `explain_instance` runs
|
|
133
|
+
`baml generate`. `import ebaml` alone does not run it. If the package was generated by another BAML toolchain than the one
|
|
134
|
+
that `baml-bridge` expects (a version skew), the first use runs `baml toolchain use <version>` and `baml generate`. If
|
|
135
|
+
the agent skill check stops `baml generate`, the first use runs it again with `--agent-skill-check off`. If none of this works, `SDKUnavailableError` lists the steps that fix the cause.
|
|
131
136
|
|
|
132
137
|
### 5. Check the setup
|
|
133
138
|
|
|
@@ -169,8 +174,8 @@ It fits a small EBM, runs the three-turn chain directly and checks that the prov
|
|
|
169
174
|
```python
|
|
170
175
|
from interpret.glassbox import ExplainableBoostingClassifier
|
|
171
176
|
|
|
172
|
-
from ebaml
|
|
173
|
-
from ebaml
|
|
177
|
+
from ebaml import describe_ebm, describe_graph
|
|
178
|
+
from ebaml import PromptOptions
|
|
174
179
|
|
|
175
180
|
ebm = ExplainableBoostingClassifier().fit(X, y)
|
|
176
181
|
|
|
@@ -184,7 +189,7 @@ embedded in a longer prompt. It needs the confidence bounds, and it only reads c
|
|
|
184
189
|
Three keyword-only arguments set the options. `graph=GraphOptions(...)` sets the options of `EBMGraph.from_ebm` and
|
|
185
190
|
`EBMGraph.to_text`, for example `max_tokens`. `prompt=PromptOptions(...)` sets the descriptions that the prompts use
|
|
186
191
|
(`expert_description`, `graph_description`, `dataset_description` and `task_description`). `model=` selects the LLM, see
|
|
187
|
-
"Choosing the model".
|
|
192
|
+
"Choosing the model". `GraphOptions`, `PromptOptions` and `ModelOptions` are importable from `ebaml`. Token usage reported by the provider is logged at `INFO` on the `ebaml.llm.descriptors` logger.
|
|
188
193
|
|
|
189
194
|
A multiclass classifier has one graph series per class. `GraphOptions(classes=[...])` selects the classes to describe,
|
|
190
195
|
because the text of a model with many classes is long. In every bin, the scores have the same mean over all the classes
|
|
@@ -199,7 +204,7 @@ y_multiclass = np.select([X["age"] < 30, X["age"] < 60], ["young", "middle"], "o
|
|
|
199
204
|
-->
|
|
200
205
|
|
|
201
206
|
```python
|
|
202
|
-
from ebaml
|
|
207
|
+
from ebaml import GraphOptions
|
|
203
208
|
|
|
204
209
|
multiclass = ExplainableBoostingClassifier(interactions=0).fit(X, y_multiclass)
|
|
205
210
|
print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["young", "old"])))
|
|
@@ -208,7 +213,7 @@ print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["y
|
|
|
208
213
|
### Explaining one prediction
|
|
209
214
|
|
|
210
215
|
```python
|
|
211
|
-
from ebaml
|
|
216
|
+
from ebaml import describe_ebm, explain_instance
|
|
212
217
|
|
|
213
218
|
ebm = ExplainableBoostingClassifier(interactions=0).fit(X, y) # binary classifier, no interactions
|
|
214
219
|
global_explanation = describe_ebm(ebm) # computed once, prepended to every local prompt
|
|
@@ -252,8 +257,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
252
257
|
| `RateLimitedError` | no | A provider limits the rate of the requests. |
|
|
253
258
|
| `ProviderUnreachableError` | no | A request does not reach the provider. |
|
|
254
259
|
|
|
255
|
-
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`.
|
|
256
|
-
them too.
|
|
260
|
+
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`. `ebaml` exports all of these classes.
|
|
257
261
|
|
|
258
262
|
<!-- --8<-- [end:usage] -->
|
|
259
263
|
## How it works
|
|
@@ -288,9 +292,9 @@ them too.
|
|
|
288
292
|
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
289
293
|
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
290
294
|
`max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes `to_text` simplify the graph, or
|
|
291
|
-
raise if it cannot. The provider's own error is the real limit.
|
|
295
|
+
raise if it cannot. The provider's own error is the real limit. `describe_graph`, `describe_ebm` and `explain_instance` pass the
|
|
292
296
|
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
293
|
-
`ebaml.
|
|
297
|
+
`ebaml.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
294
298
|
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
295
299
|
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
296
300
|
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
@@ -343,6 +347,12 @@ graph.
|
|
|
343
347
|
uv run marimo edit notebooks/model_kinds.py
|
|
344
348
|
```
|
|
345
349
|
|
|
350
|
+
## MCP server
|
|
351
|
+
|
|
352
|
+
`ebaml-mcp` serves a fitted EBM to an agent, for example Claude Code. The agent reads the features and the graphs, and
|
|
353
|
+
explains one prediction with the exact local facts. These tools call no LLM, so they need no key. See the
|
|
354
|
+
[MCP server guide](https://johnny-godoy.github.io/EBaMl/mcp/).
|
|
355
|
+
|
|
346
356
|
## Benchmark
|
|
347
357
|
|
|
348
358
|
The benchmark follows [TalkToEBM's benchmark](https://github.com/interpretml/TalkToEBM/tree/main/benchmark) that checks how well a
|
|
@@ -368,7 +378,7 @@ request of that call to that model. You do not change the package.
|
|
|
368
378
|
Pass the shorthand `"provider/model"`:
|
|
369
379
|
|
|
370
380
|
```python
|
|
371
|
-
from ebaml
|
|
381
|
+
from ebaml import describe_ebm
|
|
372
382
|
|
|
373
383
|
print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
374
384
|
```
|
|
@@ -376,7 +386,7 @@ print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
|
376
386
|
Pass `ModelOptions` to set more:
|
|
377
387
|
|
|
378
388
|
```python
|
|
379
|
-
from ebaml
|
|
389
|
+
from ebaml import ModelOptions
|
|
380
390
|
|
|
381
391
|
model = ModelOptions(provider="anthropic", model="claude-haiku-4-5", temperature=0.2, max_output_tokens=8000)
|
|
382
392
|
print(describe_ebm(ebm, model=model))
|
|
@@ -21,11 +21,13 @@ LLM calls go through [OpenRouter](https://openrouter.ai)'s free router (`openrou
|
|
|
21
21
|
| Model summary (`describe_ebm`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
22
22
|
| Graph text (`EBMGraph`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
23
23
|
| Local explanations (`explain_instance`) | ✅ | ❌ | ❌ | ❌ |
|
|
24
|
+
| MCP server (`ebaml-mcp`) | ✅ | ✅ | ✅ | ⚠️ |
|
|
24
25
|
|
|
25
26
|
✅ supported. ⚠️ partly supported: the main effects are described, and the interaction terms are skipped.
|
|
26
27
|
`describe_graph` and `describe_ebm` log an `interactions_skipped` warning that names them. ❌ not supported yet. Full support is on the
|
|
27
28
|
[roadmap](https://github.com/johnny-godoy/EBaMl/blob/main/ROADMAP.md).
|
|
28
29
|
<!-- --8<-- [end:supported-models] -->
|
|
30
|
+
The MCP server reads every kind of model. Its explain tool works for binary classifiers only.
|
|
29
31
|
## Setup
|
|
30
32
|
|
|
31
33
|
<!-- --8<-- [start:setup] -->
|
|
@@ -93,10 +95,10 @@ baml generate
|
|
|
93
95
|
This writes the `src/baml_sdk/` package from `baml_src/`, next to `ebaml`, so it imports wherever the project is
|
|
94
96
|
installed. Rerun it every time a `.baml` file changes, including when you change the provider.
|
|
95
97
|
|
|
96
|
-
If `src/baml_sdk/` does not exist,
|
|
97
|
-
|
|
98
|
-
`baml
|
|
99
|
-
again with `--agent-skill-check off`. If none of this works, `SDKUnavailableError` lists the steps that fix the cause.
|
|
98
|
+
If `src/baml_sdk/` does not exist, the first use of `describe_graph`, `describe_ebm` or `explain_instance` runs
|
|
99
|
+
`baml generate`. `import ebaml` alone does not run it. If the package was generated by another BAML toolchain than the one
|
|
100
|
+
that `baml-bridge` expects (a version skew), the first use runs `baml toolchain use <version>` and `baml generate`. If
|
|
101
|
+
the agent skill check stops `baml generate`, the first use runs it again with `--agent-skill-check off`. If none of this works, `SDKUnavailableError` lists the steps that fix the cause.
|
|
100
102
|
|
|
101
103
|
### 5. Check the setup
|
|
102
104
|
|
|
@@ -138,8 +140,8 @@ It fits a small EBM, runs the three-turn chain directly and checks that the prov
|
|
|
138
140
|
```python
|
|
139
141
|
from interpret.glassbox import ExplainableBoostingClassifier
|
|
140
142
|
|
|
141
|
-
from ebaml
|
|
142
|
-
from ebaml
|
|
143
|
+
from ebaml import describe_ebm, describe_graph
|
|
144
|
+
from ebaml import PromptOptions
|
|
143
145
|
|
|
144
146
|
ebm = ExplainableBoostingClassifier().fit(X, y)
|
|
145
147
|
|
|
@@ -153,7 +155,7 @@ embedded in a longer prompt. It needs the confidence bounds, and it only reads c
|
|
|
153
155
|
Three keyword-only arguments set the options. `graph=GraphOptions(...)` sets the options of `EBMGraph.from_ebm` and
|
|
154
156
|
`EBMGraph.to_text`, for example `max_tokens`. `prompt=PromptOptions(...)` sets the descriptions that the prompts use
|
|
155
157
|
(`expert_description`, `graph_description`, `dataset_description` and `task_description`). `model=` selects the LLM, see
|
|
156
|
-
"Choosing the model".
|
|
158
|
+
"Choosing the model". `GraphOptions`, `PromptOptions` and `ModelOptions` are importable from `ebaml`. Token usage reported by the provider is logged at `INFO` on the `ebaml.llm.descriptors` logger.
|
|
157
159
|
|
|
158
160
|
A multiclass classifier has one graph series per class. `GraphOptions(classes=[...])` selects the classes to describe,
|
|
159
161
|
because the text of a model with many classes is long. In every bin, the scores have the same mean over all the classes
|
|
@@ -168,7 +170,7 @@ y_multiclass = np.select([X["age"] < 30, X["age"] < 60], ["young", "middle"], "o
|
|
|
168
170
|
-->
|
|
169
171
|
|
|
170
172
|
```python
|
|
171
|
-
from ebaml
|
|
173
|
+
from ebaml import GraphOptions
|
|
172
174
|
|
|
173
175
|
multiclass = ExplainableBoostingClassifier(interactions=0).fit(X, y_multiclass)
|
|
174
176
|
print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["young", "old"])))
|
|
@@ -177,7 +179,7 @@ print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["y
|
|
|
177
179
|
### Explaining one prediction
|
|
178
180
|
|
|
179
181
|
```python
|
|
180
|
-
from ebaml
|
|
182
|
+
from ebaml import describe_ebm, explain_instance
|
|
181
183
|
|
|
182
184
|
ebm = ExplainableBoostingClassifier(interactions=0).fit(X, y) # binary classifier, no interactions
|
|
183
185
|
global_explanation = describe_ebm(ebm) # computed once, prepended to every local prompt
|
|
@@ -221,8 +223,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
221
223
|
| `RateLimitedError` | no | A provider limits the rate of the requests. |
|
|
222
224
|
| `ProviderUnreachableError` | no | A request does not reach the provider. |
|
|
223
225
|
|
|
224
|
-
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`.
|
|
225
|
-
them too.
|
|
226
|
+
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`. `ebaml` exports all of these classes.
|
|
226
227
|
|
|
227
228
|
<!-- --8<-- [end:usage] -->
|
|
228
229
|
## How it works
|
|
@@ -257,9 +258,9 @@ them too.
|
|
|
257
258
|
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
258
259
|
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
259
260
|
`max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes `to_text` simplify the graph, or
|
|
260
|
-
raise if it cannot. The provider's own error is the real limit.
|
|
261
|
+
raise if it cannot. The provider's own error is the real limit. `describe_graph`, `describe_ebm` and `explain_instance` pass the
|
|
261
262
|
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
262
|
-
`ebaml.
|
|
263
|
+
`ebaml.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
263
264
|
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
264
265
|
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
265
266
|
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
@@ -312,6 +313,12 @@ graph.
|
|
|
312
313
|
uv run marimo edit notebooks/model_kinds.py
|
|
313
314
|
```
|
|
314
315
|
|
|
316
|
+
## MCP server
|
|
317
|
+
|
|
318
|
+
`ebaml-mcp` serves a fitted EBM to an agent, for example Claude Code. The agent reads the features and the graphs, and
|
|
319
|
+
explains one prediction with the exact local facts. These tools call no LLM, so they need no key. See the
|
|
320
|
+
[MCP server guide](https://johnny-godoy.github.io/EBaMl/mcp/).
|
|
321
|
+
|
|
315
322
|
## Benchmark
|
|
316
323
|
|
|
317
324
|
The benchmark follows [TalkToEBM's benchmark](https://github.com/interpretml/TalkToEBM/tree/main/benchmark) that checks how well a
|
|
@@ -337,7 +344,7 @@ request of that call to that model. You do not change the package.
|
|
|
337
344
|
Pass the shorthand `"provider/model"`:
|
|
338
345
|
|
|
339
346
|
```python
|
|
340
|
-
from ebaml
|
|
347
|
+
from ebaml import describe_ebm
|
|
341
348
|
|
|
342
349
|
print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
343
350
|
```
|
|
@@ -345,7 +352,7 @@ print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
|
345
352
|
Pass `ModelOptions` to set more:
|
|
346
353
|
|
|
347
354
|
```python
|
|
348
|
-
from ebaml
|
|
355
|
+
from ebaml import ModelOptions
|
|
349
356
|
|
|
350
357
|
model = ModelOptions(provider="anthropic", model="claude-haiku-4-5", temperature=0.2, max_output_tokens=8000)
|
|
351
358
|
print(describe_ebm(ebm, model=model))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -37,6 +37,15 @@ dependencies = [
|
|
|
37
37
|
name = "Johnny Godoy"
|
|
38
38
|
email = "johnny.godoy@ing.uchile.cl"
|
|
39
39
|
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
mcp = [
|
|
42
|
+
"joblib>=1.5.0",
|
|
43
|
+
"mcp>=1.30.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
ebaml-mcp = "ebaml.mcp.server:main"
|
|
48
|
+
|
|
40
49
|
[project.urls]
|
|
41
50
|
Documentation = "https://johnny-godoy.github.io/EBaMl/"
|
|
42
51
|
Source = "https://github.com/johnny-godoy/EBaMl"
|
|
@@ -54,9 +63,6 @@ override-dependencies = [
|
|
|
54
63
|
"opentelemetry-instrumentation-threading>=0.66b0",
|
|
55
64
|
]
|
|
56
65
|
|
|
57
|
-
[tool.uv.exclude-newer-package]
|
|
58
|
-
baml-bridge = false
|
|
59
|
-
|
|
60
66
|
[tool.uv.build-backend]
|
|
61
67
|
module-name = [
|
|
62
68
|
"ebaml",
|
|
@@ -131,7 +137,11 @@ select = ["ALL"]
|
|
|
131
137
|
]
|
|
132
138
|
|
|
133
139
|
[tool.vulture]
|
|
134
|
-
ignore_decorators = [
|
|
140
|
+
ignore_decorators = [
|
|
141
|
+
"@pytest.fixture",
|
|
142
|
+
"@server.tool",
|
|
143
|
+
"@server.resource",
|
|
144
|
+
]
|
|
135
145
|
ignore_names = [
|
|
136
146
|
"pytestmark",
|
|
137
147
|
"pytest_*",
|
|
@@ -155,9 +165,10 @@ root_package = "ebaml"
|
|
|
155
165
|
include_external_packages = true
|
|
156
166
|
|
|
157
167
|
[[tool.importlinter.contracts]]
|
|
158
|
-
name = "Layers: llm over local over graphs over core"
|
|
168
|
+
name = "Layers: mcp over llm over local over graphs over core"
|
|
159
169
|
type = "layers"
|
|
160
170
|
layers = [
|
|
171
|
+
"ebaml.mcp",
|
|
161
172
|
"ebaml.llm",
|
|
162
173
|
"ebaml.local",
|
|
163
174
|
"ebaml.graphs",
|
|
@@ -178,6 +189,28 @@ forbidden_modules = [
|
|
|
178
189
|
"baml_bridge",
|
|
179
190
|
]
|
|
180
191
|
|
|
192
|
+
[[tool.importlinter.contracts]]
|
|
193
|
+
name = "The MCP layer reaches the BAML SDK only through ebaml.llm"
|
|
194
|
+
type = "forbidden"
|
|
195
|
+
source_modules = ["ebaml.mcp"]
|
|
196
|
+
forbidden_modules = [
|
|
197
|
+
"baml_sdk",
|
|
198
|
+
"baml_bridge",
|
|
199
|
+
]
|
|
200
|
+
allow_indirect_imports = true
|
|
201
|
+
|
|
202
|
+
[[tool.importlinter.contracts]]
|
|
203
|
+
name = "Only ebaml.mcp imports the MCP SDK"
|
|
204
|
+
type = "forbidden"
|
|
205
|
+
source_modules = [
|
|
206
|
+
"ebaml.core",
|
|
207
|
+
"ebaml.graphs",
|
|
208
|
+
"ebaml.local",
|
|
209
|
+
"ebaml.llm",
|
|
210
|
+
"ebaml.benchmark",
|
|
211
|
+
]
|
|
212
|
+
forbidden_modules = ["mcp"]
|
|
213
|
+
|
|
181
214
|
[[tool.importlinter.contracts]]
|
|
182
215
|
name = "Only llm.descriptors imports the BAML SDK"
|
|
183
216
|
type = "forbidden"
|
|
@@ -201,6 +234,7 @@ forbidden_modules = [
|
|
|
201
234
|
"ebaml.graphs",
|
|
202
235
|
"ebaml.local",
|
|
203
236
|
"ebaml.llm",
|
|
237
|
+
"ebaml.mcp",
|
|
204
238
|
]
|
|
205
239
|
|
|
206
240
|
[tool.pyrefly]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.4.0"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -30,6 +30,17 @@ dependencies = [
|
|
|
30
30
|
"structlog>=26.1.0",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
# The server for agents. Only ebaml.mcp imports these packages. The lower bound of mcp matches the override in
|
|
35
|
+
# the uv override list, so the extra keeps the fixed release after the override goes away.
|
|
36
|
+
mcp = [
|
|
37
|
+
"joblib>=1.5.0",
|
|
38
|
+
"mcp>=1.30.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
ebaml-mcp = "ebaml.mcp.server:main"
|
|
43
|
+
|
|
33
44
|
[project.urls]
|
|
34
45
|
Documentation = "https://johnny-godoy.github.io/EBaMl/"
|
|
35
46
|
Source = "https://github.com/johnny-godoy/EBaMl"
|
|
@@ -39,10 +50,6 @@ Changelog = "https://github.com/johnny-godoy/EBaMl/blob/main/CHANGELOG.md"
|
|
|
39
50
|
[tool.uv]
|
|
40
51
|
# A relative span keeps the cutoff 7 days behind today, so uv never picks a release that is less than 7 days old.
|
|
41
52
|
exclude-newer = "7 days"
|
|
42
|
-
# reason: baml-bridge must match the BAML toolchain that generates src/baml_sdk, or the SDK fails at start with a version
|
|
43
|
-
# skew error. CI installs the newest toolchain, and toolchain 0.23.0 changed the ai.Client interface, so the repository
|
|
44
|
-
# needs baml-bridge 0.23.0 at once. Remove the entry once 0.23.0 is more than 7 days old.
|
|
45
|
-
exclude-newer-package = { baml-bridge = false }
|
|
46
53
|
# reason: semgrep 1.182.1 pins mcp==1.29.0 and opentelemetry-api~=1.37.0, which have 5 known CVEs fixed in mcp 1.30.0
|
|
47
54
|
# and opentelemetry-api 1.45.1. Dependabot cannot update them, so the override forces the fixed releases. The
|
|
48
55
|
# opentelemetry packages must move together, because semgrep fails to import with opentelemetry-api 1.45 and the older
|
|
@@ -175,8 +182,9 @@ release = [
|
|
|
175
182
|
]
|
|
176
183
|
|
|
177
184
|
[tool.vulture]
|
|
178
|
-
# reason: fixtures are used through pytest's name-based injection,
|
|
179
|
-
|
|
185
|
+
# 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. Vulture cannot see either.
|
|
187
|
+
ignore_decorators = ["@pytest.fixture", "@server.tool", "@server.resource"]
|
|
180
188
|
# reason: pytest reads pytestmark and the pytest_* hooks of a conftest.py by name, code never references them, so vulture
|
|
181
189
|
# reports them as unused.
|
|
182
190
|
ignore_names = ["pytestmark", "pytest_*"]
|
|
@@ -201,9 +209,9 @@ root_package = "ebaml"
|
|
|
201
209
|
include_external_packages = true
|
|
202
210
|
|
|
203
211
|
[[tool.importlinter.contracts]]
|
|
204
|
-
name = "Layers: llm over local over graphs over core"
|
|
212
|
+
name = "Layers: mcp over llm over local over graphs over core"
|
|
205
213
|
type = "layers"
|
|
206
|
-
layers = ["ebaml.llm", "ebaml.local", "ebaml.graphs", "ebaml.core"]
|
|
214
|
+
layers = ["ebaml.mcp", "ebaml.llm", "ebaml.local", "ebaml.graphs", "ebaml.core"]
|
|
207
215
|
|
|
208
216
|
[[tool.importlinter.contracts]]
|
|
209
217
|
name = "Domain code does not import the BAML SDK"
|
|
@@ -211,6 +219,20 @@ type = "forbidden"
|
|
|
211
219
|
source_modules = ["ebaml.core", "ebaml.graphs", "ebaml.local", "ebaml.benchmark"]
|
|
212
220
|
forbidden_modules = ["baml_sdk", "baml_bridge"]
|
|
213
221
|
|
|
222
|
+
[[tool.importlinter.contracts]]
|
|
223
|
+
name = "The MCP layer reaches the BAML SDK only through ebaml.llm"
|
|
224
|
+
type = "forbidden"
|
|
225
|
+
source_modules = ["ebaml.mcp"]
|
|
226
|
+
forbidden_modules = ["baml_sdk", "baml_bridge"]
|
|
227
|
+
# reason: ebaml.mcp calls describe_graph and describe_ebm of ebaml.llm, which import the SDK, so only a direct import is wrong.
|
|
228
|
+
allow_indirect_imports = true
|
|
229
|
+
|
|
230
|
+
[[tool.importlinter.contracts]]
|
|
231
|
+
name = "Only ebaml.mcp imports the MCP SDK"
|
|
232
|
+
type = "forbidden"
|
|
233
|
+
source_modules = ["ebaml.core", "ebaml.graphs", "ebaml.local", "ebaml.llm", "ebaml.benchmark"]
|
|
234
|
+
forbidden_modules = ["mcp"]
|
|
235
|
+
|
|
214
236
|
[[tool.importlinter.contracts]]
|
|
215
237
|
name = "Only llm.descriptors imports the BAML SDK"
|
|
216
238
|
type = "forbidden"
|
|
@@ -230,7 +252,7 @@ ignore_imports = [
|
|
|
230
252
|
name = "The benchmark stands alone"
|
|
231
253
|
type = "forbidden"
|
|
232
254
|
source_modules = ["ebaml.benchmark"]
|
|
233
|
-
forbidden_modules = ["ebaml.core", "ebaml.graphs", "ebaml.local", "ebaml.llm"]
|
|
255
|
+
forbidden_modules = ["ebaml.core", "ebaml.graphs", "ebaml.local", "ebaml.llm", "ebaml.mcp"]
|
|
234
256
|
|
|
235
257
|
[tool.pyrefly]
|
|
236
258
|
# The strict preset reports implicit `Any` in parameters, lambdas, attributes, empty containers and type arguments.
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Talk 2 EBM in BAML.
|
|
2
|
+
|
|
3
|
+
Import every public name from ``ebaml``. The names ``describe_graph``, ``describe_ebm``, ``explain_instance`` and
|
|
4
|
+
``LocalExplanation`` load on first use, because the module that holds them can run ``baml generate``.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
from typing import TYPE_CHECKING, cast
|
|
9
|
+
|
|
10
|
+
from beartype import BeartypeConf
|
|
11
|
+
from beartype.claw import beartype_this_package
|
|
12
|
+
|
|
13
|
+
# The hook must run before any submodule import, or those modules stay unchecked.
|
|
14
|
+
# The numeric tower lets an int satisfy a float hint, as PEP 484 says.
|
|
15
|
+
# Checking annotated variables is off, because structlog's lazy logger proxy does not match its own logger type.
|
|
16
|
+
beartype_this_package(conf=BeartypeConf(is_pep484_tower=True, claw_is_pep526=False)) # ruff: ignore[non-empty-init-module] -- the hook must run before the submodule imports below
|
|
17
|
+
|
|
18
|
+
from ebaml.core.custom_types import FeatureType, Normalization # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
19
|
+
from ebaml.core.exceptions import ( # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
20
|
+
APIKeyRejectedError,
|
|
21
|
+
EBaMlError,
|
|
22
|
+
EBMGraphError,
|
|
23
|
+
EBMGraphShapeError,
|
|
24
|
+
EBMGraphSimplificationError,
|
|
25
|
+
EBMGraphTokenLimitError,
|
|
26
|
+
GraphTextError,
|
|
27
|
+
InvalidInstanceError,
|
|
28
|
+
InvalidOptionError,
|
|
29
|
+
LLMRequestError,
|
|
30
|
+
MissingAPIKeyError,
|
|
31
|
+
OptionRangeError,
|
|
32
|
+
ProviderUnreachableError,
|
|
33
|
+
RateLimitedError,
|
|
34
|
+
SDKUnavailableError,
|
|
35
|
+
TokenFitError,
|
|
36
|
+
UnsupportedModelError,
|
|
37
|
+
)
|
|
38
|
+
from ebaml.graphs.ebm_graph import EBMGraph # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
39
|
+
from ebaml.graphs.model_kinds import ( # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
40
|
+
BinaryClassifier,
|
|
41
|
+
ModelKind,
|
|
42
|
+
MulticlassClassifier,
|
|
43
|
+
Regressor,
|
|
44
|
+
model_kind,
|
|
45
|
+
)
|
|
46
|
+
from ebaml.graphs.token_budget import check_token_budget # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
47
|
+
from ebaml.llm.options import GraphOptions, ModelOptions, PromptOptions # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
48
|
+
from ebaml.local.audience import ( # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
49
|
+
Audience,
|
|
50
|
+
DataScientist,
|
|
51
|
+
Layperson,
|
|
52
|
+
likelihood_word,
|
|
53
|
+
points_towards,
|
|
54
|
+
resolve_audience,
|
|
55
|
+
round_value,
|
|
56
|
+
strength_word,
|
|
57
|
+
)
|
|
58
|
+
from ebaml.local.fact_text import FactTexts, facts_to_texts # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
59
|
+
from ebaml.local.facts import ( # ruff: ignore[module-import-not-at-top-of-file] -- the beartype hook must run first
|
|
60
|
+
Change,
|
|
61
|
+
CompletionStep,
|
|
62
|
+
Contribution,
|
|
63
|
+
Counterfactual,
|
|
64
|
+
LocalFacts,
|
|
65
|
+
LocalOptions,
|
|
66
|
+
Prediction,
|
|
67
|
+
SufficientReason,
|
|
68
|
+
compute_local_facts,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
if TYPE_CHECKING:
|
|
72
|
+
from ebaml.llm.descriptors import LocalExplanation, describe_ebm, describe_graph, explain_instance
|
|
73
|
+
|
|
74
|
+
__version__: str = version("ebaml")
|
|
75
|
+
|
|
76
|
+
__all__ = [
|
|
77
|
+
"APIKeyRejectedError",
|
|
78
|
+
"Audience",
|
|
79
|
+
"BinaryClassifier",
|
|
80
|
+
"Change",
|
|
81
|
+
"CompletionStep",
|
|
82
|
+
"Contribution",
|
|
83
|
+
"Counterfactual",
|
|
84
|
+
"DataScientist",
|
|
85
|
+
"EBMGraph",
|
|
86
|
+
"EBMGraphError",
|
|
87
|
+
"EBMGraphShapeError",
|
|
88
|
+
"EBMGraphSimplificationError",
|
|
89
|
+
"EBMGraphTokenLimitError",
|
|
90
|
+
"EBaMlError",
|
|
91
|
+
"FactTexts",
|
|
92
|
+
"FeatureType",
|
|
93
|
+
"GraphOptions",
|
|
94
|
+
"GraphTextError",
|
|
95
|
+
"InvalidInstanceError",
|
|
96
|
+
"InvalidOptionError",
|
|
97
|
+
"LLMRequestError",
|
|
98
|
+
"Layperson",
|
|
99
|
+
"LocalExplanation",
|
|
100
|
+
"LocalFacts",
|
|
101
|
+
"LocalOptions",
|
|
102
|
+
"MissingAPIKeyError",
|
|
103
|
+
"ModelKind",
|
|
104
|
+
"ModelOptions",
|
|
105
|
+
"MulticlassClassifier",
|
|
106
|
+
"Normalization",
|
|
107
|
+
"OptionRangeError",
|
|
108
|
+
"Prediction",
|
|
109
|
+
"PromptOptions",
|
|
110
|
+
"ProviderUnreachableError",
|
|
111
|
+
"RateLimitedError",
|
|
112
|
+
"Regressor",
|
|
113
|
+
"SDKUnavailableError",
|
|
114
|
+
"SufficientReason",
|
|
115
|
+
"TokenFitError",
|
|
116
|
+
"UnsupportedModelError",
|
|
117
|
+
"__version__",
|
|
118
|
+
"check_token_budget",
|
|
119
|
+
"compute_local_facts",
|
|
120
|
+
"describe_ebm",
|
|
121
|
+
"describe_graph",
|
|
122
|
+
"explain_instance",
|
|
123
|
+
"facts_to_texts",
|
|
124
|
+
"likelihood_word",
|
|
125
|
+
"model_kind",
|
|
126
|
+
"points_towards",
|
|
127
|
+
"resolve_audience",
|
|
128
|
+
"round_value",
|
|
129
|
+
"strength_word",
|
|
130
|
+
]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
# nosemgrep: ebaml-no-object-type -- PEP 562 returns a function or a class chosen by name, so no single type fits
|
|
134
|
+
def __getattr__(name: str) -> object:
|
|
135
|
+
"""Load a name of ``ebaml.llm.descriptors`` on first use.
|
|
136
|
+
|
|
137
|
+
That module can run ``baml generate`` when it is imported, so ``import ebaml`` must not load it. The loaded name
|
|
138
|
+
goes into the module namespace, and the next access skips this function.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
name
|
|
143
|
+
The name of the attribute.
|
|
144
|
+
|
|
145
|
+
Returns
|
|
146
|
+
-------
|
|
147
|
+
object
|
|
148
|
+
The function or class of ``ebaml.llm.descriptors`` with this name.
|
|
149
|
+
|
|
150
|
+
Raises
|
|
151
|
+
------
|
|
152
|
+
AttributeError
|
|
153
|
+
If ``name`` is not a public name that loads on first use.
|
|
154
|
+
|
|
155
|
+
"""
|
|
156
|
+
lazy_names = {"LocalExplanation", "describe_ebm", "describe_graph", "explain_instance"}
|
|
157
|
+
if name not in lazy_names:
|
|
158
|
+
msg = f"module {__name__!r} has no attribute {name!r}"
|
|
159
|
+
raise AttributeError(msg)
|
|
160
|
+
from ebaml.llm import descriptors # ruff: ignore[import-outside-top-level] -- the import must wait until first use
|
|
161
|
+
|
|
162
|
+
value = getattr(descriptors, name)
|
|
163
|
+
globals()[name] = value
|
|
164
|
+
return cast("object", value) # getattr returns Any, and the hint names the real type
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def __dir__() -> list[str]:
|
|
168
|
+
"""List the public names, including the names that load on first use.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
list[str]
|
|
173
|
+
The sorted names of ``__all__``.
|
|
174
|
+
|
|
175
|
+
"""
|
|
176
|
+
return sorted(__all__)
|