Java: Add chat resources for learn docs (#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 😄
This commit is contained in:
Milder Hernandez
2024-05-14 11:04:28 +00:00
committed by GitHub
parent d92ad4f33e
commit c5c85c462f
4 changed files with 79 additions and 1 deletions
@@ -39,7 +39,7 @@ public class SerializingPrompts {
private static final String MODEL_ID = System.getenv()
.getOrDefault("MODEL_ID", "gpt-3.5-turbo");
private static final String PLUGINS_DIR = "java/samples/semantickernel-syntax-examples/src/main/resources/Plugins";
private static final String PLUGINS_DIR = "java/samples/semantickernel-learn-resources/src/main/resources/Plugins";
public static void main(String[] args) throws IOException {
System.out.println("======== Serializing Prompts ========");
@@ -0,0 +1,33 @@
{
"schema": 1,
"type": "completion",
"description": "Creates a chat response to the user",
"execution_settings": {
"default": {
"max_tokens": 1000,
"temperature": 0
},
"gpt-3.5-turbo": {
"model_id": "gpt-3.5-turbo-0613",
"max_tokens": 4000,
"temperature": 0.1
},
"gpt-4": {
"model_id": "gpt-4-1106-preview",
"max_tokens": 8000,
"temperature": 0.3
}
},
"input_variables": [
{
"name": "request",
"description": "The user's request.",
"required": true
},
{
"name": "history",
"description": "The history of the conversation.",
"required": true
}
]
}
@@ -0,0 +1,3 @@
{{ConversationSummaryPlugin.SummarizeConversation $history}}
User: {{$request}}
Assistant:
@@ -0,0 +1,42 @@
name: getIntent
description: Gets the intent of the user.
template: |
<message role="system">Instructions: What is the intent of this request?
Do not explain the reasoning, just reply back with the intent. If you are unsure, reply with {{choices.[0]}}.
Choices: {{choices}}.</message>
{{#each fewShotExamples}}
{{#each this}}
<message role="{{role}}">{{content}}</message>
{{/each}}
{{/each}}
<message role="assistant">Summary of conversation so far:
{{ConversationSummaryPlugin-SummarizeConversation history}}
</message>
<message role="user">{{request}}</message>
<message role="system">Intent:</message>
template_format: handlebars
input_variables:
- name: choices
description: The choices for the AI to choose from
default: ContinueConversation, EndConversation
- name: fewShotExamples
description: Few shot examples for the AI to learn from
is_required: true
- name: request
description: The user's request
is_required: true
execution_settings:
default:
max_tokens: 10
temperature: 0
gpt-3.5-turbo:
model_id: gpt-35-turbo-2
max_tokens: 10
temperature: 0.2
gpt-4:
model_id: gpt-4-1106-preview
max_tokens: 10
temperature: 0.2