vikimaster2
09/10/2025, 8:59 PMtberman
09/10/2025, 10:19 PMbaml-sam
09/11/2025, 1:24 AMvikimaster2
09/11/2025, 8:13 AMOnTick does not get called with the very last function log as none of the logs had a request duration when I logged them, but I'm not sure whether this holds true for all cases (maybe even if we throw reasoning models into the mix; would I get the same amount of empty stream values as function logs while the model is outputting reasoning tokens?), so I suppose that's what my question is.
My current use case is to stream both the parsed and raw responses side by side for an internal testing web app we're building at work, but I'm also just curious in general as to how OnTick is supposed to be used for anything meaningful besides debug logs. Looking at the documentation, OnTick seems to be the only source of live raw response information, yet there are no common identifiers between the stream values and function logs that would allow me to bundle them together and, e.g., send them as a pair to the frontend.baml-sam
09/11/2025, 7:24 PMb.call and b.stream interfaces as simple as possible, which is why they look the way they do right now. I would not treat the stream event count as 1:1 between the two - the fact that they do is an accidental implementation detail more than anything else.
OnTick was originally meant to give people access to fields like reasoning.summary or just response output that we don't surface (e.g. if the model explains its output before returning a '''json <code>''' block), but this is one that we'll look into exposing!tberman
09/14/2025, 10:44 PMtberman
09/14/2025, 10:44 PMvikimaster2
09/15/2025, 10:45 PMbaml-sam
09/15/2025, 10:46 PMVaibhav (BAML π)
09/15/2025, 11:00 PMvikimaster2
09/27/2025, 12:43 AMinvakid
11/07/2025, 11:10 AMVaibhav (BAML π)
11/08/2025, 3:21 PMonTick combined with a b.parse_stream.YourFunction(..) and that should "just work". you don't even need b.stream with this approach!Vaibhav (BAML π)
11/08/2025, 3:23 PMpython
def on_tick(result: FunctionLog):
# get raw_string by accessing text
raw = result.<depends on api>
# note, parsing may fail so events may need to be dropped.
parsed_result = b.parse_stream.MyFunction(raw)
result = b.MyFunction(..., baml_options={ "on_tick": on_tick })Vaibhav (BAML π)
11/08/2025, 3:24 PMid for what version of the function log you had. we can also consider putting the streamed object into the function log itself but we don't do that due to memorytberman
11/11/2025, 4:28 PMtberman
11/11/2025, 4:29 PMtberman
11/11/2025, 4:29 PMtberman
11/11/2025, 4:29 PMVaibhav (BAML π)
11/11/2025, 5:05 PMdef on_tick(result: FunctionLog, streamed_result: Option[T]):
# get raw_string by accessing text
raw = result.<depends on api>invakid
11/12/2025, 9:02 PM<depends on api> part? Rather, what's with the raw_llm_response field on the FunctionLog class if it is unusable in this context?
https://cdn.discordapp.com/attachments/1415441570689318963/1438272712186527774/Home_2025-11-12_at_11.01.46_PM.png?ex=69164758&is=6914f5d8&hm=3ebfe02c14971da13393231eac94691f53386914b03ff9bb267bce26449a3af0&invakid
11/12/2025, 10:02 PMsse_chunks available on `LLMStreamCall`s as the text property on each chunk made it seem like it would contain the actual delta of said SSE chunk, but I was disappointed to find out it is just the unparsed chunk...
It seems like a trend for the collector/ontick APIs to put the burden of knowing how to deal with each individual LLM provider on the user, which seems ridiculous, considering BAML clearly knows how to do so already. Sure, this is simple enough if one were to use OpenAI for everything, or if one were to just hardcode the expected structure for each prompt based on the provider used, but what if I have a fallback configured that possibly falls back to a completely different provider?
I have to agree with tbermann here, the collector API only really seems useful for metrics collection in practice, and doesn't appear to match the advertised capabilities all that wellVaibhav (BAML π)
11/15/2025, 7:01 PMraw_llm_response field as well!Vaibhav (BAML π)
11/15/2025, 7:02 PMVaibhav (BAML π)
11/15/2025, 7:03 PMraw_response_text or thinking etc and just expose the function to be a UDFVaibhav (BAML π)
11/15/2025, 7:04 PMVaibhav (BAML π)
11/15/2025, 7:04 PMtberman
11/16/2025, 11:23 PMtberman
11/16/2025, 11:23 PMtberman
11/16/2025, 11:24 PMtberman
11/16/2025, 11:24 PMtberman
11/16/2025, 11:24 PMtberman
11/16/2025, 11:25 PM