Toolkit.Serper

A prebuilt tool for interacting with the serper.dev google search API.

# USAGE:
# Tool list to initialize the client
tools = [serper.tool]
# Tool handler map is passed to Tools.handle_tool_calls!
tool_handler_map = Dict.from_list([(serper.name, serper.handler)])
client = Client.new { apiKey, model: "tool-capable/model", tools }
#...
messages = Chat.add_user_message(client, newMessage, {})
response = Http.send!(Chat.build_http_request(client, {}))?
with_tool_results = 
     Chat.update_messages(response, messages)?
    |> Tools.handle_tool_calls!(client toolHandlerMap, { max_model_calls: 5 })

serper : { name : Str, handler! : Str => Result Str , tool : Tool }

Expose name, handler and tool for serper.

This tool allows the model to search google using the serper.dev API.