Skip to content

Commit dfb4e9b

Browse files
author
Milder Hernandez Cagua
committed
Add suggestions variable to AnswerConversation skill
1 parent e81cbc6 commit dfb4e9b

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public RAGResponse run(ChatGPTConversation questionOrConversation, RAGOptions op
8585
SKContext skcontext = SKBuilders.context().build()
8686
.setVariable("sources", sources)
8787
.setVariable("conversation", conversation)
88+
.setVariable("suggestions", String.valueOf(options.isSuggestFollowupQuestions()))
8889
.setVariable("input", question);
8990

9091
Mono<SKContext> reply = answerConversation.invokeAsync(skcontext);

app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerConversation/config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
{
2323
"name": "conversation",
2424
"description": "Chat history"
25+
},
26+
{
27+
"name": "suggestions",
28+
"description": "Whether to suggest follow-up questions"
2529
}
2630
]
2731
}

app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerConversation/skprompt.txt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ For tabular information return it as an html table. Do not return markdown forma
55
Each source has a name followed by colon and the actual information, always include the source name for each fact you use in the response.
66
If you cannot answer using the sources below, say you don't know.
77

8+
If SuggestFollowUpQuestions is true then after answering question, also generate three very brief follow-up questions that the user would likely ask next.
9+
Use double angle brackets to reference the questions, e.g. <<Are there exclusions for prescriptions?>>.
10+
Try not to repeat questions that have already been asked.
11+
Only generate questions and do not generate any text before or after the questions, such as 'Next Questions'.
12+
13+
If SuggestFollowUpQuestions is false, do not generate extra questions.
14+
815
[EXAMPLES]
916
[EXAMPLE 1]
1017
[INFORMATION]
@@ -14,7 +21,12 @@ info3.pdf: Overlake is the name of the area that includes a park and ride near B
1421
info4.pdf: In-network institutions include Overlake, Swedish and others in the region
1522
[END INFORMATION]
1623
Question: What is the deductible for the employee plan for a visit to Overlake in Bellevue?
17-
Answer: In-network deductibles are $500 for employee and $1000 for family [info1.txt] and Overlake is in-network for the employee plan [info2.pdf][info4.pdf].
24+
SuggestFollowUpQuestions: true
25+
Answer:
26+
In-network deductibles are $500 for employee and $1000 for family [info1.txt] and Overlake is in-network for the employee plan [info2.pdf][info4.pdf].
27+
<<What other locations are in-network for the employee plan?>>
28+
<<Are there any limitations on the number of visits to a provider?>>
29+
<<Are there any exclusions for prescriptions?>>
1830
[END EXAMPLE 1]
1931

2032

@@ -26,7 +38,9 @@ info3.pdf: Overlake is the name of the area that includes a park and ride near B
2638
info4.pdf: In-network institutions include Overlake, Swedish and others in the region
2739
[END INFORMATION]
2840
Question: what are the responsibilities of the product manager?
29-
Answer: I do not have enough information to answer that.
41+
SuggestFollowUpQuestions: false
42+
Answer:
43+
I do not have enough information to answer that.
3044
[END EXAMPLE 2]
3145
[END EXAMPLES]
3246

@@ -35,4 +49,6 @@ Answer: I do not have enough information to answer that.
3549
{{$conversation}}
3650
[END INFORMATION]
3751

38-
Question: {{$input}}
52+
Question: {{$input}}
53+
SuggestFollowUpQuestions: {{$suggestions}}
54+
Answer:

0 commit comments

Comments
 (0)