Skip to content

Commit c5c85c4

Browse files
author
Milder Hernandez
authored
Java: Add chat resources for learn docs (microsoft#6243)
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent d92ad4f commit c5c85c4

4 files changed

Lines changed: 79 additions & 1 deletion

File tree

‎java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class SerializingPrompts {
3939
private static final String MODEL_ID = System.getenv()
4040
.getOrDefault("MODEL_ID", "gpt-3.5-turbo");
4141

42-
private static final String PLUGINS_DIR = "java/samples/semantickernel-syntax-examples/src/main/resources/Plugins";
42+
private static final String PLUGINS_DIR = "java/samples/semantickernel-learn-resources/src/main/resources/Plugins";
4343

4444
public static void main(String[] args) throws IOException {
4545
System.out.println("======== Serializing Prompts ========");
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"schema": 1,
3+
"type": "completion",
4+
"description": "Creates a chat response to the user",
5+
"execution_settings": {
6+
"default": {
7+
"max_tokens": 1000,
8+
"temperature": 0
9+
},
10+
"gpt-3.5-turbo": {
11+
"model_id": "gpt-3.5-turbo-0613",
12+
"max_tokens": 4000,
13+
"temperature": 0.1
14+
},
15+
"gpt-4": {
16+
"model_id": "gpt-4-1106-preview",
17+
"max_tokens": 8000,
18+
"temperature": 0.3
19+
}
20+
},
21+
"input_variables": [
22+
{
23+
"name": "request",
24+
"description": "The user's request.",
25+
"required": true
26+
},
27+
{
28+
"name": "history",
29+
"description": "The history of the conversation.",
30+
"required": true
31+
}
32+
]
33+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{ConversationSummaryPlugin.SummarizeConversation $history}}
2+
User: {{$request}}
3+
Assistant:
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: getIntent
2+
description: Gets the intent of the user.
3+
template: |
4+
<message role="system">Instructions: What is the intent of this request?
5+
Do not explain the reasoning, just reply back with the intent. If you are unsure, reply with {{choices.[0]}}.
6+
Choices: {{choices}}.</message>
7+
8+
{{#each fewShotExamples}}
9+
{{#each this}}
10+
<message role="{{role}}">{{content}}</message>
11+
{{/each}}
12+
{{/each}}
13+
14+
<message role="assistant">Summary of conversation so far:
15+
{{ConversationSummaryPlugin-SummarizeConversation history}}
16+
</message>
17+
18+
<message role="user">{{request}}</message>
19+
<message role="system">Intent:</message>
20+
template_format: handlebars
21+
input_variables:
22+
- name: choices
23+
description: The choices for the AI to choose from
24+
default: ContinueConversation, EndConversation
25+
- name: fewShotExamples
26+
description: Few shot examples for the AI to learn from
27+
is_required: true
28+
- name: request
29+
description: The user's request
30+
is_required: true
31+
execution_settings:
32+
default:
33+
max_tokens: 10
34+
temperature: 0
35+
gpt-3.5-turbo:
36+
model_id: gpt-35-turbo-2
37+
max_tokens: 10
38+
temperature: 0.2
39+
gpt-4:
40+
model_id: gpt-4-1106-preview
41+
max_tokens: 10
42+
temperature: 0.2

0 commit comments

Comments
 (0)