Skip to content

Proactive Notifications Apps#1240

Merged
beastoin merged 2 commits into
mainfrom
uxvpw_trigger_noti_plugin_1235
Nov 6, 2024
Merged

Proactive Notifications Apps#1240
beastoin merged 2 commits into
mainfrom
uxvpw_trigger_noti_plugin_1235

Conversation

@beastoin
Copy link
Copy Markdown
Collaborator

@beastoin beastoin commented Nov 3, 2024

Overview

Issue: #1235 #1132

Features

  • Developer could create new apps with the proactive notification capacity

Usages

  • Developer create a new app with capacity proactive_notification, and external_integration to trigger the transcript_processed.

    {
      "id": "mentor-01",
      ...
      "capabilities": [
        "external_integration",
        "proactive_notification",
      ],
      "external_integration": {
        "triggers_on": "transcript_processed",
        "webhook_url": "https://based-hardware-development--plugins-api.modal.run/mentor",
        ...
      },
      "proactive_notification": {
          "scopes": ["user_name", "user_facts"]
      },
      ...
    }
    
  • Webhook respond with the format:

    {
      "notification": {
          "prompt": "the prompt template, with `{{user_name}}` and `{{user_facts}}`, Omi will use this prompt to ask LLM then send a notification to user",
          "params": ["user_name", "user_facts"]
      }
    }
    
  • (Optional) you could detect the codeword before responding with the mentor instruction, either by using the LLM or just a simple regex:

  ai_names = ['Omi', 'Omie', 'Homi', 'Homie']
  codewords = [f'hey {ai_name} what do you think' for ai_name in ai_names] ai_name in ai_names]
  transcript = TranscriptSegment.segments_as_string(segments)
  text_lower = normalize(transcript)
  pattern = r'\b(?:' + '|'.join(map(re.escape, [normalize(cw) for cw in codewords])) + r')\b'
  if bool(re.search(pattern, text_lower)):
      # respond 

Technical details

Screenshot 2024-11-06 at 10 43 46

Examples

382703065-af9b26f9-ddc5-4909-974c-c83ae4dc658e

TODO

  • A dead simple app which could trigger codeword and send the notification
  • Put the LLM to it
  • user_facts scope
  • Put capacity proactive_notification
  • Refine the document

Future idea

  • memory_context scope
  • rate limits per plugin per user per 5s - 1

🚀 Deploy Steps

  • Merge https://github.com/BasedHardware/omi/pull/1240/files
  • Create plugin.
    curl -X 'POST' \
    'https://based-hardware-development--backend-thinh-v2-api.modal.run/v3/plugins' \
    -H 'accept: application/json' \
    -H 'authorization: <KEY>' \
    -H 'Content-Type: multipart/form-data' \
    -F 'plugin_data={"name":"Mentor.01","author":"@thinh","description":"Mentor.01 - An AI-powered mentor, designed to elevate your meetings and help you achieve your goals. With its insightful guidance and real-time support, you'\''ll gain the confidence and skills to excel in every interaction.","image":"/plugins/logos/mentor_01.jpg","capabilities":["external_integration","proactive_notification"],"external_integration":{"triggers_on":"transcript_processed","webhook_url":"https://based-hardware-development--plugins-api.modal.run/mentor","setup_completed_url":"https://based-hardware-development--plugins-api.modal.run/setup/mentor","setup_instructions_file_path":"https://raw.githubusercontent.com/BasedHardware/Omi/main/plugins/instructions/mentor_01/README.md"},"proactive_notification":{"scopes":["user_name","user_facts"]},"deleted":false,"private":false}' \
    -F 'file=@mentor_01.jpg;type=image/jpeg'
    
  • Deploy Pusher service
  • Deploy Plugin service

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new optional field for notifications to hold additional message content.
    • Added a ProactiveNotification class to enhance plugin capabilities with proactive notifications.
    • Implemented a mentoring plugin with endpoints for real-time interaction and setup.
    • Enhanced audio transcription handling with improved error management and task organization.
    • Added functionality for managing transcript segments with a new method for upserting segments.
  • Bug Fixes

    • Improved error handling in plugin management and chat message processing.
  • Documentation

    • Updated README with instructions for using the new mentoring feature.
  • Refactor

    • Streamlined logic in various methods for better performance and readability.

@beastoin beastoin force-pushed the uxvpw_trigger_noti_plugin_1235 branch from 5982f63 to 2c0839a Compare November 3, 2024 09:08
@beastoin beastoin changed the title An ability to trigger a notification when testing webhooks Proactive Notifications Nov 4, 2024
@beastoin beastoin changed the title Proactive Notifications Proactive Notifications Apps Nov 4, 2024
@tiagoefreitas
Copy link
Copy Markdown
Contributor

