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
30 changes: 16 additions & 14 deletions agent/llm_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,22 @@ def call_llm(
streamer.append(markdown_text=f"{event.delta}")

# Function calls are saved for later computation and a new task is shown
if event.type == "response.output_item.done":
if event.item.type == "function_call":
tool_calls.append(event.item)
if event.item.name == "roll_dice":
args = json.loads(event.item.arguments)
streamer.append(
chunks=[
TaskUpdateChunk(
id=f"{event.item.call_id}",
title=f"Rolling a {args['count']}d{args['sides']}...",
status="in_progress",
),
],
)
if (
event.type == "response.output_item.done"
and event.item.type == "function_call"
):
tool_calls.append(event.item)
if event.item.name == "roll_dice":
args = json.loads(event.item.arguments)
streamer.append(
chunks=[
TaskUpdateChunk(
id=f"{event.item.call_id}",
title=f"Rolling a {args['count']}d{args['sides']}...",
status="in_progress",
),
],
)

# Tool calls are performed and tasks are marked as completed in Slack
if tool_calls:
Expand Down
2 changes: 1 addition & 1 deletion listeners/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ def handle_feedback(ack: Ack, body: dict, client: WebClient, logger: Logger):
)

logger.debug(f"Handled feedback: type={feedback_type}, message_ts={message_ts}")
except Exception as error:
except Exception as error: # noqa: BLE001
logger.error(f":warning: Something went wrong! {error}")
2 changes: 1 addition & 1 deletion listeners/assistant/assistant_thread_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def assistant_thread_started(
]
)
except Exception as e:
logger.exception(f"Failed to handle an assistant_thread_started event: {e}", e)
logger.exception("Failed to handle an assistant_thread_started event")
say(f":warning: Something went wrong! ({e})")
2 changes: 1 addition & 1 deletion listeners/assistant/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ def message(
)

except Exception as e:
logger.exception(f"Failed to handle a user message event: {e}")
logger.exception("Failed to handle a user message event")
say(f":warning: Something went wrong! ({e})")
2 changes: 1 addition & 1 deletion listeners/events/app_mentioned.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ def app_mentioned_callback(client: WebClient, event: dict, logger: Logger, say:
blocks=feedback_block,
)
except Exception as e:
logger.exception(f"Failed to handle a user message event: {e}")
logger.exception("Failed to handle a user message event")
say(f":warning: Something went wrong! ({e})")
6 changes: 2 additions & 4 deletions listeners/views/feedback_block.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

from slack_sdk.models.blocks import (
Block,
ContextActionsBlock,
Expand All @@ -8,14 +6,14 @@
)


def create_feedback_block() -> List[Block]:
def create_feedback_block() -> list[Block]:
"""
Create feedback block with thumbs up/down buttons

Returns:
Block Kit context_actions block
"""
blocks: List[Block] = [
blocks: list[Block] = [
ContextActionsBlock(
elements=[
FeedbackButtonsElement(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
[project.optional-dependencies]
dev = [
"pytest==9.1.1",
"ruff==0.15.22",
"ruff==0.16.1",
]

[tool.setuptools.packages.find]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ slack-cli-hooks<1.0.0
openai==2.51.0

pytest==9.1.1
ruff==0.15.22
ruff==0.16.1
python-dotenv==1.2.2
slack-cli-hooks<1.0.0