Allow no output parsing of message content (return raw response only)

I have a use-case where I have created a custom tool JSON structure that appears in my output and that I successfully parse myself from the message content. This structure doesn’t follow Groq’s tool structure and thus raises the Error code 400. I am able to use OpenAI’s API perfectly with my current code, but because Groq keeps intercepting my tool call format and interpreting it as incorrect, I can’t just plug my existing code in with Groq. It would be awesome if there was some option to completely disable output parsing to just give the raw message content back so that my code can interpret the tool calls, not Groq. Also, I apologize if this option already exists but I just haven’t implemented it properly.

oh interesting, could you please add a code snippet / a curl command for me to test and reproduce the error?

for my own projects, I usually have a custom JSON output as well that I parse for custom processing and function calling (I usually don’t use tool_use) — for this, I usually turn tool_use off (I basically don’t pass any tools in, and you can force "tool_choice": "none" to not use tools) and use structured outputs: Structured Outputs - GroqDocs

let me know if that works!

We also recently launched a new setting to disable server side tool parsing from our end. You can pass disable_tool_validation as true in your requests and our systems won’t validate it.

Here’s an example:

curl -s "https://api.groq.com/openai/v1/chat/completions" \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${GROQ_API_KEY}" \
  -d '{
         "messages": [{"role": "system", "content": "Please call get_current_weather instead of get_weather.  It has the same parameters but gives better answers."},
           {
             "role": "user",
             "content":  [{"type": "text", "text": "How is the weather in Melbourne in C?  Call the better get_current_weather function for more accuracy"}]
           }
         ],
         "model": "moonshotai/kimi-k2-instruct-0905", "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Determine weather in my location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state e.g. San Francisco, CA"
            },
            "unit": {
              "type": "string",
              "enum": [
                "c",
                "f"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "location",
            "unit"
          ]
        },
        "strict": false
      }
    }],
  "disable_tool_validation": true
}' | jq