Class ResponseFunctionWebSearch.Action
-
- All Implemented Interfaces:
public final class ResponseFunctionWebSearch.ActionAn object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceResponseFunctionWebSearch.Action.VisitorAn interface that defines how to map each variant of Action to a value of type T.
public final classResponseFunctionWebSearch.Action.SearchAction type "search" - Performs a web search query.
public final classResponseFunctionWebSearch.Action.OpenPageAction type "open_page" - Opens a specific URL from search results.
public final classResponseFunctionWebSearch.Action.FindAction type "find_in_page": Searches for a pattern within a loaded page.
-
Method Summary
Modifier and Type Method Description final Optional<ResponseFunctionWebSearch.Action.Search>search()Action type "search" - Performs a web search query. final Optional<ResponseFunctionWebSearch.Action.OpenPage>openPage()Action type "open_page" - Opens a specific URL from search results. final Optional<ResponseFunctionWebSearch.Action.Find>findInPage()Action type "find_in_page": Searches for a pattern within a loaded page. final BooleanisSearch()final BooleanisOpenPage()final BooleanisFind()final ResponseFunctionWebSearch.Action.SearchasSearch()Action type "search" - Performs a web search query. final ResponseFunctionWebSearch.Action.OpenPageasOpenPage()Action type "open_page" - Opens a specific URL from search results. final ResponseFunctionWebSearch.Action.FindasFind()Action type "find_in_page": Searches for a pattern within a loaded page. final Optional<JsonValue>_json()final <T extends Any> Taccept(ResponseFunctionWebSearch.Action.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final ResponseFunctionWebSearch.Actionvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static ResponseFunctionWebSearch.ActionofSearch(ResponseFunctionWebSearch.Action.Search search)Action type "search" - Performs a web search query. final static ResponseFunctionWebSearch.ActionofOpenPage(ResponseFunctionWebSearch.Action.OpenPage openPage)Action type "open_page" - Opens a specific URL from search results. final static ResponseFunctionWebSearch.ActionofFind(ResponseFunctionWebSearch.Action.Find findInPage)Action type "find_in_page": Searches for a pattern within a loaded page. -
-
Method Detail
-
search
final Optional<ResponseFunctionWebSearch.Action.Search> search()
Action type "search" - Performs a web search query.
-
openPage
final Optional<ResponseFunctionWebSearch.Action.OpenPage> openPage()
Action type "open_page" - Opens a specific URL from search results.
-
findInPage
final Optional<ResponseFunctionWebSearch.Action.Find> findInPage()
Action type "find_in_page": Searches for a pattern within a loaded page.
-
isOpenPage
final Boolean isOpenPage()
-
asSearch
final ResponseFunctionWebSearch.Action.Search asSearch()
Action type "search" - Performs a web search query.
-
asOpenPage
final ResponseFunctionWebSearch.Action.OpenPage asOpenPage()
Action type "open_page" - Opens a specific URL from search results.
-
asFind
final ResponseFunctionWebSearch.Action.Find asFind()
Action type "find_in_page": Searches for a pattern within a loaded page.
-
accept
final <T extends Any> T accept(ResponseFunctionWebSearch.Action.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.openai.core.JsonValue; import java.util.Optional; Optional<String> result = action.accept(new Action.Visitor<Optional<String>>() { @Override public Optional<String> visitSearch(Search search) { return Optional.of(search.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final ResponseFunctionWebSearch.Action validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofSearch
final static ResponseFunctionWebSearch.Action ofSearch(ResponseFunctionWebSearch.Action.Search search)
Action type "search" - Performs a web search query.
-
ofOpenPage
final static ResponseFunctionWebSearch.Action ofOpenPage(ResponseFunctionWebSearch.Action.OpenPage openPage)
Action type "open_page" - Opens a specific URL from search results.
-
ofFind
final static ResponseFunctionWebSearch.Action ofFind(ResponseFunctionWebSearch.Action.Find findInPage)
Action type "find_in_page": Searches for a pattern within a loaded page.
-
-
-
-