ebaml 0.3.1__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.
Files changed (170) hide show
  1. {ebaml-0.3.1 → ebaml-0.3.2}/PKG-INFO +18 -6
  2. {ebaml-0.3.1 → ebaml-0.3.2}/README.md +14 -5
  3. {ebaml-0.3.1 → ebaml-0.3.2}/pyproject.toml +11 -1
  4. {ebaml-0.3.1 → ebaml-0.3.2}/pyproject.toml.orig +10 -1
  5. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/.baml-generator-output.json +5 -5
  6. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/__init__.py +67 -17
  7. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/__init__.pyi +55 -14
  8. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_baml_sources.py +2 -2
  9. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_inlinedbaml.py +1 -1
  10. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_typemap.py +3 -1
  11. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/__init__.py +2 -0
  12. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/core/exceptions.py +4 -0
  13. ebaml-0.3.2/src/ebaml/graphs/request_text.py +76 -0
  14. ebaml-0.3.2/src/ebaml/graphs/token_budget.py +345 -0
  15. ebaml-0.3.2/src/ebaml/graphs/token_weights.py +466 -0
  16. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/descriptors.py +89 -8
  17. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/options.py +6 -1
  18. ebaml-0.3.2/src/ebaml/llm/token_learning.py +322 -0
  19. ebaml-0.3.2/src/ebaml/llm/token_weights.json +30 -0
  20. ebaml-0.3.1/src/ebaml/graphs/token_budget.py +0 -84
  21. {ebaml-0.3.1 → ebaml-0.3.2}/LICENSE +0 -0
  22. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/.baml-generator-output-root +0 -0
  23. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/.gitignore +0 -0
  24. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_function_registry.py +0 -0
  25. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_invocation_types.py +0 -0
  26. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/_invocation_types.pyi +0 -0
  27. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/__init__.py +0 -0
  28. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/__init__.pyi +0 -0
  29. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/clients/__init__.py +0 -0
  30. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/clients/__init__.pyi +0 -0
  31. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/content/__init__.py +0 -0
  32. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/content/__init__.pyi +0 -0
  33. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/errors/__init__.py +0 -0
  34. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/errors/__init__.pyi +0 -0
  35. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/events/__init__.py +0 -0
  36. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/events/__init__.pyi +0 -0
  37. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/internal/__init__.py +0 -0
  38. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/internal/__init__.pyi +0 -0
  39. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/mcp/__init__.py +0 -0
  40. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/mcp/__init__.pyi +0 -0
  41. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/stream/__init__.py +0 -0
  42. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/stream/__init__.pyi +0 -0
  43. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/tools/__init__.py +0 -0
  44. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/tools/__init__.pyi +0 -0
  45. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/wire/__init__.py +0 -0
  46. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/ai/wire/__init__.pyi +0 -0
  47. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/__init__.py +0 -0
  48. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/__init__.pyi +0 -0
  49. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/crypto/__init__.py +0 -0
  50. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/crypto/__init__.pyi +0 -0
  51. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/csv/__init__.py +0 -0
  52. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/csv/__init__.pyi +0 -0
  53. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/env/__init__.py +0 -0
  54. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/env/__init__.pyi +0 -0
  55. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/errors/__init__.py +0 -0
  56. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/errors/__init__.pyi +0 -0
  57. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/fs/__init__.py +0 -0
  58. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/fs/__init__.pyi +0 -0
  59. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/future/__init__.py +0 -0
  60. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/future/__init__.pyi +0 -0
  61. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/glob/__init__.py +0 -0
  62. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/glob/__init__.pyi +0 -0
  63. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/hash/__init__.py +0 -0
  64. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/hash/__init__.pyi +0 -0
  65. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/host/__init__.py +0 -0
  66. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/host/__init__.pyi +0 -0
  67. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/http/__init__.py +0 -0
  68. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/http/__init__.pyi +0 -0
  69. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/io/__init__.py +0 -0
  70. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/io/__init__.pyi +0 -0
  71. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/iter/__init__.py +0 -0
  72. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/iter/__init__.pyi +0 -0
  73. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/json/__init__.py +0 -0
  74. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/json/__init__.pyi +0 -0
  75. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/media/__init__.py +0 -0
  76. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/media/__init__.pyi +0 -0
  77. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/net/__init__.py +0 -0
  78. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/net/__init__.pyi +0 -0
  79. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/ops/__init__.py +0 -0
  80. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/ops/__init__.pyi +0 -0
  81. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/panics/__init__.py +0 -0
  82. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/panics/__init__.pyi +0 -0
  83. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/random/__init__.py +0 -0
  84. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/random/__init__.pyi +0 -0
  85. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/regex/__init__.py +0 -0
  86. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/regex/__init__.pyi +0 -0
  87. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/sap/__init__.py +0 -0
  88. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/sap/__init__.pyi +0 -0
  89. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/spawn/__init__.py +0 -0
  90. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/spawn/__init__.pyi +0 -0
  91. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/sys/__init__.py +0 -0
  92. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/sys/__init__.pyi +0 -0
  93. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/time/__init__.py +0 -0
  94. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/time/__init__.pyi +0 -0
  95. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/toml/__init__.py +0 -0
  96. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/toml/__init__.pyi +0 -0
  97. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/ws/__init__.py +0 -0
  98. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/ws/__init__.pyi +0 -0
  99. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/yaml/__init__.py +0 -0
  100. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/baml/yaml/__init__.pyi +0 -0
  101. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/experimental/__init__.py +0 -0
  102. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/experimental/__init__.pyi +0 -0
  103. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/py.typed +0 -0
  104. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/__init__.py +0 -0
  105. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/__init__.pyi +0 -0
  106. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/class_/__init__.py +0 -0
  107. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/class_/__init__.pyi +0 -0
  108. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/enum/__init__.py +0 -0
  109. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/enum/__init__.pyi +0 -0
  110. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/errors/__init__.py +0 -0
  111. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/errors/__init__.pyi +0 -0
  112. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/function/__init__.py +0 -0
  113. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/function/__init__.pyi +0 -0
  114. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/interface/__init__.py +0 -0
  115. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/reflect/interface/__init__.pyi +0 -0
  116. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/__init__.py +0 -0
  117. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/__init__.pyi +0 -0
  118. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/__init__.py +0 -0
  119. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/__init__.pyi +0 -0
  120. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/internal/__init__.py +0 -0
  121. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/anthropic/internal/__init__.pyi +0 -0
  122. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/assert_/__init__.py +0 -0
  123. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/assert_/__init__.pyi +0 -0
  124. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/__init__.py +0 -0
  125. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/__init__.pyi +0 -0
  126. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/internal/__init__.py +0 -0
  127. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/aws/internal/__init__.pyi +0 -0
  128. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/__init__.py +0 -0
  129. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/__init__.pyi +0 -0
  130. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/internal/__init__.py +0 -0
  131. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/claude_code/internal/__init__.pyi +0 -0
  132. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/google/__init__.py +0 -0
  133. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/google/__init__.pyi +0 -0
  134. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/google/internal/__init__.py +0 -0
  135. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/google/internal/__init__.pyi +0 -0
  136. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/__init__.py +0 -0
  137. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/__init__.pyi +0 -0
  138. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/__init__.py +0 -0
  139. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/__init__.pyi +0 -0
  140. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.py +0 -0
  141. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/openai/internal/decisions/__init__.pyi +0 -0
  142. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/testing/__init__.py +0 -0
  143. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/testing/__init__.pyi +0 -0
  144. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/trace/__init__.py +0 -0
  145. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/trace/__init__.pyi +0 -0
  146. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/__init__.py +0 -0
  147. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/__init__.pyi +0 -0
  148. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.py +0 -0
  149. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/typesafeai/internal/__init__.pyi +0 -0
  150. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/__init__.py +0 -0
  151. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/__init__.pyi +0 -0
  152. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/internal/__init__.py +0 -0
  153. {ebaml-0.3.1 → ebaml-0.3.2}/src/baml_sdk/vendor/vercel/internal/__init__.pyi +0 -0
  154. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/benchmark.py +0 -0
  155. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/core/__init__.py +0 -0
  156. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/core/custom_types.py +0 -0
  157. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/graphs/__init__.py +0 -0
  158. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/graphs/ebm_graph.py +0 -0
  159. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/graphs/graph_text.py +0 -0
  160. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/graphs/model_kinds.py +0 -0
  161. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/graphs/terms.py +0 -0
  162. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/__init__.py +0 -0
  163. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/provider_errors.py +0 -0
  164. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/retry.py +0 -0
  165. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/llm/sdk_setup.py +0 -0
  166. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/local/__init__.py +0 -0
  167. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/local/audience.py +0 -0
  168. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/local/fact_text.py +0 -0
  169. {ebaml-0.3.1 → ebaml-0.3.2}/src/ebaml/local/facts.py +0 -0
  170. {ebaml-0.3.1 → 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.1
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/
@@ -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 uses a rough estimate (about 3 characters per
283
- token). Going a little over `max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes
284
- `to_text` simplify the graph, or raise if it cannot. The provider's own error is the real limit. The functions in
285
- `ebaml.llm.descriptors` pass the check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass
286
- `check_budget`, for example `ebaml.graphs.token_budget.check_token_budget`. That check needs no LLM and no key.
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
@@ -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 uses a rough estimate (about 3 characters per
255
- token). Going a little over `max_tokens` only warns. Going more than `overbudget_percent` (default 50) over makes
256
- `to_text` simplify the graph, or raise if it cannot. The provider's own error is the real limit. The functions in
257
- `ebaml.llm.descriptors` pass the check. A direct call of `EBMGraph.to_text` checks nothing, unless you pass
258
- `check_budget`, for example `ebaml.graphs.token_budget.check_token_budget`. That check needs no LLM and no key.
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.1"
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.1"
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": "cd987ae33762c18e019c2740a626191acca2454e7a35fd52cd6063b6e5d5c42d"
10
+ "sha256": "11cf64083463a9485f91b97d373f878b5ff4a21d9f5f589fd725fd862da9e795"
11
11
  },
12
12
  {
13
13
  "relative_path": "__init__.pyi",
14
- "sha256": "d68b10a3c05704baf4a241201249b88bdf4f074927a3fe044c2ecd948b78ff45"
14
+ "sha256": "2adc45c6784bc52f6d387b8926e100b389042d141371497b0be8ab13ca932e6a"
15
15
  },
16
16
  {
17
17
  "relative_path": "_baml_sources.py",
18
- "sha256": "89bee5a4d1cefe54e077aff3b3bc5b32671d534a73f2babdeff6aa57d63a0fe3"
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": "a627d0980e34c1c28a38c927a23b3fa6f01ad6db8aa2d9eeb127d8ac6af048e9"
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": "9d0cd9e6eaebf67d231d0f54c4f43f24a70a307632c7ca8ebd738023e24191c8"
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 TokenUsage(pydantic.BaseModel):
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 Counted(pydantic.BaseModel):
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
- text: str
554
- usage: TokenUsage
555
+ input_tokens: int
556
+ output_tokens: int
557
+ samples: typing.List[TokenSample]
555
558
 
556
559
 
557
- class TokenBudget(pydantic.BaseModel):
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
- estimated_tokens: int
564
- status: typing.Union[typing.Literal["ok"], typing.Literal["warn"], typing.Literal["over"]]
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
- estimate_tokens = _define_function("user.estimate_tokens", "sync", ["text"], binding_name="estimate_tokens", binding_qualname="estimate_tokens", binding_module=__name__)
572
- estimate_tokens_async = _define_function("user.estimate_tokens", "async", ["text"], binding_name="estimate_tokens_async", binding_qualname="estimate_tokens_async", binding_module=__name__)
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
- check_token_budget = _define_function("user.check_token_budget", "sync", ["text", "max_tokens", "overbudget_percent"], binding_name="check_token_budget", binding_qualname="check_token_budget", binding_module=__name__)
576
- check_token_budget_async = _define_function("user.check_token_budget", "async", ["text", "max_tokens", "overbudget_percent"], binding_name="check_token_budget_async", binding_qualname="check_token_budget_async", binding_module=__name__)
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
- "estimate_tokens",
880
- "estimate_tokens_async",
881
- "check_token_budget",
882
- "check_token_budget_async",
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.
@@ -490,9 +490,17 @@ async def EbmSummaryShorten_stream_async(feature_importances: str, graph_descrip
490
490
  CompilationError, SpanError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
491
491
 
492
492
 
493
+ class TokenSample(pydantic.BaseModel):
494
+ provider: str
495
+ model: str
496
+ body: str
497
+ input_tokens: int
498
+
499
+
493
500
  class TokenUsage(pydantic.BaseModel):
494
501
  input_tokens: int
495
502
  output_tokens: int
503
+ samples: typing.List[TokenSample]
496
504
 
497
505
 
498
506
  class Counted(pydantic.BaseModel):
@@ -500,21 +508,20 @@ class Counted(pydantic.BaseModel):
500
508
  usage: TokenUsage
501
509
 
502
510
 
503
- class TokenBudget(pydantic.BaseModel):
504
- estimated_tokens: int
505
- status: typing.Union[typing.Literal["ok"], typing.Literal["warn"], typing.Literal["over"]]
506
-
507
-
508
511
  def add_usage(a: TokenUsage, b: TokenUsage, *, _baml: _BamlOptions | None = None) -> TokenUsage: ...
509
512
  async def add_usage_async(a: TokenUsage, b: TokenUsage, *, _baml: _BamlOptions | None = None) -> TokenUsage: ...
510
513
 
511
514
 
512
- def estimate_tokens(text: str, *, _baml: _BamlOptions | None = None) -> int: ...
513
- async def estimate_tokens_async(text: str, *, _baml: _BamlOptions | None = None) -> int: ...
515
+ def input_total(usage: ai.events.Usage, *, _baml: _BamlOptions | None = None) -> typing.Optional[int]: ...
516
+ async def input_total_async(usage: ai.events.Usage, *, _baml: _BamlOptions | None = None) -> typing.Optional[int]: ...
517
+
518
+
519
+ def sample_of(call: ai.events.ModelCall, *, _baml: _BamlOptions | None = None) -> typing.Optional[TokenSample]: ...
520
+ async def sample_of_async(call: ai.events.ModelCall, *, _baml: _BamlOptions | None = None) -> typing.Optional[TokenSample]: ...
514
521
 
515
522
 
516
- def check_token_budget(text: str, max_tokens: int, overbudget_percent: int, *, _baml: _BamlOptions | None = None) -> TokenBudget: ...
517
- async def check_token_budget_async(text: str, max_tokens: int, overbudget_percent: int, *, _baml: _BamlOptions | None = None) -> TokenBudget: ...
523
+ def samples_of(events: typing.List[ai.events.Event], *, _baml: _BamlOptions | None = None) -> typing.List[TokenSample]: ...
524
+ async def samples_of_async(events: typing.List[ai.events.Event], *, _baml: _BamlOptions | None = None) -> typing.List[TokenSample]: ...
518
525
 
519
526
 
520
527
  def run_counted(spec: ai.FunctionSpec[str], *, client: typing.Union[typing.Any, None, UNSET] = None, _baml: _BamlOptions | None = None) -> Counted:
@@ -525,6 +532,14 @@ async def run_counted_async(spec: ai.FunctionSpec[str], *, client: typing.Union[
525
532
  CompilationError, InvalidArgument, Timeout, UnknownError"""
526
533
 
527
534
 
535
+ def sample_graph_tokens(graph: str, opts: GraphPromptOptions, *, client: typing.Union[typing.Any, None, UNSET] = None, model: typing.Union[ModelSpec, None, UNSET] = None, _baml: _BamlOptions | None = None) -> typing.List[TokenSample]:
536
+ """Raises:
537
+ CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
538
+ async def sample_graph_tokens_async(graph: str, opts: GraphPromptOptions, *, client: typing.Union[typing.Any, None, UNSET] = None, model: typing.Union[ModelSpec, None, UNSET] = None, _baml: _BamlOptions | None = None) -> typing.List[TokenSample]:
539
+ """Raises:
540
+ CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
541
+
542
+
528
543
  def describe_graph_cot(graph: str, num_sentences: int, opts: GraphPromptOptions, *, client: typing.Union[typing.Any, None, UNSET] = None, model: typing.Union[ModelSpec, None, UNSET] = None, _baml: _BamlOptions | None = None) -> Counted:
529
544
  """Raises:
530
545
  CompilationError, InvalidArgument, Io, ParseError, Timeout, UnknownError"""
@@ -637,6 +652,22 @@ class SummaryEchoClient(pydantic.BaseModel):
637
652
  ...
638
653
 
639
654
 
655
+ def usage_with(input_tokens: typing.Optional[int], uncached: typing.Optional[int], cached: typing.Optional[int], written: typing.Optional[int], *, _baml: _BamlOptions | None = None) -> ai.events.Usage: ...
656
+ async def usage_with_async(input_tokens: typing.Optional[int], uncached: typing.Optional[int], cached: typing.Optional[int], written: typing.Optional[int], *, _baml: _BamlOptions | None = None) -> ai.events.Usage: ...
657
+
658
+
659
+ def call_with(model: typing.Optional[str], body: typing.Optional[str], usage: typing.Optional[ai.events.Usage], *, _baml: _BamlOptions | None = None) -> ai.events.ModelCall: ...
660
+ async def call_with_async(model: typing.Optional[str], body: typing.Optional[str], usage: typing.Optional[ai.events.Usage], *, _baml: _BamlOptions | None = None) -> ai.events.ModelCall: ...
661
+
662
+
663
+ class SampledClient(pydantic.BaseModel):
664
+ ...
665
+
666
+
667
+ class FailingClient(pydantic.BaseModel):
668
+ cut_off: bool
669
+
670
+
640
671
  __all__ = [
641
672
  "benchmark_sample",
642
673
  "benchmark_sample_async",
@@ -789,17 +820,21 @@ __all__ = [
789
820
  "EbmSummaryShorten_spec_async",
790
821
  "EbmSummaryShorten_stream",
791
822
  "EbmSummaryShorten_stream_async",
823
+ "TokenSample",
792
824
  "TokenUsage",
793
825
  "Counted",
794
- "TokenBudget",
795
826
  "add_usage",
796
827
  "add_usage_async",
797
- "estimate_tokens",
798
- "estimate_tokens_async",
799
- "check_token_budget",
800
- "check_token_budget_async",
828
+ "input_total",
829
+ "input_total_async",
830
+ "sample_of",
831
+ "sample_of_async",
832
+ "samples_of",
833
+ "samples_of_async",
801
834
  "run_counted",
802
835
  "run_counted_async",
836
+ "sample_graph_tokens",
837
+ "sample_graph_tokens_async",
803
838
  "describe_graph_cot",
804
839
  "describe_graph_cot_async",
805
840
  "summarize_ebm",
@@ -835,6 +870,12 @@ __all__ = [
835
870
  "text_turn_async",
836
871
  "TaggedEchoClient",
837
872
  "SummaryEchoClient",
873
+ "usage_with",
874
+ "usage_with_async",
875
+ "call_with",
876
+ "call_with_async",
877
+ "SampledClient",
878
+ "FailingClient",
838
879
  ]
839
880
 
840
881
  from . import reflect as reflect