Fix case mismatch in Langfuse Integration for tool calls
Michael Bell
Issue:
When using Vapi's built-in Langfuse integration, tool call messages are logged with camelCase field names instead of snake_case, making them incompatible with the OpenAI API format.
Current behavior:
- Messages logged as: toolCalls,toolCallId
- OpenAI API expects: tool_calls,tool_call_id
Impact:
Langfuse Playground cannot replay conversations containing tool calls because it receives a 400 error:
"Invalid parameter: messages with role 'tool' must be a response to a preceding message with 'tool_calls'."
Steps to reproduce:
- Enable Langfuse integration in Vapi (Settings → Integrations)
- Create an assistant that uses function/tool calls
- Make a call that triggers a tool
- View the trace in Langfuse
- Select a Generation after the tool call
- Click "Playground" button
- Click "Submit"
- Observe 400 error
Expected behavior:
Tool call messages should use snake_case (
tool_calls
, tool_call_id
) to match OpenAI API spec, allowing Playground to function correctly.