ebaml 0.3.1__tar.gz → 0.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ebaml-0.3.1 → ebaml-0.3.3}/PKG-INFO +30 -19
- {ebaml-0.3.1 → ebaml-0.3.3}/README.md +26 -18
- {ebaml-0.3.1 → ebaml-0.3.3}/pyproject.toml +11 -4
- {ebaml-0.3.1 → ebaml-0.3.3}/pyproject.toml.orig +10 -5
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/.baml-generator-output.json +5 -5
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/__init__.py +67 -17
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/__init__.pyi +55 -14
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_baml_sources.py +2 -2
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_inlinedbaml.py +1 -1
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_typemap.py +3 -1
- ebaml-0.3.3/src/ebaml/__init__.py +176 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/core/exceptions.py +4 -0
- ebaml-0.3.3/src/ebaml/graphs/request_text.py +76 -0
- ebaml-0.3.3/src/ebaml/graphs/token_budget.py +345 -0
- ebaml-0.3.3/src/ebaml/graphs/token_weights.py +466 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/descriptors.py +89 -8
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/options.py +6 -1
- ebaml-0.3.3/src/ebaml/llm/token_learning.py +322 -0
- ebaml-0.3.3/src/ebaml/llm/token_weights.json +30 -0
- ebaml-0.3.1/src/ebaml/__init__.py +0 -73
- ebaml-0.3.1/src/ebaml/graphs/token_budget.py +0 -84
- {ebaml-0.3.1 → ebaml-0.3.3}/LICENSE +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/.baml-generator-output-root +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/.gitignore +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_function_registry.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_invocation_types.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/_invocation_types.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/clients/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/clients/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/content/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/content/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/errors/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/errors/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/events/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/events/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/mcp/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/mcp/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/stream/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/stream/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/tools/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/tools/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/wire/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/ai/wire/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/crypto/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/crypto/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/csv/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/csv/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/env/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/env/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/errors/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/errors/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/fs/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/fs/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/future/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/future/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/glob/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/glob/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/hash/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/hash/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/host/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/host/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/http/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/http/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/io/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/io/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/iter/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/iter/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/json/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/json/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/media/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/media/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/net/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/net/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/ops/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/ops/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/panics/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/panics/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/random/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/random/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/regex/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/regex/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/sap/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/sap/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/spawn/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/spawn/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/sys/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/sys/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/time/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/time/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/toml/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/toml/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/ws/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/ws/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/yaml/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/baml/yaml/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/experimental/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/experimental/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/py.typed +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/class_/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/class_/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/enum/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/enum/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/errors/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/errors/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/function/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/function/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/interface/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/reflect/interface/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/anthropic/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/anthropic/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/anthropic/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/anthropic/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/assert_/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/assert_/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/aws/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/aws/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/aws/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/aws/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/claude_code/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/claude_code/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/claude_code/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/claude_code/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/google/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/google/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/google/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/google/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/internal/decisions/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/openai/internal/decisions/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/testing/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/testing/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/trace/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/trace/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/typesafeai/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/typesafeai/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/typesafeai/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/typesafeai/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/vercel/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/vercel/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/vercel/internal/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/baml_sdk/vendor/vercel/internal/__init__.pyi +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/benchmark.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/core/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/core/custom_types.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/graphs/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/graphs/ebm_graph.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/graphs/graph_text.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/graphs/model_kinds.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/graphs/terms.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/provider_errors.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/retry.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/llm/sdk_setup.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/local/__init__.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/local/audience.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/local/fact_text.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/src/ebaml/local/facts.py +0 -0
- {ebaml-0.3.1 → ebaml-0.3.3}/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.3
|
|
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/
|
|
@@ -121,10 +124,10 @@ baml generate
|
|
|
121
124
|
This writes the `src/baml_sdk/` package from `baml_src/`, next to `ebaml`, so it imports wherever the project is
|
|
122
125
|
installed. Rerun it every time a `.baml` file changes, including when you change the provider.
|
|
123
126
|
|
|
124
|
-
If `src/baml_sdk/` does not exist,
|
|
125
|
-
|
|
126
|
-
`baml
|
|
127
|
-
again with `--agent-skill-check off`. If none of this works, `SDKUnavailableError` lists the steps that fix the cause.
|
|
127
|
+
If `src/baml_sdk/` does not exist, the first use of `describe_graph`, `describe_ebm` or `explain_instance` runs
|
|
128
|
+
`baml generate`. `import ebaml` alone does not run it. If the package was generated by another BAML toolchain than the one
|
|
129
|
+
that `baml-bridge` expects (a version skew), the first use runs `baml toolchain use <version>` and `baml generate`. If
|
|
130
|
+
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.
|
|
128
131
|
|
|
129
132
|
### 5. Check the setup
|
|
130
133
|
|
|
@@ -166,8 +169,8 @@ It fits a small EBM, runs the three-turn chain directly and checks that the prov
|
|
|
166
169
|
```python
|
|
167
170
|
from interpret.glassbox import ExplainableBoostingClassifier
|
|
168
171
|
|
|
169
|
-
from ebaml
|
|
170
|
-
from ebaml
|
|
172
|
+
from ebaml import describe_ebm, describe_graph
|
|
173
|
+
from ebaml import PromptOptions
|
|
171
174
|
|
|
172
175
|
ebm = ExplainableBoostingClassifier().fit(X, y)
|
|
173
176
|
|
|
@@ -181,7 +184,7 @@ embedded in a longer prompt. It needs the confidence bounds, and it only reads c
|
|
|
181
184
|
Three keyword-only arguments set the options. `graph=GraphOptions(...)` sets the options of `EBMGraph.from_ebm` and
|
|
182
185
|
`EBMGraph.to_text`, for example `max_tokens`. `prompt=PromptOptions(...)` sets the descriptions that the prompts use
|
|
183
186
|
(`expert_description`, `graph_description`, `dataset_description` and `task_description`). `model=` selects the LLM, see
|
|
184
|
-
"Choosing the model".
|
|
187
|
+
"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.
|
|
185
188
|
|
|
186
189
|
A multiclass classifier has one graph series per class. `GraphOptions(classes=[...])` selects the classes to describe,
|
|
187
190
|
because the text of a model with many classes is long. In every bin, the scores have the same mean over all the classes
|
|
@@ -196,7 +199,7 @@ y_multiclass = np.select([X["age"] < 30, X["age"] < 60], ["young", "middle"], "o
|
|
|
196
199
|
-->
|
|
197
200
|
|
|
198
201
|
```python
|
|
199
|
-
from ebaml
|
|
202
|
+
from ebaml import GraphOptions
|
|
200
203
|
|
|
201
204
|
multiclass = ExplainableBoostingClassifier(interactions=0).fit(X, y_multiclass)
|
|
202
205
|
print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["young", "old"])))
|
|
@@ -205,7 +208,7 @@ print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["y
|
|
|
205
208
|
### Explaining one prediction
|
|
206
209
|
|
|
207
210
|
```python
|
|
208
|
-
from ebaml
|
|
211
|
+
from ebaml import describe_ebm, explain_instance
|
|
209
212
|
|
|
210
213
|
ebm = ExplainableBoostingClassifier(interactions=0).fit(X, y) # binary classifier, no interactions
|
|
211
214
|
global_explanation = describe_ebm(ebm) # computed once, prepended to every local prompt
|
|
@@ -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. |
|
|
@@ -248,8 +252,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
248
252
|
| `RateLimitedError` | no | A provider limits the rate of the requests. |
|
|
249
253
|
| `ProviderUnreachableError` | no | A request does not reach the provider. |
|
|
250
254
|
|
|
251
|
-
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`.
|
|
252
|
-
them too.
|
|
255
|
+
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`. `ebaml` exports all of these classes.
|
|
253
256
|
|
|
254
257
|
<!-- --8<-- [end:usage] -->
|
|
255
258
|
## How it works
|
|
@@ -279,11 +282,19 @@ them too.
|
|
|
279
282
|
rejects are not retried.
|
|
280
283
|
- **Concurrency:** `describe_ebm` describes features concurrently, at most `max_concurrency` at a time (default 8).
|
|
281
284
|
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
|
-
`
|
|
285
|
+
- **Token budget:** there is no tokenizer before a call, so the check estimates the tokens of a graph text from its
|
|
286
|
+
words and its digits. The default weights are 4.13 tokens for each word and 0.27 for each digit. They come from 100
|
|
287
|
+
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
288
|
+
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
289
|
+
`max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes `to_text` simplify the graph, or
|
|
290
|
+
raise if it cannot. The provider's own error is the real limit. `describe_graph`, `describe_ebm` and `explain_instance` pass the
|
|
291
|
+
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
292
|
+
`ebaml.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
293
|
+
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
294
|
+
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
295
|
+
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
296
|
+
persist in `~/.cache/ebaml/token_weights.json`. Learning is off by default, because learned weights change the graph
|
|
297
|
+
text from one call to the next. `scripts/fit_token_weights.py` adds the weights of a new model to the table.
|
|
287
298
|
|
|
288
299
|
<!-- --8<-- [end:behaviour] -->
|
|
289
300
|
## Notebook
|
|
@@ -356,7 +367,7 @@ request of that call to that model. You do not change the package.
|
|
|
356
367
|
Pass the shorthand `"provider/model"`:
|
|
357
368
|
|
|
358
369
|
```python
|
|
359
|
-
from ebaml
|
|
370
|
+
from ebaml import describe_ebm
|
|
360
371
|
|
|
361
372
|
print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
362
373
|
```
|
|
@@ -364,7 +375,7 @@ print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
|
364
375
|
Pass `ModelOptions` to set more:
|
|
365
376
|
|
|
366
377
|
```python
|
|
367
|
-
from ebaml
|
|
378
|
+
from ebaml import ModelOptions
|
|
368
379
|
|
|
369
380
|
model = ModelOptions(provider="anthropic", model="claude-haiku-4-5", temperature=0.2, max_output_tokens=8000)
|
|
370
381
|
print(describe_ebm(ebm, model=model))
|
|
@@ -93,10 +93,10 @@ baml generate
|
|
|
93
93
|
This writes the `src/baml_sdk/` package from `baml_src/`, next to `ebaml`, so it imports wherever the project is
|
|
94
94
|
installed. Rerun it every time a `.baml` file changes, including when you change the provider.
|
|
95
95
|
|
|
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.
|
|
96
|
+
If `src/baml_sdk/` does not exist, the first use of `describe_graph`, `describe_ebm` or `explain_instance` runs
|
|
97
|
+
`baml generate`. `import ebaml` alone does not run it. If the package was generated by another BAML toolchain than the one
|
|
98
|
+
that `baml-bridge` expects (a version skew), the first use runs `baml toolchain use <version>` and `baml generate`. If
|
|
99
|
+
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
100
|
|
|
101
101
|
### 5. Check the setup
|
|
102
102
|
|
|
@@ -138,8 +138,8 @@ It fits a small EBM, runs the three-turn chain directly and checks that the prov
|
|
|
138
138
|
```python
|
|
139
139
|
from interpret.glassbox import ExplainableBoostingClassifier
|
|
140
140
|
|
|
141
|
-
from ebaml
|
|
142
|
-
from ebaml
|
|
141
|
+
from ebaml import describe_ebm, describe_graph
|
|
142
|
+
from ebaml import PromptOptions
|
|
143
143
|
|
|
144
144
|
ebm = ExplainableBoostingClassifier().fit(X, y)
|
|
145
145
|
|
|
@@ -153,7 +153,7 @@ embedded in a longer prompt. It needs the confidence bounds, and it only reads c
|
|
|
153
153
|
Three keyword-only arguments set the options. `graph=GraphOptions(...)` sets the options of `EBMGraph.from_ebm` and
|
|
154
154
|
`EBMGraph.to_text`, for example `max_tokens`. `prompt=PromptOptions(...)` sets the descriptions that the prompts use
|
|
155
155
|
(`expert_description`, `graph_description`, `dataset_description` and `task_description`). `model=` selects the LLM, see
|
|
156
|
-
"Choosing the model".
|
|
156
|
+
"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
157
|
|
|
158
158
|
A multiclass classifier has one graph series per class. `GraphOptions(classes=[...])` selects the classes to describe,
|
|
159
159
|
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 +168,7 @@ y_multiclass = np.select([X["age"] < 30, X["age"] < 60], ["young", "middle"], "o
|
|
|
168
168
|
-->
|
|
169
169
|
|
|
170
170
|
```python
|
|
171
|
-
from ebaml
|
|
171
|
+
from ebaml import GraphOptions
|
|
172
172
|
|
|
173
173
|
multiclass = ExplainableBoostingClassifier(interactions=0).fit(X, y_multiclass)
|
|
174
174
|
print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["young", "old"])))
|
|
@@ -177,7 +177,7 @@ print(describe_graph(multiclass, feature_index=0, graph=GraphOptions(classes=["y
|
|
|
177
177
|
### Explaining one prediction
|
|
178
178
|
|
|
179
179
|
```python
|
|
180
|
-
from ebaml
|
|
180
|
+
from ebaml import describe_ebm, explain_instance
|
|
181
181
|
|
|
182
182
|
ebm = ExplainableBoostingClassifier(interactions=0).fit(X, y) # binary classifier, no interactions
|
|
183
183
|
global_explanation = describe_ebm(ebm) # computed once, prepended to every local prompt
|
|
@@ -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. |
|
|
@@ -220,8 +221,7 @@ of `ebaml` apart from the errors of other code. Each error for a bad value also
|
|
|
220
221
|
| `RateLimitedError` | no | A provider limits the rate of the requests. |
|
|
221
222
|
| `ProviderUnreachableError` | no | A request does not reach the provider. |
|
|
222
223
|
|
|
223
|
-
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`.
|
|
224
|
-
them too.
|
|
224
|
+
`EBMGraphShapeError`, `EBMGraphTokenLimitError` and `EBMGraphSimplificationError` derive from `EBMGraphError`. The four provider errors derive from `LLMRequestError`. `ebaml` exports all of these classes.
|
|
225
225
|
|
|
226
226
|
<!-- --8<-- [end:usage] -->
|
|
227
227
|
## How it works
|
|
@@ -251,11 +251,19 @@ them too.
|
|
|
251
251
|
rejects are not retried.
|
|
252
252
|
- **Concurrency:** `describe_ebm` describes features concurrently, at most `max_concurrency` at a time (default 8).
|
|
253
253
|
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
|
-
`
|
|
254
|
+
- **Token budget:** there is no tokenizer before a call, so the check estimates the tokens of a graph text from its
|
|
255
|
+
words and its digits. The default weights are 4.13 tokens for each word and 0.27 for each digit. They come from 100
|
|
256
|
+
graph texts that one current model counted. The estimate has a margin above the fit, so it is more often too high
|
|
257
|
+
than too low. Other models count other numbers of tokens, so the estimate is a guide. Going a little over
|
|
258
|
+
`max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes `to_text` simplify the graph, or
|
|
259
|
+
raise if it cannot. The provider's own error is the real limit. `describe_graph`, `describe_ebm` and `explain_instance` pass the
|
|
260
|
+
check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass `check_budget`, for example
|
|
261
|
+
`ebaml.check_token_budget`. That check needs no LLM and no key. To choose the weights, pass a
|
|
262
|
+
`TokenEstimator` instead. To use the weights of each model and to learn them, pass
|
|
263
|
+
`GraphOptions(token_learner=TokenLearner(learning=True))`. The learner starts each model at the weights of a table
|
|
264
|
+
that ships with the package. Then it moves them toward the tokens of the graphs in your real calls. The weights
|
|
265
|
+
persist in `~/.cache/ebaml/token_weights.json`. Learning is off by default, because learned weights change the graph
|
|
266
|
+
text from one call to the next. `scripts/fit_token_weights.py` adds the weights of a new model to the table.
|
|
259
267
|
|
|
260
268
|
<!-- --8<-- [end:behaviour] -->
|
|
261
269
|
## Notebook
|
|
@@ -328,7 +336,7 @@ request of that call to that model. You do not change the package.
|
|
|
328
336
|
Pass the shorthand `"provider/model"`:
|
|
329
337
|
|
|
330
338
|
```python
|
|
331
|
-
from ebaml
|
|
339
|
+
from ebaml import describe_ebm
|
|
332
340
|
|
|
333
341
|
print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
334
342
|
```
|
|
@@ -336,7 +344,7 @@ print(describe_ebm(ebm, model="anthropic/claude-haiku-4-5"))
|
|
|
336
344
|
Pass `ModelOptions` to set more:
|
|
337
345
|
|
|
338
346
|
```python
|
|
339
|
-
from ebaml
|
|
347
|
+
from ebaml import ModelOptions
|
|
340
348
|
|
|
341
349
|
model = ModelOptions(provider="anthropic", model="claude-haiku-4-5", temperature=0.2, max_output_tokens=8000)
|
|
342
350
|
print(describe_ebm(ebm, model=model))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.3"
|
|
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
|
|
|
@@ -51,9 +54,6 @@ override-dependencies = [
|
|
|
51
54
|
"opentelemetry-instrumentation-threading>=0.66b0",
|
|
52
55
|
]
|
|
53
56
|
|
|
54
|
-
[tool.uv.exclude-newer-package]
|
|
55
|
-
baml-bridge = false
|
|
56
|
-
|
|
57
57
|
[tool.uv.build-backend]
|
|
58
58
|
module-name = [
|
|
59
59
|
"ebaml",
|
|
@@ -254,6 +254,12 @@ entry_title_template = "[{{ version }}] - {{ date.strftime('%Y-%m-%d') }}"
|
|
|
254
254
|
[tool.commitizen]
|
|
255
255
|
name = "cz_conventional_commits"
|
|
256
256
|
|
|
257
|
+
[tool.deptry]
|
|
258
|
+
known_first_party = [
|
|
259
|
+
"ebaml",
|
|
260
|
+
"baml_sdk",
|
|
261
|
+
]
|
|
262
|
+
|
|
257
263
|
[build-system]
|
|
258
264
|
requires = ["uv_build>=0.12.3,<0.13.0"]
|
|
259
265
|
build-backend = "uv_build"
|
|
@@ -261,6 +267,7 @@ build-backend = "uv_build"
|
|
|
261
267
|
[dependency-groups]
|
|
262
268
|
dev = [
|
|
263
269
|
"cosmic-ray>=8.7.0",
|
|
270
|
+
"deptry>=0.25.1",
|
|
264
271
|
"hypothesis>=6.170.1",
|
|
265
272
|
"import-linter>=2.15",
|
|
266
273
|
"marimo>=0.25.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ebaml"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.3"
|
|
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
|
|
|
@@ -36,10 +39,6 @@ Changelog = "https://github.com/johnny-godoy/EBaMl/blob/main/CHANGELOG.md"
|
|
|
36
39
|
[tool.uv]
|
|
37
40
|
# A relative span keeps the cutoff 7 days behind today, so uv never picks a release that is less than 7 days old.
|
|
38
41
|
exclude-newer = "7 days"
|
|
39
|
-
# reason: baml-bridge must match the BAML toolchain that generates src/baml_sdk, or the SDK fails at start with a version
|
|
40
|
-
# skew error. CI installs the newest toolchain, and toolchain 0.23.0 changed the ai.Client interface, so the repository
|
|
41
|
-
# needs baml-bridge 0.23.0 at once. Remove the entry once 0.23.0 is more than 7 days old.
|
|
42
|
-
exclude-newer-package = { baml-bridge = false }
|
|
43
42
|
# 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
|
|
44
43
|
# and opentelemetry-api 1.45.1. Dependabot cannot update them, so the override forces the fixed releases. The
|
|
45
44
|
# opentelemetry packages must move together, because semgrep fails to import with opentelemetry-api 1.45 and the older
|
|
@@ -137,6 +136,7 @@ select = ["ALL"]
|
|
|
137
136
|
[dependency-groups]
|
|
138
137
|
dev = [
|
|
139
138
|
"cosmic-ray>=8.7.0",
|
|
139
|
+
"deptry>=0.25.1",
|
|
140
140
|
"hypothesis>=6.170.1",
|
|
141
141
|
"import-linter>=2.15",
|
|
142
142
|
"marimo>=0.25.1",
|
|
@@ -297,3 +297,8 @@ entry_title_template = "[{{ version }}] - {{ date.strftime('%Y-%m-%d') }}"
|
|
|
297
297
|
# version, so `cz bump` and `cz changelog` are not used.
|
|
298
298
|
[tool.commitizen]
|
|
299
299
|
name = "cz_conventional_commits"
|
|
300
|
+
|
|
301
|
+
[tool.deptry]
|
|
302
|
+
# reason: baml_sdk is generated into src/ and gitignored, and the build backend ships it with ebaml (module-name), so
|
|
303
|
+
# deptry cannot see it as part of this project without a hint.
|
|
304
|
+
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",
|
|
@@ -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.
|