Merge pull request #3439 from ben-vargas/fix-grok-tool-params
fix(xai): default missing function tool parameters
This commit is contained in:
@@ -727,6 +727,7 @@ func normalizeXAITool(tool gjson.Result) ([]byte, bool, bool) {
|
||||
return nil, false, false
|
||||
}
|
||||
raw = updatedTool
|
||||
toolType = xaiFunctionToolType
|
||||
changed = true
|
||||
}
|
||||
if toolType == xaiWebSearchToolType && tool.Get("external_web_access").Exists() {
|
||||
@@ -737,6 +738,14 @@ func normalizeXAITool(tool gjson.Result) ([]byte, bool, bool) {
|
||||
raw = updatedTool
|
||||
changed = true
|
||||
}
|
||||
if toolType == xaiFunctionToolType && !tool.Get("parameters").Exists() {
|
||||
updatedTool, errSet := sjson.SetRawBytes(raw, "parameters", []byte(`{"type":"object","properties":{}}`))
|
||||
if errSet != nil {
|
||||
return nil, false, false
|
||||
}
|
||||
raw = updatedTool
|
||||
changed = true
|
||||
}
|
||||
return raw, changed, true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user