Oh what I'm gathering from https://docs.boundaryml.com/ref/prompt-syntax/role is that BAML could change the role based on the LLM provider?
It might be my misunderstanding then about the important of the role value.
g
greg (BAML)
12/11/2025, 12:12 AM
You're right that BAML sometimes changes the role. That's to provide a uniform BAML-side interface, that allows you to change providers, without having to change your roles in your code.
s
Sanjan
12/11/2025, 12:13 AM
Hm so if I wanted a custom tool role to store tool results, cause I'm not sure if I'd call them "user" or "assistant" or "system". Is that possible?
Or if you know of best practices when it comes to adding tool results to a conversation state
a
aaronv (BAML)
12/11/2025, 10:33 PM
you could try to use _.role("tool") if the provider supports it. When you serialize your messages you could check the type of the message and use 'tool' for tool call results. We usually just tell people to use assistant / user and it works well. Have you run into issues?
s
Sanjan
12/11/2025, 10:57 PM
Well I'm still debugging my prompts to figure out why sometimes tool call isn't working, or steering the model to return output in expected format. In that process, I checked the raw logs and noticed the role replacement.
I don't think it's high impacting, I found some other issues with my prompt
a
aaronv (BAML)
12/11/2025, 10:59 PM
if you are struggling you can inject assistant messages like 'I will now answer in the json schema'
s
Sanjan
12/11/2025, 11:10 PM
Hm okay. I've had a couple learnings from the last few days' debugging - different models are optimized for different outputs when doing "function calling". I found that Sonnet 4.5 likes XML tags while GPT likes JSON.
Also, starting off with round robin client between Sonnet and GPT isn't the best idea, especially when the prompt isn't full optimized. I did it so I could reduce 429 throttling, but now I'm just focusing on one model with a fallback.