Skip to content

Latest commit

 

History

History

webpage-summarization

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Copyright IBM Corp. 2020, 2024

Summarization Example | IBM watsonx.ai Flows Engine

This is an example summarization tool built using watsonx.ai Flows Engine. You can recreate the content in this directory by following along this tutorial. The example tool takes a webpage, scrapes its content and uses a LLM to summarize it.

Deploy the flows

To deploy the summarization flow, make sure to install and authenticate the wxflows CLI. Then add your credentials to watsonx.ai in the .env file or use the shared "getting started" instance:

# Shared "getting started"
STEPZEN_WATSONX_HOST=shared

# Your own watsonx.ai credentials (optionally)
# STEPZEN_WATSONX_AI_APIKEY=
# STEPZEN_WATSONX_HOST=
# STEPZEN_WATSONX_PROJECTID=

The use of STEPZEN_WATSONX_AI_TOKEN is deprecated since wxflows 1.0.0rc189 and up. Please update your CLI when you're on an older version.

Then you can run the command wxflows deploy to deploy your flows to a live endpoint.

Run the example

To use the summarization tool, move into the app directory and add your flows endpoint and api key in index.js:

// ...

(async () => {
    const WXFLOWS_ENDPOINT = 'YOUR_ENDPOINT_HERE'
    const WXFLOWS_APIKEY = 'YOUR_APIKEY_HERE'

    // ... everything else

})();

You can retrieve your api key from the dashboard or by running the CLI command wxflows whoami --apikey.

Change the below details in index.js to use a different URL and locator to scrape content from:

const content = await getWebsiteContents(
    "https://developer.ibm.com/tutorials/awb-build-rag-application-watsonx-ai-flows-engine/",
    '.content-data'
)

To run the summarization tool use node index.js, the result should be printed in your terminal.

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!