https://www.boundaryml.com logo
🟡 Assistance needed for passing guard rail ID and...
# questions
s
Hi, enjoying with baml and couldn't find in the documentation on how to pass guard raild id and version to bedrock llm client. If anyone can guide me that would be great.
n
you can pass anything to the api call in options field. You can also look into modular api: https://docs.boundaryml.com/guide/baml-advanced/modular-api#aws-bedrock
s
Is there a way to use it without modular API as I missing all the necessary important capabilities of baml
n
just pass anything in options field. It just puts everything from there into post request for you. Also I'm not the dev. They will probably will have a better answer
g
Thanks for your question! I believe in the Bedrock REST API, you specify the guardrails to apply via Request headers. In BAML, you can add headers to your requests like this:
Copy code
client<llm> GPT4o {
  provider aws-bedrock
  options {
    ...
    headers { // <-- HEADERS HERE
      X-Amzn-Bedrock-GuardrailIdentifier your-guardrail-id
      X-Amzn-Bedrock-GuardrailVersion 1
    }
  }
}
I'm not very confident about those particular headers. But let me know if you try this out and have issues. (It may also be helpful to look at the curl request preview in BAML playground to ensure your data are getting converted to request headers correctly).
s
It did not worked. I am getting error: Unsupported headers. I also tried to pass them to baml function in python using baml-options. It did not worked as well.