Toolkit.Wikipedia

A collection of prebuilt tools for interacting with Wikipedia.

# USAGE:
# Tool list to initialize the client
tools = [wikipedia_search.tool, wikipedia_parse.tool]
# Tool handler map is passed to Tools.handle_tool_calls!
tool_handler_map = Dict.from_list([
    (wikipedia_search.name, wikipedia_search.handler),
    (wikipedia_parse.name, wikipedia_parse.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 })

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

Expose name, handler and tool for the wikipediaSarch.

This tool allows the model to search Wikipedia for a given query.

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

Expose name, handler and tool for the wikipediaParse tool.

This tool allows the model to parse a Wikipedia article.