Here's a step-by-step tutorial for setting up and deploying a project with wxflows, including installing necessary tools, deploying the app, and running it locally.
This example consists of the following pieces:
- watsonx.ai SDK (models)
- wxflows SDK (tools)
This guide will walk you through installing the wxflows CLI, initializing and deploying a project, and running the application locally. We’ll use google_books and wikipedia tools as examples for tool calling with wxflows.
Begin by installing the wxflows CLI tool. You can find installation instructions on the wxflows installation page:
-
Download the CLI from https://wxflows.ibm.stepzen.com/docs/installation
-
Create a new directory on your machine
-
Run the following command in this directory:
pip install wxflows_cli-1.0.0rc200-py3-none-any.whl --force-reinstall
Make sure to use the name of the
.whlfile you downloaded.This will install the latest version of the CLI from the downloaded
.whlfile. -
After installing, make sure to login to the CLI.
There's already a wxflows.toml file in this repository that defines the following values:
- Defines an endpoint
api/examples-watsonxaifor the project. - Imports
google_bookstool with a description for searching books and specifying fieldsbooks|book. - Imports
wikipediatool with a description for Wikipedia searches and specifying fieldssearch|page.
You can deploy this tool configuration to a Flows Engine endpoint by running:
wxflows deployThis command deploys the endpoint and tools defined, these will be used by the wxflows SDK in your application.
From the project’s root directory copy the sample environment file to create your .env file:
cp .env.sample .envEdit the .env file and add your credentials, such as API keys and other required environment variables. Ensure the credentials are correct to allow the tools to authenticate and interact with external services.
To run the application you need to install the necessary dependencies:
npm iThis command installs all required packages, including the @wxflows/sdk package and any dependencies specified in the project.
Copy the sample environment file to create your .env file:
cp .env.sample .envEdit the .env file and add your credentials, such as API keys and other required environment variables. Ensure the credentials are correct to allow the tools to authenticate and interact with external services.
Finally, start the application by running:
npm startThis command initiates your application, allowing you to call and test the google_books and wikipedia tools through wxflows.
You’ve now successfully set up, deployed, and run a wxflows project with google_books and wikipedia tools. This setup provides a flexible environment to leverage external tools for data retrieval, allowing you to further build and expand your app with wxflows. See the instructions in tools to add more tools or create your own tools from Databases, NoSQL, REST or GraphQL APIs.
Please reach out to us on Discord if you have any questions or want to share feedback. We'd love to hear from you!