-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Summary
OpenAI’s latest documentation and cookbook examples show the Responses API using the web_search
tool (stable), but the official Go SDK currently exposes only preview types (web_search_preview
, web_search_preview_2025_03_11
).
This creates a mismatch and makes it harder to follow the docs from Go.
What happened
When trying to enable web search with the Responses API from Go, there is no typed constant for web_search
.
The responses
package defines WebSearchToolType
with only preview values:
// From pkg.go.dev docs for github.com/openai/openai-go/responses
// WebSearchToolType: "web_search_preview" | "web_search_preview_2025_03_11"
There is no WebSearchToolTypeWebSearch
(or equivalent) even though the docs demonstrate:
"tools": [{ "type": "web_search" }]
References
- Cookbook example uses
"type": "web_search"
. - SDK docs show only preview enum values for
WebSearchToolType
.
Expected behavior
The Go SDK should provide first-class typed support for the stable web_search
tool in the Responses API, e.g., a WebSearchToolTypeWebSearch
constant (or accepting "web_search"
without resorting to raw strings), aligning with the official docs/cookbook.
Actual behavior
Only preview types are available in the Go SDK (web_search_preview
, web_search_preview_2025_03_11
).
Related streaming event types already use web_search_call
naming, which further highlights the inconsistency.
Minimal example (illustrative)
// go.mod: github.com/openai/openai-go/v2 v2.1.1
// (code simplified to illustrate the missing constant)
import "github.com/openai/openai-go/responses"
_ = responses.WebSearchToolParam{
// No typed constant available for "web_search" in the SDK today.
Type: responses.WebSearchToolType("web_search"),
}
The docs suggest creating a Responses request with:
"tools": [{ "type": "web_search" }]
…but the Go SDK doesn’t expose a matching typed value.
Environment
- openai-go: v2.1.1 (latest as of Aug 2025)
- Go: (e.g.) 1.22.x
- OS: (e.g.) macOS 14 / Linux
Workaround
Continue using web_search_preview
types from the SDK until web_search
is available, but this diverges from the current docs.
Proposed fix
- Add stable
web_search
support to the Responses tool types inresponses
:- Introduce a typed constant for
web_search
(e.g.,WebSearchToolTypeWebSearch
) alongside existing preview values. - Ensure
WebSearchToolParam
and any related option structs accept it.
- Introduce a typed constant for
- Update examples/tests to use
web_search
for Responses to match the docs/cookbook. - (Optional) Keep preview values for backward compatibility.
I’m happy to help with a PR if this direction sounds good. Thanks!