When executing function to obtain tool results. Mistral need TooCallID.
Issue:
- Request:
[{Role:user Content:Donne moi la météo à Plouaret en Celcius et km/h - Latitude : 48.5667 Longitude : -3.4667 ToolCalls:[]} {Role:assistant Content: ToolCalls:[{Id:cLg99HV1t Type:function Function:{Name:get_actual_weather Arguments:{"location": {"latitude": 48.5667, "longitude": -3.4667}, "units": {"speed": "km/h", "temperature": "Celsius"}}}}]} {Role:tool Content:{"humidity":"100%","rain_precipitation":"0.00mm","temperature":"5.80Celsius","wind_speed":"7.56km/h","wind_dir":"70.00° Est-Nord-Est"} ToolCalls:[]}]
==> Resulting in (HTTP Error 400) {"object":"error","message":"Tool call id has to be defined.","type":"invalid_request_error","param":null,"code":null}
To fix :
ToolCallID needs to be exportable
-
Request fixed:
[{Role:user Content:Donne moi la météo à Plouaret en Celcius et km/h - Latitude : 48.5667 Longitude : -3.4667 ToolCalls:[] ToolCallID:} {Role:assistant Content: ToolCalls:[{Id:TzczNXxXn Type:function Function:{Name:get_actual_weather Arguments:{"location": {"latitude": 48.5667, "longitude": -3.4667}, "units": {"speed": "km/h", "temperature": "Celsius"}}}}] ToolCallID:} {Role:tool Content:{"humidity":"100%","rain_precipitation":"0.00mm","temperature":"5.80Celsius","wind_speed":"7.56km/h","wind_dir":"70.00° Est-Nord-Est"} ToolCalls:[] ToolCallID:TzczNXxXn}]
-
==> Resulting in .ContentChoice{Content:"Sure!\nVoici la météo pour Plouaret :\n\n- Température: 5.80°C\n- Humidité: 100%\n- Vitesse du vent: 7.56km/h\n- Direction du vent: 70.00° Est-Nord-Est\n- Précipitations: 0.00mm", StopReason:"stop", GenerationInfo:map[string]interface {}(nil), FuncCall:(*llms.FunctionCall)(nil), ToolCalls:[]llms.ToolCall(nil), ReasoningContent:""}
// ChatMessage represents a single message in a chat.
type ChatMessage struct {
Role string json:"role"
Content any json:"content"
ToolCalls []ToolCall json:"tool_calls,omitempty"
ToolCallID string json:"tool_call_id,omitempty"
}
When executing function to obtain tool results. Mistral need TooCallID.
Issue:
[{Role:user Content:Donne moi la météo à Plouaret en Celcius et km/h - Latitude : 48.5667 Longitude : -3.4667 ToolCalls:[]} {Role:assistant Content: ToolCalls:[{Id:cLg99HV1t Type:function Function:{Name:get_actual_weather Arguments:{"location": {"latitude": 48.5667, "longitude": -3.4667}, "units": {"speed": "km/h", "temperature": "Celsius"}}}}]} {Role:tool Content:{"humidity":"100%","rain_precipitation":"0.00mm","temperature":"5.80Celsius","wind_speed":"7.56km/h","wind_dir":"70.00° Est-Nord-Est"} ToolCalls:[]}]
==> Resulting in (HTTP Error 400) {"object":"error","message":"Tool call id has to be defined.","type":"invalid_request_error","param":null,"code":null}
To fix :
ToolCallID needs to be exportable
Request fixed:
[{Role:user Content:Donne moi la météo à Plouaret en Celcius et km/h - Latitude : 48.5667 Longitude : -3.4667 ToolCalls:[] ToolCallID:} {Role:assistant Content: ToolCalls:[{Id:TzczNXxXn Type:function Function:{Name:get_actual_weather Arguments:{"location": {"latitude": 48.5667, "longitude": -3.4667}, "units": {"speed": "km/h", "temperature": "Celsius"}}}}] ToolCallID:} {Role:tool Content:{"humidity":"100%","rain_precipitation":"0.00mm","temperature":"5.80Celsius","wind_speed":"7.56km/h","wind_dir":"70.00° Est-Nord-Est"} ToolCalls:[] ToolCallID:TzczNXxXn}]
==> Resulting in .ContentChoice{Content:"Sure!\nVoici la météo pour Plouaret :\n\n- Température: 5.80°C\n- Humidité: 100%\n- Vitesse du vent: 7.56km/h\n- Direction du vent: 70.00° Est-Nord-Est\n- Précipitations: 0.00mm", StopReason:"stop", GenerationInfo:map[string]interface {}(nil), FuncCall:(*llms.FunctionCall)(nil), ToolCalls:[]llms.ToolCall(nil), ReasoningContent:""}
// ChatMessage represents a single message in a chat.
type ChatMessage struct {
Role string
json:"role"Content any
json:"content"ToolCalls []ToolCall
json:"tool_calls,omitempty"ToolCallID string
json:"tool_call_id,omitempty"}