https://www.boundaryml.com logo
🟑 System prompt confusion when switching to Custo...
# questions
a
https://docs.boundaryml.com/examples/prompt-engineering/chat I copy the chat-history.baml from here, and it works fine. But when I switch the model to CustomVertex, it messed up the system prompt with the user prompt: In the screenshot, you can see the system prompt "Answer the user's questions based on the chat history:" become the first user prompt. Is this a compiling bug or vertexai has diff contract compared to openai?
Copy code
client<llm> CustomVertex {
  provider vertex-ai
  options {
    model "gemini-2.5-flash"
    location "us-central1"
    // Uses Google Cloud Application Default Credentials
  }
}
https://cdn.discordapp.com/attachments/1253172394345107466/1448627887459668022/image.png?ex=693fe7da&is=693e965a&hm=012778b42f828d2455db9098bf1120d9840e83f382e6b3178e95d7a790331c9d&
v
It’s all actually related to what the default_role under each provider is. Google and anthropic both recommend against using system messages, so the default role for both of them is user. You can modify that by setting the default_role to system in the client options. Alternatively, you can explicitly put the fist part of the prompt explicitly as a system role as well!
Hope that helps!
a
Thanks @Vaibhav (BAML πŸ‘) , putting in the default_role paramter works! Is there anyway I can find out such information from documentation/code? BAML feels to me (by watching your demo) extremely easy to setup and use, but when I use it myself, I often find the information is a bit hidden and require insider knowledge? For example, even after getting the
detault_role
parameter to work, I still cannot find either in code or documentation that this is one of the field that is supported. Can you show me how I could find such information in BAML doc/code so I can figure out myself and hopefully ask less of the how-to questions overtime
a
i think we are just lacking great docs -- so thanks for flagging this, we can update several places in our docs
a
Thanks aaronv. other than doc, Is there a way to figure out in code's static typing or object dotstring? Like in langgraph, you can see the object source python code to figure out all the supported parameter. Tho BAML is implemented in Rust, I am not sure whether it can still be possible somehow to propogate it into the baml_src layer. I don't have a strong engineer background so apology if this is a rather dumb question 😒
a
for the provider parameter options, not yet, since each provider is very different. But you can view the raw curl http request BAML makes, which gets rid of the whole 'im not sure what payload this is sending out'. For all other baml-specific parameters like default_role, we are working on adding completions for this, but no unfortunately it's not easily available today.
a
Thanks for the reply aaronv, appreciate the amount of great work has been put into this.
2 Views