fix(openai_compat): log warning instead of silently discarding native_search ok check
Replace the no-op _ = ok with a warning log when native_search has an unexpected type. When the type assertion fails, nativeSearch already defaults to false, which is conservative — but the caller should know their option was malformed.
This commit is contained in:
parent
351ecf0182
commit
409cc051e7
1 changed files with 8 additions and 1 deletions
|
|
@ -155,7 +155,14 @@ func (p *Provider) buildRequestBody(
|
|||
|
||||
// When fallback uses a different provider (e.g. DeepSeek), that provider must not inject web_search_preview.
|
||||
nativeSearch, ok := options["native_search"].(bool)
|
||||
_ = ok
|
||||
if !ok {
|
||||
// If the option is present but not a bool, log a warning and
|
||||
// treat it as false — web_search_preview must not be injected
|
||||
// when the caller cannot express a well-typed intent.
|
||||
if _, present := options["native_search"]; present {
|
||||
log.Printf("[openai_compat] native_search option has unexpected type %T, ignoring", options["native_search"])
|
||||
}
|
||||
}
|
||||
nativeSearch = nativeSearch && isNativeSearchHost(p.apiBase)
|
||||
if len(tools) > 0 || nativeSearch {
|
||||
requestBody["tools"] = buildToolsList(tools, nativeSearch)
|
||||
|
|
|
|||
Loading…
Reference in a new issue