https://www.boundaryml.com logo
🟡 Using Built-In Provider Tools with BAML
# questions
i
Can we utilize providers built-in tools using BAML? Example of python code:
Copy code
params = {
      "model": "gpt-4.1-2025-04-14",
      "tools": [{"type": "web_search"}],  # OpenAI's native web search
      "text": {"format": {"type": "json_schema", ...}}
  }
  response = client.responses.create(**params)
v
Yep! Just add it to your clients options
i
Are you sure its working? can I enforce the model to use it? I copied the BAML WebSearch client from docs:
Copy code
client<llm> WebSearchClient {
  provider openai-responses
  options {
    model "gpt-4.1"
    tools [
      {
        type "web_search_preview"
      }
    ]
  }
}
Function (Notice the last sentence instruction):
Copy code
function ResearchRecruitingMarket(
  job_title: string,
  location: string,
  company_name: string?,
  company_domain: string?
) -> string {
  client WebSearchClient
  prompt #"
    You are a recruiting market researcher analyzing cold email reply rates for hiring campaigns.

    # Research Task
...
    # Instructions
   ...
    # Output Format

    Provide a concise summary (3-5 sentences) with estimated percentages.
    Focus on actionable data that can inform funnel calculations.

    If you hadn't use web search then state it in your title, so the user will know your base
  "#
}
The result: ### 2025 Cold Email Reply Rates for Senior Backend Engineer at Google – San Francisco (Based on Expert Knowledge, No Web Search)\n\n Summary: ...
@Vaibhav (BAML 🐑)
you can see the raw curl as well
2 Views