Replies: 4 comments
-
Associated discord thread: https://discord.com/channels/1119368998161752075/1119375594984050779/1324870777136353351 |
Beta Was this translation helpful? Give feedback.
-
Maybe further down the road you want to add ability to hand off the transport mechanism to the user. They can make their own http calls and capture what they want and hand the data back to you. People may have special proxy servers they need to set or have to log the calls into ops monitoring pipeline etc. Also this way you also future proof yourself for any additional logs and error handling. |
Beta Was this translation helpful? Give feedback.
-
@hellovai thank you for the update! Is there any workaround to count the tokens already? |
Beta Was this translation helpful? Give feedback.
-
This APi makes sense and would address my use cases. I appreciate that you also gave consideration to the streaming API as well. |
Beta Was this translation helpful? Give feedback.
-
One of the hardest parts about using BAML is exposing internal workings of BAML to developers using it. Items such as: Token Usage, Raw HTTP Response from the model are all abstracted away for the sake of simplicity. While we do value simplicity, we don’t want it introspection to be a blocker.
This document outlines a proposal that will allow BAML developers to:
💡 None of the content here changes anything about BAML code. This will only change baml_client code (i.e. how you call BAML functions).
Table of Contents
with_options
Get usage statistics (logger)
(This document is mostly python, but please see the full reference docs for other languages, they all expose the same capabilities)
Python
Accessing additional metadata
We also want to expose all metadata such as raw HTTP respones
Running calls in parallel (id)
When calling in parallel, its
logger.last
or filtering my function name may not be reliable.You can instead use the new
b.id
scope to generate an(id, T)
value from a function.Reducing repetition of baml_options with
with_options
You may find that always passing in
baml_options
can be cumbersome. We now allow you to construct aBamlClient
with default options passed in.Full reference docs
Logger Class
https://boundary-preview-12ad00fd-c3dc-43be-ab63-ae17b33338ce.docs.buildwithfern.com/ref/baml-client/logger
id scope
https://boundary-preview-12ad00fd-c3dc-43be-ab63-ae17b33338ce.docs.buildwithfern.com/ref/baml-client/id
with_options
https://boundary-preview-12ad00fd-c3dc-43be-ab63-ae17b33338ce.docs.buildwithfern.com/ref/baml-client/with-options
Beta Was this translation helpful? Give feedback.
All reactions