Skip to content

Latest commit

 

History

History
107 lines (75 loc) · 5.94 KB

README.md

File metadata and controls

107 lines (75 loc) · 5.94 KB

Tools

This is an overview of tools that can be used in watsonx.ai Flows Using using the wxflows CLI. More tools will be added over time, you can also create a tool for your own data source (Databases; REST, SOAP & GraphQL APIs).

Available pre-built tools

Tool Description File Auth
exchange Convert currencies from one currency to another, both current and historic rates https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/exchange.zip No API Key required
wikipedia Find information on just about anything on Wikipedia https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/wikipedia.zip No API Key required
google_books Retrieve information from millions of books https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/google_books.zip No API Key required
youtube_transcript Retrieve transcripts for videos on YouTube https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/youtube_transcript.zip No API Key required
math Performs mathematical calculations, date and unit conversions, formula solving, etc https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/math.zip No API Key required
weather Get the current weather for a location https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/weather.zip API Key needed, see here for instructions

The tools in this directory can be added to your wxflows project using the .ZIP files in this directory. For example, to use the "Wikipedia" tool in your project run the following command:

  • Python CLI

    wxflows init --endpoint-name api/my-project \
      --import-name wikipedia \
      --import-package https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/wikipedia.zip \
      --import-tool-name wikipedia \
      --import-tool-description "Retrieve information from Wikipedia." \
      --import-tool-fields "search|page"
  • Node.js CLI (experimental)

    wxflows import tool https://raw.githubusercontent.com/IBM/wxflows/refs/heads/main/tools/wikipedia.zip

See create your own tool for converting any data source into a tool.

Editing a tool

You can edit the tool description after importing:

Python CLI

You can edit the tool definition that was generated in the wxflows.toml file, or register a new tool by creating the tool definition for a new tool in the wxflows.toml file manually:

# wxflows.toml
# ...

[[wxflows.deployment.endpoint.imports]]
name = "my_tool"
directory = "path/to/graphql"

[[wxflows.deployment.endpoint.imports.tools]]
name = "my_tool"
description = """The description for my custom tool"""
fields = "fieldA|fieldB"

After editing the wxflows.toml file, run wxflows deploy to make your tools available. See here for more instruction on registering tools using the Python CLI.

Node.js CLI (experimental)

When you generate a GraphQL schema for your data source, a placeholder tool definition will be added to the tools.graphql file in your project. Open the file and uncomment the generated tool definition, or create your own tool definition from scratch. For example:

extend type Query {
  my_tool: TC_GraphQL
    @supplies(query: "tc_tools")
    @materializer(
      query: "tc_graphql_tool"
      arguments: [
        { name: "name", const: "my_tool" }
        { name: "description", const: "The description for my custom tool" }
        { name: "fields", const: "fieldA|fieldB" }
      ]
    )
}

After editing the tools.graphql file, run wxflows deploy to make your tools available. See here for more instruction on registering tools using the Node.js CLI.

Create your own tool

Next to using prebuilt tools you can also build your own tool from an existing data source:

Share your tool

If you want to share your tool with others, you need to create a .ZIP file out of your .graphql files. On Macs can do this by running the command:

zip -r mydir.zip mydir

You can share the created .zip file with others or contribute to this repository.

Support

Please reach out to us on Discord if you have any questions or want to share feedback. We'd love to hear from you!