WardrikBrave.WebSearch (wardrik_brave v0.1.0-rc.1)

Copy Markdown

The web_search tool.

Results become part of the turn that asked for them, so they're kept small: 10 results and about 4,096 tokens unless the agent asks for more.

Summary

Functions

Returns the API parameters for the tool's arguments and date window.

Runs one search.

Returns the tool. brave is a started name or inline settings. See WardrikBrave.settings/1.

Functions

body(args, window)

@spec body(map(), String.t() | nil) :: map()

Returns the API parameters for the tool's arguments and date window.

run(brave, args, context)

@spec run(atom() | map(), map(), WardrikCore.Context.t()) ::
  {:ok, map()} | {:error, String.t()}

Runs one search.

Uses the agent's BRAVE_API_KEY if its keys hold one, and the settings in brave otherwise. Returns {:error, message} if both :freshness and :published_between are given, or if :published_between isn't "YYYY-MM-DDtoYYYY-MM-DD".

tool(brave)

@spec tool(atom() | map()) :: WardrikCore.Tool.t()

Returns the tool. brave is a started name or inline settings. See WardrikBrave.settings/1.