Skip to content

Comments

docs: update ai hugging face tutorial examples#2613

Merged
zimeg merged 4 commits intomainfrom
zimeg-docs-ai-huggingface
Jul 25, 2025
Merged

docs: update ai hugging face tutorial examples#2613
zimeg merged 4 commits intomainfrom
zimeg-docs-ai-huggingface

Conversation

@zimeg
Copy link
Member

@zimeg zimeg commented Jul 25, 2025

Summary

This PR updates AI tutorials to match changes from slack-samples/bolt-js-assistant-template#33 🤖

Preview

Pages with updates can be found at these links:

Requirements

@zimeg zimeg requested a review from haleychaas July 25, 2025 01:52
@zimeg zimeg self-assigned this Jul 25, 2025
@zimeg zimeg added the docs M-T: Documentation work only label Jul 25, 2025
@codecov
Copy link

codecov bot commented Jul 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.37%. Comparing base (c3c1990) to head (d1a65b8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2613   +/-   ##
=======================================
  Coverage   93.37%   93.37%           
=======================================
  Files          37       37           
  Lines        7581     7581           
  Branches      667      667           
=======================================
  Hits         7079     7079           
  Misses        497      497           
  Partials        5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member Author

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Leaving a few notes below for the kind reviewers!


1. On the **Install App** page, copy your **Bot User OAuth Token**. You will store this in your environment as `SLACK_BOT_TOKEN` (we'll get to that next).
2. Navigate to **Basic Information** and in the **App-Level Tokens** section, click **Generate Token and Scopes**. Add the [`connections:write`](https://docs.slack.dev/reference/scopes/connections.write) scope, name the token, and click **Generate**. (More on tokens [here](/authentication/tokens)). Copy this token. You will store this in your environment as `SLACK_APP_TOKEN`.
3. A fine grained [access token](https://huggingface.co/settings/tokens) from Hugging Face with the "Make calls to Inference Providers" permission is also needed. Keep this for `HUGGINGFACE_API_KEY`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Not super sure if this line makes sense here, so open to updates!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense! I just reworked it a bit to be clear which token you're getting with each step

Comment on lines +67 to +71
```bash title=".env"
SLACK_APP_TOKEN=xapp-1-example-token
SLACK_BOT_TOKEN=xoxb-example-token
HUGGINGFACE_API_KEY=hf_exampletoken
```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗣️ QQ: Is this useful to keep, or perhaps much?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea keep it!


// HuggingFace configuration
const hfClient = new HfInference(process.env.HUGGINGFACE_API_KEY);
const hfClient = new InferenceClient(process.env.HUGGINGFACE_API_KEY);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📣 This is the main change from slack-samples/bolt-js-assistant-template#33.

Comment on lines +110 to +111
* Within **OAuth & Permissions**, you will find several bot scopes have been added.
* Within **Event Subscriptions**, you will find several events this app subscribes to, which allow it to respond to user requests appropriately.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diff is not so clear on this, but "bot tokens" was change to "bot scopes" and a space was removed later 👾

Comment on lines -133 to -140
git clone https://github.com/slack-samples/bolt-js-starter-template.git
```

Then navigate to its directory:

```bash
# Change into this project directory
cd bolt-js-starter-template
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🪓 Updating to clone in the current code-assistant directory!

For this project, we will need to install [Hugging Face Inference](https://www.npmjs.com/package/@huggingface/inference) to interact with pre-trained models. Run this command in your terminal window to install the dependencies we need:

```bash
npm install axios @huggingface/inference isomorphic-fetch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


```js
require("isomorphic-fetch");
````js title="app.js"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧮 Four tabs are set here for the ``` of L199!

@zimeg
Copy link
Member Author

zimeg commented Jul 25, 2025

@haleychaas Kind thanks for the reviews and great suggestion as always! I am a fan of more obvious steps 📚 ✨

Edit: Oops I mistook a review for approval - holding off on this merge for now😉

@zimeg zimeg requested a review from haleychaas July 25, 2025 20:02
Copy link
Contributor

@haleychaas haleychaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫶

@zimeg
Copy link
Member Author

zimeg commented Jul 25, 2025

@haleychaas Haha another kind thanks - let us now merge this! 🙏

@zimeg zimeg merged commit bd75056 into main Jul 25, 2025
21 checks passed
@zimeg zimeg deleted the zimeg-docs-ai-huggingface branch July 25, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs M-T: Documentation work only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants