Skip to content

Commit

Permalink
Update function name.
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus committed Oct 3, 2024
1 parent 023e6f5 commit 6c134a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ def create_action_buttons_message(
return Message(blocks=signal_metadata_blocks).build()["blocks"]


def create_genai_signal_message_metadata_blocks(signal_metadata_blocks: list[Block], message: str) -> list[Block]:
def create_genai_signal_message_metadata_blocks(
signal_metadata_blocks: list[Block], message: str
) -> list[Block]:
signal_metadata_blocks.append(
Section(text=f":magic_wand: *GenAI Alert Analysis*\n\n{message}"),
)
Expand Down Expand Up @@ -326,7 +328,7 @@ def create_genai_signal_analysis_message(
if not first_instance_id or not first_instance_signal:
message = "Unable to generate GenAI signal analysis. No signal instances found."
log.warning(message)
return create_signal_metadata_blocks(signal_metadata_blocks, message)
return create_genai_signal_message_metadata_blocks(signal_metadata_blocks, message)

# Fetch related cases
related_cases = []
Expand Down Expand Up @@ -383,12 +385,12 @@ def create_genai_signal_analysis_message(
"Unable to generate GenAI signal analysis. No artificial-intelligence plugin enabled."
)
log.warning(message)
return create_signal_metadata_blocks(signal_metadata_blocks, message)
return create_genai_signal_message_metadata_blocks(signal_metadata_blocks, message)

if not signal_instance.signal.genai_prompt:
message = f"Unable to generate GenAI signal analysis. No GenAI prompt defined for {signal_instance.signal.name}"
log.warning(message)
return create_signal_metadata_blocks(signal_metadata_blocks, message)
return create_genai_signal_message_metadata_blocks(signal_metadata_blocks, message)

response = genai_plugin.instance.chat_completion(
prompt=f"""
Expand Down Expand Up @@ -416,7 +418,7 @@ def create_genai_signal_analysis_message(
message = "Unable to generate GenAI signal analysis. We received an empty response from the artificial-intelligence plugin."
log.warning(message)

return create_signal_metadata_blocks(signal_metadata_blocks, message)
return create_genai_signal_message_metadata_blocks(signal_metadata_blocks, message)


def create_signal_engagement_message(
Expand Down

0 comments on commit 6c134a9

Please sign in to comment.