Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stores GenAI case analysis in JSON format in the database while preserving format on the Slack side #5300

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

mvilanova
Copy link
Contributor

This pull request introduces several changes to enhance the Case model and improve the handling of GenAI signal analysis messages in the Slack plugin. The most significant updates include adding a new JSONB column to the Case model, updating the Alembic migration script, and modifying the Slack plugin to handle JSON responses for GenAI analysis.

Enhancements to Case Model:

  • Added a new genai_analysis column of type JSONB to the Case model, with default values and non-null constraints (src/dispatch/case/models.py).
  • Updated the CaseRead schema to include the genai_analysis field (src/dispatch/case/models.py).

Alembic Migration:

  • Added a new Alembic migration script to create the genai_analysis column in the case table (src/dispatch/database/revisions/tenant/versions/2024-10-08_b057c079c2d5.py).

Slack Plugin Enhancements:

  • Introduced a utility function json_to_slack_format to convert JSON dictionaries to Slack markup format (src/dispatch/plugins/dispatch_slack/case/messages.py) [1] [2].
  • Updated the create_genai_signal_analysis_message function to return a tuple containing the GenAI analysis message and Slack message blocks (src/dispatch/plugins/dispatch_slack/case/messages.py) [1] [2] [3] [4] [5].
  • Modified the create_threaded method to store the GenAI analysis message in the genai_analysis field of the Case model (src/dispatch/plugins/dispatch_slack/plugin.py).

These changes collectively improve the data structure and processing of GenAI analysis within the case management and Slack communication workflows.
Screenshot 2024-10-08 at 12 31 43 PM

@mvilanova mvilanova added the enhancement New feature or request label Oct 8, 2024
Copy link
Contributor

@kevgliss kevgliss left a comment

Choose a reason for hiding this comment

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

This looks good. I think the next step could be to generate embeddings for all closed cases and use that as future context.

https://www.timescale.com/blog/postgresql-as-a-vector-database-create-store-and-query-openai-embeddings-with-pgvector/

@mvilanova mvilanova merged commit 6796713 into master Oct 8, 2024
8 checks passed
@mvilanova mvilanova deleted the enhancement/genai-store-case-analysis branch October 8, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants