Skip to content

Commit

Permalink
Merge pull request #5 from microsoft/psl-byo-bug7977
Browse files Browse the repository at this point in the history
Summarization of each call transcripts
  • Loading branch information
Roopan-Microsoft authored Oct 13, 2024
2 parents e250fa3 + 05d1f9b commit 4b46af4
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions ClientAdvisor/AzureFunction/function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def get_SQL_Response(
If a question involves date and time, always use FORMAT(YourDateTimeColumn, 'yyyy-MM-dd HH:mm:ss') in the query.
If asked, provide information about client meetings according to the requested timeframe: give details about upcoming meetings if asked for "next" or "upcoming" meetings, and provide details about past meetings if asked for "previous" or "last" meetings including the scheduled time and don't filter with "LIMIT 1" in the query.
If asked about the number of past meetings with this client, provide the count of records where the ConversationId is neither null nor an empty string and the EndTime is before the current date in the query.
If asked, provide a summary of the most recent meeting with the client from past dates in the query.
If asked, provide information on the client's investment risk tolerance level in the query.
If asked, provide information on the client's portfolio performance in the query.
If asked, provide information about the client's top-performing investments in the query.
Expand Down Expand Up @@ -167,13 +166,12 @@ def get_answers_from_calltranscripts(
)

query = question
system_message = '''You are an assistant who provides wealth advisors with helpful information to prepare for client meetings.
You have access to the client’s meeting call transcripts.
You can use this information to answer questions about the clients
system_message = '''You are an assistant who provides wealth advisors with helpful information to prepare for client meetings and provide details on the call transcripts.
You have access to the client’s meetings and call transcripts
When asked about action items from previous meetings with the client, **ALWAYS provide information only for the most recent dates**.
If asked, consistently provide the summary of the last meeting with the client only for past dates.
If asked to summarize each transcript, consistently provide a summary with Date and time for all available transcripts and ensure all call transcript's summary should returned with date and time. (i.e "First Call summary Date Time", "Second Call Summary Date Time" and so on.)
Always return time in "HH:mm" format for the client in response.'''
Always return time in "HH:mm" format for the client in response.
If requested for call transcript(s), the response for each transcript should be summarized separately and Ensure all transcripts for the specified client are retrieved and format **must** follow as First Call Summary,Second Call Summary etc.
Your answer must **not** include any client identifiers or ids or numbers or ClientId in the final response.'''

completion = client.chat.completions.create(
model = deployment,
Expand All @@ -197,7 +195,6 @@ def get_answers_from_calltranscripts(
"parameters": {
"endpoint": search_endpoint,
"index_name": index_name,
"semantic_configuration": "default",
"query_type": "vector_simple_hybrid", #"vector_semantic_hybrid"
"fields_mapping": {
"content_fields_separator": "\n",
Expand Down Expand Up @@ -280,14 +277,11 @@ async def stream_openai_text(req: Request) -> StreamingResponse:

system_message = '''you are a helpful assistant to a wealth advisor.
Do not answer any questions not related to wealth advisors queries.
**If the client name in the question does not match the selected client's name**, always return: "Please ask questions only about the selected client." Do not provide any other information.
Only use the client name returned from database in the response.
If the client name and client id do not match, only return - Please only ask questions about the selected client or select another client to inquire about their details. do not return any other information.
Always consider to give selected client full name only in response and do not use other example names also consider my client means currently selected client.
If you cannot answer the question, always return - I cannot answer this question from the data available. Please rephrase or add more details.
** Remove any client identifiers or ids or numbers or ClientId in the final response.
For any questions requiring a table, always render the table using the following HTML format:
Do not include client names other than available in the source data.
Do not include or specify any client IDs in the responses.
Client name **must be** same as retrieved from database.
'''
system_message += html_content

Expand Down

0 comments on commit 4b46af4

Please sign in to comment.