Class BetaResponseFunctionWebSearch.Action
-
- All Implemented Interfaces:
public final class BetaResponseFunctionWebSearch.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 interfaceBetaResponseFunctionWebSearch.Action.VisitorAn interface that defines how to map each variant of Action to a value of type T.
public final classBetaResponseFunctionWebSearch.Action.SearchAction type "search" - Performs a web search query.
public final classBetaResponseFunctionWebSearch.Action.OpenPageAction type "open_page" - Opens a specific URL from search results.
public final classBetaResponseFunctionWebSearch.Action.FindInPageAction type "find_in_page": Searches for a pattern within a loaded page.
-
Method Summary
Modifier and Type Method Description final Optional<BetaResponseFunctionWebSearch.Action.Search>search()Action type "search" - Performs a web search query. final Optional<BetaResponseFunctionWebSearch.Action.OpenPage>openPage()Action type "open_page" - Opens a specific URL from search results. final Optional<BetaResponseFunctionWebSearch.Action.FindInPage>findInPage()Action type "find_in_page": Searches for a pattern within a loaded page. final BooleanisSearch()final BooleanisOpenPage()final BooleanisFindInPage()final BetaResponseFunctionWebSearch.Action.SearchasSearch()Action type "search" - Performs a web search query. final BetaResponseFunctionWebSearch.Action.OpenPageasOpenPage()Action type "open_page" - Opens a specific URL from search results. final BetaResponseFunctionWebSearch.Action.FindInPageasFindInPage()Action type "find_in_page": Searches for a pattern within a loaded page. final Optional<JsonValue>_json()final <T extends Any> Taccept(BetaResponseFunctionWebSearch.Action.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaResponseFunctionWebSearch.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 BetaResponseFunctionWebSearch.ActionofSearch(BetaResponseFunctionWebSearch.Action.Search search)Action type "search" - Performs a web search query. final static BetaResponseFunctionWebSearch.ActionofOpenPage(BetaResponseFunctionWebSearch.Action.OpenPage openPage)Action type "open_page" - Opens a specific URL from search results. final static BetaResponseFunctionWebSearch.ActionofFindInPage(BetaResponseFunctionWebSearch.Action.FindInPage findInPage)Action type "find_in_page": Searches for a pattern within a loaded page. -
-
Method Detail
-
search
final Optional<BetaResponseFunctionWebSearch.Action.Search> search()
Action type "search" - Performs a web search query.
-
openPage
final Optional<BetaResponseFunctionWebSearch.Action.OpenPage> openPage()
Action type "open_page" - Opens a specific URL from search results.
-
findInPage
final Optional<BetaResponseFunctionWebSearch.Action.FindInPage> findInPage()
Action type "find_in_page": Searches for a pattern within a loaded page.
-
isOpenPage
final Boolean isOpenPage()
-
isFindInPage
final Boolean isFindInPage()
-
asSearch
final BetaResponseFunctionWebSearch.Action.Search asSearch()
Action type "search" - Performs a web search query.
-
asOpenPage
final BetaResponseFunctionWebSearch.Action.OpenPage asOpenPage()
Action type "open_page" - Opens a specific URL from search results.
-
asFindInPage
final BetaResponseFunctionWebSearch.Action.FindInPage asFindInPage()
Action type "find_in_page": Searches for a pattern within a loaded page.
-
accept
final <T extends Any> T accept(BetaResponseFunctionWebSearch.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 BetaResponseFunctionWebSearch.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 BetaResponseFunctionWebSearch.Action ofSearch(BetaResponseFunctionWebSearch.Action.Search search)
Action type "search" - Performs a web search query.
-
ofOpenPage
final static BetaResponseFunctionWebSearch.Action ofOpenPage(BetaResponseFunctionWebSearch.Action.OpenPage openPage)
Action type "open_page" - Opens a specific URL from search results.
-
ofFindInPage
final static BetaResponseFunctionWebSearch.Action ofFindInPage(BetaResponseFunctionWebSearch.Action.FindInPage findInPage)
Action type "find_in_page": Searches for a pattern within a loaded page.
-
-
-
-