From 0ca093fa6e0c42a903a8d23ff99b1e7609908ee7 Mon Sep 17 00:00:00 2001 From: Himanshi Agrawal Date: Tue, 12 Nov 2024 18:17:06 +0530 Subject: [PATCH 1/4] fix for inconsistent respose for count of call transcript --- ClientAdvisor/AzureFunction/function_app.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ClientAdvisor/AzureFunction/function_app.py b/ClientAdvisor/AzureFunction/function_app.py index e61e0a13..78de48b6 100644 --- a/ClientAdvisor/AzureFunction/function_app.py +++ b/ClientAdvisor/AzureFunction/function_app.py @@ -18,6 +18,8 @@ from semantic_kernel.functions.kernel_function_decorator import kernel_function from semantic_kernel.kernel import Kernel import pymssql +from dotenv import load_dotenv +load_dotenv() # Azure Function App app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) @@ -172,7 +174,7 @@ def get_answers_from_calltranscripts( 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. 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. - First name and Full name of the client mentioned in prompt should give same response for both. + if asked related to count of call transcripts,**Always** respond the total number of sourceurid involved for the {ClientId} consistently, Do never change if question is reframed or contains "so far" or if the case is altered or having first name or full name of the client present with so far. You can use this information to answer questions about the clients ''' @@ -189,7 +191,7 @@ def get_answers_from_calltranscripts( } ], seed = 42, - temperature = 0, + temperature = 0.7, max_tokens = 800, extra_body = { "data_sources": [ @@ -281,13 +283,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 normalized client name in the question does not match the normalized selected client name or client name and client id do not match**, always return: "Please ask questions only about the selected client." Do not provide 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. Client name **must be** same as retrieved from database. Always return time in "HH:mm" format for the client in response. - If asked, response should **always be** consistent everytime. ''' system_message += html_content @@ -295,7 +295,7 @@ async def stream_openai_text(req: Request) -> StreamingResponse: user_query_prompt = f'''{user_query}. Always send clientId as {user_query.split(':::')[-1]} ''' query_prompt = f'''{system_message}{user_query_prompt}''' - + sk_response = kernel.invoke_prompt_stream( function_name="prompt_test", plugin_name="weather_test", From e85658dd9873f89730878a787af9c0f87ecf0823 Mon Sep 17 00:00:00 2001 From: Himanshi Agrawal Date: Tue, 12 Nov 2024 18:45:22 +0530 Subject: [PATCH 2/4] removed load statement for local debug --- ClientAdvisor/AzureFunction/function_app.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/ClientAdvisor/AzureFunction/function_app.py b/ClientAdvisor/AzureFunction/function_app.py index 78de48b6..97bb8fdf 100644 --- a/ClientAdvisor/AzureFunction/function_app.py +++ b/ClientAdvisor/AzureFunction/function_app.py @@ -18,8 +18,6 @@ from semantic_kernel.functions.kernel_function_decorator import kernel_function from semantic_kernel.kernel import Kernel import pymssql -from dotenv import load_dotenv -load_dotenv() # Azure Function App app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS) From 2f1d4d4b6575621ff6cd662711b9547c3109c1d5 Mon Sep 17 00:00:00 2001 From: Himanshi Agrawal Date: Wed, 13 Nov 2024 15:04:05 +0530 Subject: [PATCH 3/4] reverted the temprature field and after making temprature 0 it was giving inconsistent response if reframed with case altered or so far for that i fixed and now i am Committing again --- ClientAdvisor/AzureFunction/function_app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClientAdvisor/AzureFunction/function_app.py b/ClientAdvisor/AzureFunction/function_app.py index 97bb8fdf..2acc5d92 100644 --- a/ClientAdvisor/AzureFunction/function_app.py +++ b/ClientAdvisor/AzureFunction/function_app.py @@ -172,7 +172,7 @@ def get_answers_from_calltranscripts( 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. 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. - if asked related to count of call transcripts,**Always** respond the total number of sourceurid involved for the {ClientId} consistently, Do never change if question is reframed or contains "so far" or if the case is altered or having first name or full name of the client present with so far. + if asked related to count of call transcripts,**Always** respond the total number of sourceurid involved for the {ClientId} consistently, Do never change if question is reframed or contains "so far" or if the case is altered or having first name or full name of the client present with so far or case altered with first name of the client or case altered with first name of client and so far. You can use this information to answer questions about the clients ''' @@ -189,7 +189,7 @@ def get_answers_from_calltranscripts( } ], seed = 42, - temperature = 0.7, + temperature = 0, max_tokens = 800, extra_body = { "data_sources": [ From 94fa02cfbcaf1fd675eefc7622977f580c2101c0 Mon Sep 17 00:00:00 2001 From: Himanshi Agrawal Date: Wed, 13 Nov 2024 15:45:37 +0530 Subject: [PATCH 4/4] removed extra space --- ClientAdvisor/AzureFunction/function_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClientAdvisor/AzureFunction/function_app.py b/ClientAdvisor/AzureFunction/function_app.py index 2acc5d92..e75f6bfb 100644 --- a/ClientAdvisor/AzureFunction/function_app.py +++ b/ClientAdvisor/AzureFunction/function_app.py @@ -172,7 +172,7 @@ def get_answers_from_calltranscripts( 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. 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. - if asked related to count of call transcripts,**Always** respond the total number of sourceurid involved for the {ClientId} consistently, Do never change if question is reframed or contains "so far" or if the case is altered or having first name or full name of the client present with so far or case altered with first name of the client or case altered with first name of client and so far. + if asked related to count of call transcripts,**Always** respond the total number of sourceurid involved for the {ClientId} consistently, Do never change if question is reframed or contains "so far" or if the case is altered or having first name or full name of the client present with so far or case altered with first name of the client or case altered with first name of client and so far. You can use this information to answer questions about the clients '''