ebaml 0.3.0__tar.gz → 0.3.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.3.0 → ebaml-0.3.2}/PKG-INFO +19 -7
- {ebaml-0.3.0 → ebaml-0.3.2}/README.md +15 -6
- {ebaml-0.3.0 → ebaml-0.3.2}/pyproject.toml +11 -1
- {ebaml-0.3.0 → ebaml-0.3.2}/pyproject.toml.orig +10 -1
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/.baml-generator-output.json +5 -5
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/__init__.py +89 -39
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/__init__.pyi +77 -36
- ebaml-0.3.2/src/baml_sdk/_baml_sources.py +32 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/_inlinedbaml.py +1 -1
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/_typemap.py +3 -1
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/__init__.py +2 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/core/exceptions.py +4 -0
- ebaml-0.3.2/src/ebaml/graphs/request_text.py +76 -0
- ebaml-0.3.2/src/ebaml/graphs/token_budget.py +345 -0
- ebaml-0.3.2/src/ebaml/graphs/token_weights.py +466 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/descriptors.py +94 -8
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/options.py +6 -1
- ebaml-0.3.2/src/ebaml/llm/token_learning.py +322 -0
- ebaml-0.3.2/src/ebaml/llm/token_weights.json +30 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/local/audience.py +7 -3
- ebaml-0.3.0/src/baml_sdk/_baml_sources.py +0 -32
- ebaml-0.3.0/src/ebaml/graphs/token_budget.py +0 -84
- {ebaml-0.3.0 → ebaml-0.3.2}/LICENSE +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/.baml-generator-output-root +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/.gitignore +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/_function_registry.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/_invocation_types.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/_invocation_types.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/clients/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/clients/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/content/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/content/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/errors/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/errors/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/events/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/events/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/mcp/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/mcp/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/stream/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/stream/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/tools/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/tools/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/wire/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/ai/wire/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/crypto/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/crypto/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/csv/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/csv/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/env/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/env/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/errors/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/errors/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/fs/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/fs/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/future/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/future/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/glob/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/glob/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/hash/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/hash/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/host/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/host/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/http/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/http/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/io/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/io/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/iter/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/iter/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/json/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/json/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/media/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/media/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/net/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/net/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/ops/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/ops/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/panics/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/panics/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/random/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/random/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/regex/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/regex/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/sap/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/sap/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/spawn/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/spawn/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/sys/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/sys/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/time/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/time/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/toml/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/toml/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/ws/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/ws/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/yaml/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/baml/yaml/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/experimental/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/experimental/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/py.typed +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/class_/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/class_/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/enum/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/enum/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/errors/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/errors/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/function/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/function/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/interface/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/reflect/interface/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/assert_/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/assert_/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/google/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/google/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/google/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/google/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/testing/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/testing/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/trace/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/trace/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/internal/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/internal/__init__.pyi +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/benchmark.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/core/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/core/custom_types.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/graphs/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/graphs/ebm_graph.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/graphs/graph_text.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/graphs/model_kinds.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/graphs/terms.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/provider_errors.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/retry.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/llm/sdk_setup.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/local/__init__.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/local/fact_text.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/local/facts.py +0 -0
- {ebaml-0.3.0 → ebaml-0.3.2}/src/ebaml/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ebaml
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.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,7 +17,10 @@ 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: numpy>=2.5.4
|
|
20
21
|
Requires-Dist: orjson>=3.13.0
|
|
22
|
+
Requires-Dist: pandas>=3.0.6
|
|
23
|
+
Requires-Dist: scipy>=1.18.1
|
|
21
24
|
Requires-Dist: structlog>=26.1.0
|
|
22
25
|
Requires-Python: >=3.13
|
|
23
26
|
Project-URL: Documentation, https://johnny-godoy.github.io/EBaMl/
|
|
@@ -220,7 +223,7 @@ The facts are computed exactly from the scores and confidence intervals of the E
|
|
|
220
223
|
them in words. They are the three queries of [arXiv:2010.12265](https://arxiv.org/abs/2010.12265): minimum change
|
|
221
224
|
required, minimum sufficient reason and count completions. `audience="layperson"` (default) gives no model numbers;
|
|
222
225
|
`audience="data_scientist"` quotes scores, probabilities and confidence intervals. Subclass `ebaml.Audience` to add a
|
|
223
|
-
reader with its own rules. It supports binary classifiers
|
|
226
|
+
reader with its own rules. Pass `language="French"` (any language name) to get the explanations in that language. It supports binary classifiers
|
|
224
227
|
without interactions, and `explanation.facts` holds the numbers behind the text. The "Local explanations" page of the documentation explains what each explanation means, the options and the limits,
|
|
225
228
|
and `notebooks/local_explanations.py` walks through them on the Titanic data.
|
|
226
229
|
|
|
@@ -241,6 +244,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
241
244
|
| `EBMGraphShapeError` | yes | The bins of a graph do not fit its scores, the scores and the standard deviations have different shapes, or a boolean format gets more than two bins. |
|
|
242
245
|
| `EBMGraphTokenLimitError` | no | The text of a graph is over the token budget, and its format cannot be simplified. |
|
|
243
246
|
| `EBMGraphSimplificationError` | no | The text of a graph is still over the token budget at the largest simplification. |
|
|
247
|
+
| `TokenFitError` | yes | The token weights cannot be fitted from an empty list of samples, or a weight is negative or not finite. |
|
|
244
248
|
| `SDKUnavailableError` | no | `baml_sdk` is missing, and `ebaml` cannot run `baml generate`. The error also derives from `ImportError`. |
|
|
245
249
|
| `LLMRequestError` | no | The base class of the errors of a provider. Its message lists the steps that fix the cause. |
|
|
246
250
|
| `MissingAPIKeyError` | no | A provider needs an API key and the environment has none. |
|
|
@@ -279,11 +283,19 @@ them too.
|
|
|
279
283
|
rejects are not retried.
|
|
280
284
|
- **Concurrency:** `describe_ebm` describes features concurrently, at most `max_concurrency` at a time (default 8).
|
|
281
285
|
Free models are rate limited, so lower it (`describe_ebm(ebm, max_concurrency=2)`) if you see rate-limit errors.
|
|
282
|
-
- **Token budget:** there is no tokenizer before a call, so the check
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
`
|
|
286
|
+
- **Token budget:** there is no tokenizer before a call, so the check estimates the tokens of a graph text from its
|
|
287
|
+
words and its digits. The default weights are 4.13 tokens for each word and 0.27 for each digit. They come from 100
|
|
288
|
+
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
289
|
+
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
290
|
+
`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. The functions in `ebaml.llm.descriptors` pass the
|
|
292
|
+
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
293
|
+
`ebaml.graphs.token_budget.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
294
|
+
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
295
|
+
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
296
|
+
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
297
|
+
persist in `~/.cache/ebaml/token_weights.json`. Learning is off by default, because learned weights change the graph
|
|
298
|
+
text from one call to the next. `scripts/fit_token_weights.py` adds the weights of a new model to the table.
|
|
287
299
|
|
|
288
300
|
<!-- --8<-- [end:behaviour] -->
|
|
289
301
|
## Notebook
|
|
@@ -192,7 +192,7 @@ The facts are computed exactly from the scores and confidence intervals of the E
|
|
|
192
192
|
them in words. They are the three queries of [arXiv:2010.12265](https://arxiv.org/abs/2010.12265): minimum change
|
|
193
193
|
required, minimum sufficient reason and count completions. `audience="layperson"` (default) gives no model numbers;
|
|
194
194
|
`audience="data_scientist"` quotes scores, probabilities and confidence intervals. Subclass `ebaml.Audience` to add a
|
|
195
|
-
reader with its own rules. It supports binary classifiers
|
|
195
|
+
reader with its own rules. Pass `language="French"` (any language name) to get the explanations in that language. It supports binary classifiers
|
|
196
196
|
without interactions, and `explanation.facts` holds the numbers behind the text. The "Local explanations" page of the documentation explains what each explanation means, the options and the limits,
|
|
197
197
|
and `notebooks/local_explanations.py` walks through them on the Titanic data.
|
|
198
198
|
|
|
@@ -213,6 +213,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
213
213
|
| `EBMGraphShapeError` | yes | The bins of a graph do not fit its scores, the scores and the standard deviations have different shapes, or a boolean format gets more than two bins. |
|
|
214
214
|
| `EBMGraphTokenLimitError` | no | The text of a graph is over the token budget, and its format cannot be simplified. |
|
|
215
215
|
| `EBMGraphSimplificationError` | no | The text of a graph is still over the token budget at the largest simplification. |
|
|
216
|
+
| `TokenFitError` | yes | The token weights cannot be fitted from an empty list of samples, or a weight is negative or not finite. |
|
|
216
217
|
| `SDKUnavailableError` | no | `baml_sdk` is missing, and `ebaml` cannot run `baml generate`. The error also derives from `ImportError`. |
|
|
217
218
|
| `LLMRequestError` | no | The base class of the errors of a provider. Its message lists the steps that fix the cause. |
|
|
218
219
|
| `MissingAPIKeyError` | no | A provider needs an API key and the environment has none. |
|
|
@@ -251,11 +252,19 @@ them too.
|
|
|
251
252
|
rejects are not retried.
|
|
252
253
|
- **Concurrency:** `describe_ebm` describes features concurrently, at most `max_concurrency` at a time (default 8).
|
|
253
254
|
Free models are rate limited, so lower it (`describe_ebm(ebm, max_concurrency=2)`) if you see rate-limit errors.
|
|
254
|
-
- **Token budget:** there is no tokenizer before a call, so the check
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
`
|
|
255
|
+
- **Token budget:** there is no tokenizer before a call, so the check estimates the tokens of a graph text from its
|
|
256
|
+
words and its digits. The default weights are 4.13 tokens for each word and 0.27 for each digit. They come from 100
|
|
257
|
+
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
258
|
+
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
259
|
+
`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. The functions in `ebaml.llm.descriptors` pass the
|
|
261
|
+
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
262
|
+
`ebaml.graphs.token_budget.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
263
|
+
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
264
|
+
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
265
|
+
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
266
|
+
persist in `~/.cache/ebaml/token_weights.json`. Learning is off by default, because learned weights change the graph
|
|
267
|
+
text from one call to the next. `scripts/fit_token_weights.py` adds the weights of a new model to the table.
|
|
259
268
|
|
|
260
269
|
<!-- --8<-- [end:behaviour] -->
|
|
261
270
|
## Notebook
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -26,7 +26,10 @@ dependencies = [
|
|
|
26
26
|
"baml-bridge>=0.23.0",
|
|
27
27
|
"beartype>=0.23.1",
|
|
28
28
|
"interpret>=0.7.8",
|
|
29
|
+
"numpy>=2.5.4",
|
|
29
30
|
"orjson>=3.13.0",
|
|
31
|
+
"pandas>=3.0.6",
|
|
32
|
+
"scipy>=1.18.1",
|
|
30
33
|
"structlog>=26.1.0",
|
|
31
34
|
]
|
|
32
35
|
|
|
@@ -254,6 +257,12 @@ entry_title_template = "[{{ version }}] - {{ date.strftime('%Y-%m-%d') }}"
|
|
|
254
257
|
[tool.commitizen]
|
|
255
258
|
name = "cz_conventional_commits"
|
|
256
259
|
|
|
260
|
+
[tool.deptry]
|
|
261
|
+
known_first_party = [
|
|
262
|
+
"ebaml",
|
|
263
|
+
"baml_sdk",
|
|
264
|
+
]
|
|
265
|
+
|
|
257
266
|
[build-system]
|
|
258
267
|
requires = ["uv_build>=0.12.3,<0.13.0"]
|
|
259
268
|
build-backend = "uv_build"
|
|
@@ -261,6 +270,7 @@ build-backend = "uv_build"
|
|
|
261
270
|
[dependency-groups]
|
|
262
271
|
dev = [
|
|
263
272
|
"cosmic-ray>=8.7.0",
|
|
273
|
+
"deptry>=0.25.1",
|
|
264
274
|
"hypothesis>=6.170.1",
|
|
265
275
|
"import-linter>=2.15",
|
|
266
276
|
"marimo>=0.25.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.2"
|
|
4
4
|
description = "BAML for Explainable Boosting Machines: talk to your EBM."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -23,7 +23,10 @@ dependencies = [
|
|
|
23
23
|
"baml-bridge>=0.23.0",
|
|
24
24
|
"beartype>=0.23.1",
|
|
25
25
|
"interpret>=0.7.8",
|
|
26
|
+
"numpy>=2.5.4",
|
|
26
27
|
"orjson>=3.13.0",
|
|
28
|
+
"pandas>=3.0.6",
|
|
29
|
+
"scipy>=1.18.1",
|
|
27
30
|
"structlog>=26.1.0",
|
|
28
31
|
]
|
|
29
32
|
|
|
@@ -137,6 +140,7 @@ select = ["ALL"]
|
|
|
137
140
|
[dependency-groups]
|
|
138
141
|
dev = [
|
|
139
142
|
"cosmic-ray>=8.7.0",
|
|
143
|
+
"deptry>=0.25.1",
|
|
140
144
|
"hypothesis>=6.170.1",
|
|
141
145
|
"import-linter>=2.15",
|
|
142
146
|
"marimo>=0.25.1",
|
|
@@ -297,3 +301,8 @@ entry_title_template = "[{{ version }}] - {{ date.strftime('%Y-%m-%d') }}"
|
|
|
297
301
|
# version, so `cz bump` and `cz changelog` are not used.
|
|
298
302
|
[tool.commitizen]
|
|
299
303
|
name = "cz_conventional_commits"
|
|
304
|
+
|
|
305
|
+
[tool.deptry]
|
|
306
|
+
# reason: baml_sdk is generated into src/ and gitignored, and the build backend ships it with ebaml (module-name), so
|
|
307
|
+
# deptry cannot see it as part of this project without a hint.
|
|
308
|
+
known_first_party = ["ebaml", "baml_sdk"]
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
"relative_path": "__init__.py",
|
|
10
|
-
"sha256": "
|
|
10
|
+
"sha256": "11cf64083463a9485f91b97d373f878b5ff4a21d9f5f589fd725fd862da9e795"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"relative_path": "__init__.pyi",
|
|
14
|
-
"sha256": "
|
|
14
|
+
"sha256": "2adc45c6784bc52f6d387b8926e100b389042d141371497b0be8ab13ca932e6a"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"relative_path": "_baml_sources.py",
|
|
18
|
-
"sha256": "
|
|
18
|
+
"sha256": "8e45b190c4b11962a079e69e3ef56aa96b5f0e923d146252aa21856ce1c69d4c"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"relative_path": "_function_registry.py",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"relative_path": "_inlinedbaml.py",
|
|
26
|
-
"sha256": "
|
|
26
|
+
"sha256": "5dcca56a5ab2bd2fa238ab2d055e5951308c865381f7cced2b8d149a8e748a96"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"relative_path": "_invocation_types.py",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"relative_path": "_typemap.py",
|
|
38
|
-
"sha256": "
|
|
38
|
+
"sha256": "df5ba3535ab9a4b8521541e49409c61c5c2600ff4bd6855ead4fb3f138506540"
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
"relative_path": "ai/__init__.py",
|
|
@@ -145,8 +145,8 @@ local_system_msg = _define_function("user.local_system_msg", "sync", ["ex
|
|
|
145
145
|
local_system_msg_async = _define_function("user.local_system_msg", "async", ["expert_description"], binding_name="local_system_msg_async", binding_qualname="local_system_msg_async", binding_module=__name__)
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
local_user_msg = _define_function("user.local_user_msg", "sync", ["global_explanation", "prediction", "question", "facts", "audience_guidance", "dataset_description"], binding_name="local_user_msg", binding_qualname="local_user_msg", binding_module=__name__)
|
|
149
|
-
local_user_msg_async = _define_function("user.local_user_msg", "async", ["global_explanation", "prediction", "question", "facts", "audience_guidance", "dataset_description"], binding_name="local_user_msg_async", binding_qualname="local_user_msg_async", binding_module=__name__)
|
|
148
|
+
local_user_msg = _define_function("user.local_user_msg", "sync", ["global_explanation", "prediction", "question", "facts", "audience_guidance", "dataset_description"], ["language"], binding_name="local_user_msg", binding_qualname="local_user_msg", binding_module=__name__)
|
|
149
|
+
local_user_msg_async = _define_function("user.local_user_msg", "async", ["global_explanation", "prediction", "question", "facts", "audience_guidance", "dataset_description"], ["language"], binding_name="local_user_msg_async", binding_qualname="local_user_msg_async", binding_module=__name__)
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
counterfactual_question = _define_function("user.counterfactual_question", "sync", ["num_sentences"], binding_name="counterfactual_question", binding_qualname="counterfactual_question", binding_module=__name__)
|
|
@@ -161,70 +161,70 @@ completions_question = _define_function("user.completions_question", "sync
|
|
|
161
161
|
completions_question_async = _define_function("user.completions_question", "async", ["num_sentences"], binding_name="completions_question_async", binding_qualname="completions_question_async", binding_module=__name__)
|
|
162
162
|
|
|
163
163
|
|
|
164
|
-
LocalCounterfactual = _define_function("user.LocalCounterfactual", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCounterfactual", binding_qualname="LocalCounterfactual", binding_module=__name__)
|
|
164
|
+
LocalCounterfactual = _define_function("user.LocalCounterfactual", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCounterfactual", binding_qualname="LocalCounterfactual", binding_module=__name__)
|
|
165
165
|
LocalCounterfactual.__doc__ = """Raises:
|
|
166
166
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
167
|
-
LocalCounterfactual_async = _define_function("user.LocalCounterfactual", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCounterfactual_async", binding_qualname="LocalCounterfactual_async", binding_module=__name__)
|
|
167
|
+
LocalCounterfactual_async = _define_function("user.LocalCounterfactual", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCounterfactual_async", binding_qualname="LocalCounterfactual_async", binding_module=__name__)
|
|
168
168
|
LocalCounterfactual_async.__doc__ = """Raises:
|
|
169
169
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
170
|
-
LocalCounterfactual_spec = _define_function("user.LocalCounterfactual@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalCounterfactual_spec", binding_qualname="LocalCounterfactual_spec", binding_module=__name__)
|
|
170
|
+
LocalCounterfactual_spec = _define_function("user.LocalCounterfactual@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalCounterfactual_spec", binding_qualname="LocalCounterfactual_spec", binding_module=__name__)
|
|
171
171
|
LocalCounterfactual_spec.__doc__ = """Raises:
|
|
172
172
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
173
|
-
LocalCounterfactual_spec_async = _define_function("user.LocalCounterfactual@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalCounterfactual_spec_async", binding_qualname="LocalCounterfactual_spec_async", binding_module=__name__)
|
|
173
|
+
LocalCounterfactual_spec_async = _define_function("user.LocalCounterfactual@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalCounterfactual_spec_async", binding_qualname="LocalCounterfactual_spec_async", binding_module=__name__)
|
|
174
174
|
LocalCounterfactual_spec_async.__doc__ = """Raises:
|
|
175
175
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
176
|
-
LocalCounterfactual_stream = _define_function("user.LocalCounterfactual@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCounterfactual_stream", binding_qualname="LocalCounterfactual_stream", binding_module=__name__)
|
|
176
|
+
LocalCounterfactual_stream = _define_function("user.LocalCounterfactual@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCounterfactual_stream", binding_qualname="LocalCounterfactual_stream", binding_module=__name__)
|
|
177
177
|
LocalCounterfactual_stream.__doc__ = """Raises:
|
|
178
178
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
179
|
-
LocalCounterfactual_stream_async = _define_function("user.LocalCounterfactual@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCounterfactual_stream_async", binding_qualname="LocalCounterfactual_stream_async", binding_module=__name__)
|
|
179
|
+
LocalCounterfactual_stream_async = _define_function("user.LocalCounterfactual@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCounterfactual_stream_async", binding_qualname="LocalCounterfactual_stream_async", binding_module=__name__)
|
|
180
180
|
LocalCounterfactual_stream_async.__doc__ = """Raises:
|
|
181
181
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
182
182
|
|
|
183
183
|
|
|
184
|
-
LocalSufficientReason = _define_function("user.LocalSufficientReason", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalSufficientReason", binding_qualname="LocalSufficientReason", binding_module=__name__)
|
|
184
|
+
LocalSufficientReason = _define_function("user.LocalSufficientReason", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalSufficientReason", binding_qualname="LocalSufficientReason", binding_module=__name__)
|
|
185
185
|
LocalSufficientReason.__doc__ = """Raises:
|
|
186
186
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
187
|
-
LocalSufficientReason_async = _define_function("user.LocalSufficientReason", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalSufficientReason_async", binding_qualname="LocalSufficientReason_async", binding_module=__name__)
|
|
187
|
+
LocalSufficientReason_async = _define_function("user.LocalSufficientReason", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalSufficientReason_async", binding_qualname="LocalSufficientReason_async", binding_module=__name__)
|
|
188
188
|
LocalSufficientReason_async.__doc__ = """Raises:
|
|
189
189
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
190
|
-
LocalSufficientReason_spec = _define_function("user.LocalSufficientReason@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalSufficientReason_spec", binding_qualname="LocalSufficientReason_spec", binding_module=__name__)
|
|
190
|
+
LocalSufficientReason_spec = _define_function("user.LocalSufficientReason@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalSufficientReason_spec", binding_qualname="LocalSufficientReason_spec", binding_module=__name__)
|
|
191
191
|
LocalSufficientReason_spec.__doc__ = """Raises:
|
|
192
192
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
193
|
-
LocalSufficientReason_spec_async = _define_function("user.LocalSufficientReason@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalSufficientReason_spec_async", binding_qualname="LocalSufficientReason_spec_async", binding_module=__name__)
|
|
193
|
+
LocalSufficientReason_spec_async = _define_function("user.LocalSufficientReason@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalSufficientReason_spec_async", binding_qualname="LocalSufficientReason_spec_async", binding_module=__name__)
|
|
194
194
|
LocalSufficientReason_spec_async.__doc__ = """Raises:
|
|
195
195
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
196
|
-
LocalSufficientReason_stream = _define_function("user.LocalSufficientReason@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalSufficientReason_stream", binding_qualname="LocalSufficientReason_stream", binding_module=__name__)
|
|
196
|
+
LocalSufficientReason_stream = _define_function("user.LocalSufficientReason@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalSufficientReason_stream", binding_qualname="LocalSufficientReason_stream", binding_module=__name__)
|
|
197
197
|
LocalSufficientReason_stream.__doc__ = """Raises:
|
|
198
198
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
199
|
-
LocalSufficientReason_stream_async = _define_function("user.LocalSufficientReason@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalSufficientReason_stream_async", binding_qualname="LocalSufficientReason_stream_async", binding_module=__name__)
|
|
199
|
+
LocalSufficientReason_stream_async = _define_function("user.LocalSufficientReason@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalSufficientReason_stream_async", binding_qualname="LocalSufficientReason_stream_async", binding_module=__name__)
|
|
200
200
|
LocalSufficientReason_stream_async.__doc__ = """Raises:
|
|
201
201
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
202
202
|
|
|
203
203
|
|
|
204
|
-
LocalCompletions = _define_function("user.LocalCompletions", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCompletions", binding_qualname="LocalCompletions", binding_module=__name__)
|
|
204
|
+
LocalCompletions = _define_function("user.LocalCompletions", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCompletions", binding_qualname="LocalCompletions", binding_module=__name__)
|
|
205
205
|
LocalCompletions.__doc__ = """Raises:
|
|
206
206
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
207
|
-
LocalCompletions_async = _define_function("user.LocalCompletions", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCompletions_async", binding_qualname="LocalCompletions_async", binding_module=__name__)
|
|
207
|
+
LocalCompletions_async = _define_function("user.LocalCompletions", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCompletions_async", binding_qualname="LocalCompletions_async", binding_module=__name__)
|
|
208
208
|
LocalCompletions_async.__doc__ = """Raises:
|
|
209
209
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
210
|
-
LocalCompletions_spec = _define_function("user.LocalCompletions@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalCompletions_spec", binding_qualname="LocalCompletions_spec", binding_module=__name__)
|
|
210
|
+
LocalCompletions_spec = _define_function("user.LocalCompletions@spec", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalCompletions_spec", binding_qualname="LocalCompletions_spec", binding_module=__name__)
|
|
211
211
|
LocalCompletions_spec.__doc__ = """Raises:
|
|
212
212
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
213
|
-
LocalCompletions_spec_async = _define_function("user.LocalCompletions@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], binding_name="LocalCompletions_spec_async", binding_qualname="LocalCompletions_spec_async", binding_module=__name__)
|
|
213
|
+
LocalCompletions_spec_async = _define_function("user.LocalCompletions@spec", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language"], binding_name="LocalCompletions_spec_async", binding_qualname="LocalCompletions_spec_async", binding_module=__name__)
|
|
214
214
|
LocalCompletions_spec_async.__doc__ = """Raises:
|
|
215
215
|
InvalidArgument, Io, ParseError, InvalidRequest"""
|
|
216
|
-
LocalCompletions_stream = _define_function("user.LocalCompletions@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCompletions_stream", binding_qualname="LocalCompletions_stream", binding_module=__name__)
|
|
216
|
+
LocalCompletions_stream = _define_function("user.LocalCompletions@stream", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCompletions_stream", binding_qualname="LocalCompletions_stream", binding_module=__name__)
|
|
217
217
|
LocalCompletions_stream.__doc__ = """Raises:
|
|
218
218
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
219
|
-
LocalCompletions_stream_async = _define_function("user.LocalCompletions@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["on_event"], binding_name="LocalCompletions_stream_async", binding_qualname="LocalCompletions_stream_async", binding_module=__name__)
|
|
219
|
+
LocalCompletions_stream_async = _define_function("user.LocalCompletions@stream", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "on_event"], binding_name="LocalCompletions_stream_async", binding_qualname="LocalCompletions_stream_async", binding_module=__name__)
|
|
220
220
|
LocalCompletions_stream_async.__doc__ = """Raises:
|
|
221
221
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
222
222
|
|
|
223
223
|
|
|
224
|
-
explain_local = _define_function("user.explain_local", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["client", "model"], binding_name="explain_local", binding_qualname="explain_local", binding_module=__name__)
|
|
224
|
+
explain_local = _define_function("user.explain_local", "sync", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "client", "model"], binding_name="explain_local", binding_qualname="explain_local", binding_module=__name__)
|
|
225
225
|
explain_local.__doc__ = """Raises:
|
|
226
226
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
227
|
-
explain_local_async = _define_function("user.explain_local", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["client", "model"], binding_name="explain_local_async", binding_qualname="explain_local_async", binding_module=__name__)
|
|
227
|
+
explain_local_async = _define_function("user.explain_local", "async", ["global_explanation", "facts", "audience_guidance", "num_sentences", "opts"], ["language", "client", "model"], binding_name="explain_local_async", binding_qualname="explain_local_async", binding_module=__name__)
|
|
228
228
|
explain_local_async.__doc__ = """Raises:
|
|
229
229
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
230
230
|
|
|
@@ -534,46 +534,53 @@ EbmSummaryShorten_stream_async.__doc__ = """Raises:
|
|
|
534
534
|
CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
535
535
|
|
|
536
536
|
|
|
537
|
-
class
|
|
537
|
+
class TokenSample(pydantic.BaseModel):
|
|
538
538
|
model_config = pydantic.ConfigDict(
|
|
539
539
|
arbitrary_types_allowed=True,
|
|
540
540
|
extra="ignore",
|
|
541
541
|
populate_by_name=True,
|
|
542
542
|
)
|
|
543
|
+
provider: str
|
|
544
|
+
model: str
|
|
545
|
+
body: str
|
|
543
546
|
input_tokens: int
|
|
544
|
-
output_tokens: int
|
|
545
547
|
|
|
546
548
|
|
|
547
|
-
class
|
|
549
|
+
class TokenUsage(pydantic.BaseModel):
|
|
548
550
|
model_config = pydantic.ConfigDict(
|
|
549
551
|
arbitrary_types_allowed=True,
|
|
550
552
|
extra="ignore",
|
|
551
553
|
populate_by_name=True,
|
|
552
554
|
)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
input_tokens: int
|
|
556
|
+
output_tokens: int
|
|
557
|
+
samples: typing.List[TokenSample]
|
|
555
558
|
|
|
556
559
|
|
|
557
|
-
class
|
|
560
|
+
class Counted(pydantic.BaseModel):
|
|
558
561
|
model_config = pydantic.ConfigDict(
|
|
559
562
|
arbitrary_types_allowed=True,
|
|
560
563
|
extra="ignore",
|
|
561
564
|
populate_by_name=True,
|
|
562
565
|
)
|
|
563
|
-
|
|
564
|
-
|
|
566
|
+
text: str
|
|
567
|
+
usage: TokenUsage
|
|
565
568
|
|
|
566
569
|
|
|
567
570
|
add_usage = _define_function("user.add_usage", "sync", ["a", "b"], binding_name="add_usage", binding_qualname="add_usage", binding_module=__name__)
|
|
568
571
|
add_usage_async = _define_function("user.add_usage", "async", ["a", "b"], binding_name="add_usage_async", binding_qualname="add_usage_async", binding_module=__name__)
|
|
569
572
|
|
|
570
573
|
|
|
571
|
-
|
|
572
|
-
|
|
574
|
+
input_total = _define_function("user.input_total", "sync", ["usage"], binding_name="input_total", binding_qualname="input_total", binding_module=__name__)
|
|
575
|
+
input_total_async = _define_function("user.input_total", "async", ["usage"], binding_name="input_total_async", binding_qualname="input_total_async", binding_module=__name__)
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
sample_of = _define_function("user.sample_of", "sync", ["call"], binding_name="sample_of", binding_qualname="sample_of", binding_module=__name__)
|
|
579
|
+
sample_of_async = _define_function("user.sample_of", "async", ["call"], binding_name="sample_of_async", binding_qualname="sample_of_async", binding_module=__name__)
|
|
573
580
|
|
|
574
581
|
|
|
575
|
-
|
|
576
|
-
|
|
582
|
+
samples_of = _define_function("user.samples_of", "sync", ["events"], binding_name="samples_of", binding_qualname="samples_of", binding_module=__name__)
|
|
583
|
+
samples_of_async = _define_function("user.samples_of", "async", ["events"], binding_name="samples_of_async", binding_qualname="samples_of_async", binding_module=__name__)
|
|
577
584
|
|
|
578
585
|
|
|
579
586
|
run_counted = _define_function("user.run_counted", "sync", ["spec"], ["client"], binding_name="run_counted", binding_qualname="run_counted", binding_module=__name__)
|
|
@@ -584,6 +591,14 @@ run_counted_async.__doc__ = """Raises:
|
|
|
584
591
|
CompilationError, InvalidArgument, Timeout, UnknownError"""
|
|
585
592
|
|
|
586
593
|
|
|
594
|
+
sample_graph_tokens = _define_function("user.sample_graph_tokens", "sync", ["graph", "opts"], ["client", "model"], binding_name="sample_graph_tokens", binding_qualname="sample_graph_tokens", binding_module=__name__)
|
|
595
|
+
sample_graph_tokens.__doc__ = """Raises:
|
|
596
|
+
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
597
|
+
sample_graph_tokens_async = _define_function("user.sample_graph_tokens", "async", ["graph", "opts"], ["client", "model"], binding_name="sample_graph_tokens_async", binding_qualname="sample_graph_tokens_async", binding_module=__name__)
|
|
598
|
+
sample_graph_tokens_async.__doc__ = """Raises:
|
|
599
|
+
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
600
|
+
|
|
601
|
+
|
|
587
602
|
describe_graph_cot = _define_function("user.describe_graph_cot", "sync", ["graph", "num_sentences", "opts"], ["client", "model"], binding_name="describe_graph_cot", binding_qualname="describe_graph_cot", binding_module=__name__)
|
|
588
603
|
describe_graph_cot.__doc__ = """Raises:
|
|
589
604
|
CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
|
|
@@ -719,6 +734,31 @@ class SummaryEchoClient(pydantic.BaseModel):
|
|
|
719
734
|
)
|
|
720
735
|
|
|
721
736
|
|
|
737
|
+
usage_with = _define_function("user.usage_with", "sync", ["input_tokens", "uncached", "cached", "written"], binding_name="usage_with", binding_qualname="usage_with", binding_module=__name__)
|
|
738
|
+
usage_with_async = _define_function("user.usage_with", "async", ["input_tokens", "uncached", "cached", "written"], binding_name="usage_with_async", binding_qualname="usage_with_async", binding_module=__name__)
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
call_with = _define_function("user.call_with", "sync", ["model", "body", "usage"], binding_name="call_with", binding_qualname="call_with", binding_module=__name__)
|
|
742
|
+
call_with_async = _define_function("user.call_with", "async", ["model", "body", "usage"], binding_name="call_with_async", binding_qualname="call_with_async", binding_module=__name__)
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
class SampledClient(pydantic.BaseModel):
|
|
746
|
+
model_config = pydantic.ConfigDict(
|
|
747
|
+
arbitrary_types_allowed=True,
|
|
748
|
+
extra="ignore",
|
|
749
|
+
populate_by_name=True,
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
class FailingClient(pydantic.BaseModel):
|
|
754
|
+
model_config = pydantic.ConfigDict(
|
|
755
|
+
arbitrary_types_allowed=True,
|
|
756
|
+
extra="ignore",
|
|
757
|
+
populate_by_name=True,
|
|
758
|
+
)
|
|
759
|
+
cut_off: bool
|
|
760
|
+
|
|
761
|
+
|
|
722
762
|
__all__ = [
|
|
723
763
|
"benchmark_sample",
|
|
724
764
|
"benchmark_sample_async",
|
|
@@ -871,17 +911,21 @@ __all__ = [
|
|
|
871
911
|
"EbmSummaryShorten_spec_async",
|
|
872
912
|
"EbmSummaryShorten_stream",
|
|
873
913
|
"EbmSummaryShorten_stream_async",
|
|
914
|
+
"TokenSample",
|
|
874
915
|
"TokenUsage",
|
|
875
916
|
"Counted",
|
|
876
|
-
"TokenBudget",
|
|
877
917
|
"add_usage",
|
|
878
918
|
"add_usage_async",
|
|
879
|
-
"
|
|
880
|
-
"
|
|
881
|
-
"
|
|
882
|
-
"
|
|
919
|
+
"input_total",
|
|
920
|
+
"input_total_async",
|
|
921
|
+
"sample_of",
|
|
922
|
+
"sample_of_async",
|
|
923
|
+
"samples_of",
|
|
924
|
+
"samples_of_async",
|
|
883
925
|
"run_counted",
|
|
884
926
|
"run_counted_async",
|
|
927
|
+
"sample_graph_tokens",
|
|
928
|
+
"sample_graph_tokens_async",
|
|
885
929
|
"describe_graph_cot",
|
|
886
930
|
"describe_graph_cot_async",
|
|
887
931
|
"summarize_ebm",
|
|
@@ -917,6 +961,12 @@ __all__ = [
|
|
|
917
961
|
"text_turn_async",
|
|
918
962
|
"TaggedEchoClient",
|
|
919
963
|
"SummaryEchoClient",
|
|
964
|
+
"usage_with",
|
|
965
|
+
"usage_with_async",
|
|
966
|
+
"call_with",
|
|
967
|
+
"call_with_async",
|
|
968
|
+
"SampledClient",
|
|
969
|
+
"FailingClient",
|
|
920
970
|
]
|
|
921
971
|
|
|
922
972
|
# BEP-066 host reflection surface.
|