Skip to content

Commit

Permalink
Add the context example model to Mentor01 app
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin committed Nov 18, 2024
1 parent 0dc8133 commit 561edc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions plugins/example/basic/mentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

from fastapi import APIRouter

from models import TranscriptSegment, MentorEndpointResponse, RealtimePluginRequest
from models import TranscriptSegment, ProactiveNotificationEndpointResponse, RealtimePluginRequest
from db import get_upsert_segment_to_transcript_plugin

router = APIRouter()

scan_segment_session = {}

# *******************************************************
# ************ Basic Mentor Plugin ************
# ************ Basic Proactive Notification Plugin ************
# *******************************************************

@router.post('/mentor', tags=['mentor', 'basic', 'realtime'], response_model=MentorEndpointResponse)
@router.post('/mentor', tags=['mentor', 'basic', 'realtime', 'proactive_notification'], response_model=ProactiveNotificationEndpointResponse)
def mentoring(data: RealtimePluginRequest):
def normalize(text):
return re.sub(r' +', ' ',re.sub(r'[,?.!]', ' ', text)).lower().strip()
Expand Down
16 changes: 13 additions & 3 deletions plugins/example/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,20 @@ class RealtimePluginRequest(BaseModel):
segments: List[TranscriptSegment]


class MentorResponse(BaseModel):
class ProactiveNotificationContextFitlersResponse(BaseModel):
people: List[str] = Field(description="A list of people. ", default=[])
entities: List[str] = Field(description="A list of entity. ", default=[])
topics: List[str] = Field(description="A list of topic. ", default=[])

class ProactiveNotificationContextResponse(BaseModel):
question: str = Field(description="A question to query the embeded vector database.", default='')
filters: ProactiveNotificationContextFitlersResponse = Field(description="Filter options to query the embeded vector database. ", default=None)

class ProactiveNotificationResponse(BaseModel):
prompt: str = Field(description="A prompt or a template with the parameters such as {{user_name}} {{user_facts}}.", default='')
params: List[str] = Field(description="A list of string that match with proactive notification scopes. ", default=[])
context: ProactiveNotificationContextResponse = Field(description="An object to guide the system in retrieving the users context", default=None)

class MentorEndpointResponse(BaseModel):
class ProactiveNotificationEndpointResponse(BaseModel):
message: str = Field(description="A short message to be sent as notification to the user, if needed.", default='')
notification: MentorResponse = Field(description="An object to guide the system in generating the proactive notification", default=None)
notification: ProactiveNotificationResponse = Field(description="An object to guide the system in generating the proactive notification", default=None)

0 comments on commit 561edc8

Please sign in to comment.