https://www.boundaryml.com logo
🟡 Tool_choice parsing issue with OpenAI and Bedro...
# questions
s
Question regarding tool_choice parsing from OpenAI and Bedrock Calude: I'm setting tool_choice: required in the client registry, however the baml function isn't returning the correct parsing response. This is because openai is returning their own tool use interface, and not just a json with the tool use args, so it makes sense that it wouldn't parse it correctly. Was wondering if there are any plans to abstract this away from the user to handle provider-specific parsing for tool_choice responses. See example below:
Copy code
// Tool classes for chat functions
class SearchContentLibrary {
  query string @description("The query to search the content library for")
}

    ---LLM REPLY---
    {"type":"function_call","name":"search_content_library","arguments":"{\"query\":\"proposal management best practices\"}","call_id":"call_WbevPSVPfKmaJHY4oyt7448U"}
    ---Parsed Response (list<class SearchContentLibrary>)---
    [
      {
        "query": "{type: function_call, name: search_content_library, arguments: {\"query\":\"proposal management best practices\"}, call_id: call_WbevPSVPfKmaJHY4oyt7448U}"
      }
    ]
I was thinking to handle this in the short-term it'd be easier to define multiple response types for tool for each provider so baml can parse according to provider call
a
yep, we are working on this, to support the native tool calling apis
currently estimating for end of month
s
sounds good ty!
s
Does native tool calling mean the tools field used in the requests like
Copy code
curl https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4.1",
    "tools": [{ "type": "web_search_preview" }],
    "input": "What was a positive news story from today?"
  }'
a
yep, your BAML function
output
type will be put into the
tools
array for you as json