https://www.boundaryml.com logo
🟡 Integrating business rules from text files into...
# questions
a
Hi team, is there a way to define part of prompt like business rule in a seperate text file, and have baml prompt template read in that file in runtime? I am taking over a project where it has quite a few business rules defined in a plain text file, which makes it easy for business stakeholders to review. Then in runtime, python read in that file as a variable and pass it onto langchain's PrompTemplate. I want to refactor the llm invoke part to make use of BAML, and couldn't figure out how to inject the business rule plain text prompt into BAML function.
s
You could pass in an argument to the BAML function with the result of the business logic, and then reference that in the prompt. Like,
Copy code
function UseTool(user_message: string) -> (WeatherAPI | MyOtherAPI)[] {
  client "openai/gpt-5-mini"
  prompt #"
    Given a message, extract info.
    {# special macro to print the functions return type. #}
    {{ ctx.output_format }}

    {{ _.role('user') }}
    {{ user_message }}
  "#
}
a
Hey @Sanjan thanks for the reply. Got it working now