Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Join the [Slack Developer Program](https://api.slack.com/developer-program) for

Add this app to your workspace using either the Slack CLI or other development tooling, then read ahead to configuring LLM responses in the **[Providers](#providers)** section.

### Using Slack CLI
<details><summary><strong>Using Slack CLI</strong></summary>

Install the latest version of the Slack CLI for your operating system:

Expand Down Expand Up @@ -46,7 +46,11 @@ slack install

After the Slack app has been created you're all set to configure the LLM provider!

### Using Terminal
</details>

<details><summary><strong>Using Terminal</strong></summary>

#### Create Your Slack App

1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose "From an app manifest"
2. Choose the workspace you want to install the application to
Expand Down Expand Up @@ -91,6 +95,8 @@ source .venv/bin/activate # for Windows OS, .\.venv\Scripts\Activate instead sh
pip install -r requirements.txt
```

</details>

## Providers

### OpenAI Setup
Expand Down
4 changes: 0 additions & 4 deletions agent/tools/dice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
import time

from openai.types.responses import FunctionToolParam

Expand All @@ -23,9 +22,6 @@ def roll_dice(sides: int = 6, count: int = 1) -> dict:
rolls = [random.randint(1, sides) for _ in range(count)]
total = sum(rolls)

# Add a pause between rolls to demonstrate loading states
time.sleep(2)
Comment on lines -26 to -27
Copy link
Member Author

Choose a reason for hiding this comment

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

⌛ note: I'd be in favor of returning this to both samples to mirror a slower tool call for demonstration.

Copy link
Member

Choose a reason for hiding this comment

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

I also prefer the slower tool call for the demo. When it moves quickly, I'm left feeling like I wasn't able to follow the state changes.


return {
"rolls": rolls,
"total": total,
Expand Down
2 changes: 1 addition & 1 deletion listeners/assistant/assistant_thread_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def assistant_thread_started(
},
{
"title": "Roll dice for a random number",
"message": "Roll two 12-sided dice and three 6-sided dice for a psuedo-random score.",
"message": "Roll two 12-sided dice and three 6-sided dice for a pseudo-random score.",
},
]
)
Expand Down
21 changes: 18 additions & 3 deletions listeners/assistant/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,22 @@ def message(
thread_ts = payload["thread_ts"]
user_id = context.user_id

# The first example shows detailed thinking steps similar to tool calls
# displayed as plan.
# The first example shows a message with thinking steps that has different
# chunks to construct and update a plan alongside text outputs.
if message["text"] == "Wonder a few deep thoughts.":
set_status(
status="thinking...",
loading_messages=[
"Teaching the hamsters to type faster…",
"Untangling the internet cables…",
"Consulting the office goldfish…",
"Polishing up the response just for you…",
"Convincing the AI to stop overthinking…",
],
)

time.sleep(4)

streamer = client.chat_stream(
channel=channel_id,
recipient_team_id=team_id,
Expand Down Expand Up @@ -89,12 +102,12 @@ def message(
id="002",
title="Performing acrobatics...",
status="in_progress",
details="- Jumping atop ropes\n- Juggling bowling pins\n- Riding a single wheel too",
),
],
)
time.sleep(4)

feedback_block = create_feedback_block()
streamer.stop(
chunks=[
PlanUpdateChunk(
Expand All @@ -104,11 +117,13 @@ def message(
id="002",
title="Performing acrobatics...",
status="complete",
details="- Jumped atop ropes\n- Juggled bowling pins\n- Rode a single wheel too",
),
MarkdownTextChunk(
text="The crowd appears to be astounded and applauds :popcorn:"
),
],
blocks=feedback_block,
)

# This second example shows a generated text response for a provided prompt
Expand Down