Request shaping for Provider-hosted OpenAI tools.
These are not Pixir local Tools. Pixir does not execute them, does not record them
as tool_call / tool_result, and does not ask Pixir.Tools.Executor to run them.
They are Provider-side capabilities declared in the Responses request body. Pixir's
job is to shape the request deliberately and later persist bounded Provider evidence.
Summary
Functions
Extract Provider-hosted tool specs from a Provider request.
Responses include fields needed by the declared hosted tools.
Build an OpenAI hosted web_search tool spec.
True when the hosted tool list contains OpenAI web search.
Types
Functions
@spec from_request(map()) :: {:ok, [map()]} | {:error, error_reason()}
Extract Provider-hosted tool specs from a Provider request.
Supported request fields:
:web_search/"web_search"- Pixir-owned config for the hosted web search tool;:hosted_tools/"hosted_tools"- raw hosted tool specs for tests or future Provider-hosted tools.
@spec include_fields(map(), [map()]) :: {:ok, [String.t()]} | {:error, error_reason()}
Responses include fields needed by the declared hosted tools.
Web search source evidence is included by default whenever web search is enabled.
Callers may set web_search.include_sources: false to suppress it for a targeted
probe.
@spec web_search(map() | keyword() | boolean() | nil) :: {:ok, map() | nil} | {:error, error_reason()}
Build an OpenAI hosted web_search tool spec.
Pixir defaults search_context_size to "low" for beta ergonomics and cost
discipline. Supported OpenAI search policy fields are preserved; unsupported fields
return structured :invalid_args instead of silently changing policy.
include_sources is intentionally not part of the tool object; it drives the
Responses include list via include_fields/2.
@spec web_search_requested?([map()]) :: {:ok, boolean()} | {:error, error_reason()}
True when the hosted tool list contains OpenAI web search.