Does it work on IOS?
Can I do anything to help expedite this?
Will test soon.

@beastoin beastoin force-pushed the uxvpw_trigger_noti_plugin_1235 branch from e685b15 to f8df172 Compare November 5, 2024 02:51
@beastoin beastoin force-pushed the uxvpw_trigger_noti_plugin_1235 branch from 12ef56f to 1487b3f Compare November 6, 2024 08:02
@beastoin beastoin marked this pull request as ready for review November 6, 2024 08:51
@beastoin beastoin merged commit 8958841 into main Nov 6, 2024
@beastoin beastoin deleted the uxvpw_trigger_noti_plugin_1235 branch November 6, 2024 08:54
@beastoin beastoin mentioned this pull request Nov 7, 2024
@BasedHardware BasedHardware deleted a comment from coderabbitai Bot Nov 12, 2024
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
## Overview
Issue: BasedHardware#1235 BasedHardware#1132

## Features
- Developer could create new apps with the proactive notification
capacity

## Usages
- Developer create a new app with capacity `proactive_notification`, and
`external_integration` to trigger the `transcript_processed`.
  ```
  {
    "id": "mentor-01",
    ...
    "capabilities": [
      "external_integration",
      "proactive_notification",
    ],
    "external_integration": {
      "triggers_on": "transcript_processed",
"webhook_url":
"https://based-hardware-development--plugins-api.modal.run/mentor",
      ...
    },
    "proactive_notification": {
        "scopes": ["user_name", "user_facts"]
    },
    ...
  }
  ```

- Webhook respond with the format:
  ```
  {
    "mentor": {
"prompt": "the prompt template, with `{{user_name}}` and
`{{user_facts}}`, Omi will use this prompt to ask LLM then send a
notification to user",
        "params": ["user_name", "user_facts"]
    }
  }
  ```

- (Optional) you could detect the codeword before responding with the
`mentor` instruction, either by using the LLM or just a simple regex:
  ```
    ai_names = ['Omi', 'Omie', 'Homi', 'Homie']
codewords = [f'hey {ai_name} what do you think' for ai_name in ai_names]
ai_name in ai_names]
    transcript = TranscriptSegment.segments_as_string(segments)
    text_lower = normalize(transcript)
pattern = r'\b(?:' + '|'.join(map(re.escape, [normalize(cw) for cw in
codewords])) + r')\b'
    if bool(re.search(pattern, text_lower)):
        # respond 
  ```


## Technical details

<img width="1074" alt="Screenshot 2024-11-06 at 10 43 46"
src="https://github.com/user-attachments/assets/09a18457-6116-454b-98a8-d36dd9a7b1d2">

## Examples

![382703065-af9b26f9-ddc5-4909-974c-c83ae4dc658e](https://github.com/user-attachments/assets/131cedfe-7588-4770-aa5e-9cea9a0e2d67)


## TODO
- [x] A dead simple app which could trigger codeword and send the
notification
- [x] Put the LLM to it
- [x] `user_facts` scope
- [x] Put capacity `proactive_notification`
- [x] Refine the document

## Future idea
- `memory_context` scope
- rate limits per plugin per user per 5s - 1

## 🚀 Deploy Steps
- [ ] Merge https://github.com/BasedHardware/omi/pull/1240/files
- [ ] Create plugin.
  ```
  curl -X 'POST' \

'https://based-hardware-development--backend-thinh-v2-api.modal.run/v3/plugins'
\
  -H 'accept: application/json' \
  -H 'authorization: <KEY>' \
  -H 'Content-Type: multipart/form-data' \
-F
'plugin_data={"name":"Mentor.01","author":"@thinh","description":"Mentor.01
- An AI-powered mentor, designed to elevate your meetings and help you
achieve your goals. With its insightful guidance and real-time support,
you'\''ll gain the confidence and skills to excel in every
interaction.","image":"/plugins/logos/mentor_01.jpg","capabilities":["external_integration","proactive_notification"],"external_integration":{"triggers_on":"transcript_processed","webhook_url":"https://based-hardware-development--plugins-api.modal.run/mentor","setup_completed_url":"https://based-hardware-development--plugins-api.modal.run/setup/mentor","setup_instructions_file_path":"https://raw.githubusercontent.com/BasedHardware/Omi/main/plugins/instructions/mentor_01/README.md"},"proactive_notification":{"scopes":["user_name","user_facts"]},"deleted":false,"private":false}'
\
  -F 'file=@mentor_01.jpg;type=image/jpeg'
  ```
- [ ] Deploy Pusher service
- [ ] Deploy Plugin service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants