Java: Update handlebars function calling (#5122)

### 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:
John Oliver
2024-02-26 14:31:00 -05:00
committed by GitHub
parent f5cca08b91
commit 4c26f4abd0
45 changed files with 333 additions and 926 deletions
@@ -7,6 +7,7 @@ import com.azure.ai.openai.models.FunctionDefinition;
import com.azure.core.util.BinaryData;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.microsoft.semantickernel.orchestration.ToolCallBehavior;
import com.microsoft.semantickernel.services.chatcompletion.AuthorRole;
import com.microsoft.semantickernel.exceptions.SKException;
import java.io.ByteArrayInputStream;
@@ -106,7 +107,8 @@ class XMLPromptParser {
String name = getAttributeValue(event, "name");
String description = getAttributeValue(event, "description");
// name has to match '^[a-zA-Z0-9_-]{1,64}$'
functionDefinition = new FunctionDefinition(pluginName + "-" + name)
functionDefinition = new FunctionDefinition(
ToolCallBehavior.formFullFunctionName(pluginName, name))
.setDescription(description);
} else if (elementName.equals("parameter")) {
String name = getAttributeValue(event, "name");
@@ -27,17 +27,25 @@ import com.microsoft.semantickernel.samples.syntaxexamples.Example62_CustomAISer
import com.microsoft.semantickernel.samples.syntaxexamples.Example63_ChatCompletionPrompts;
import com.microsoft.semantickernel.samples.syntaxexamples.Example64_MultiplePromptTemplates;
import com.microsoft.semantickernel.samples.syntaxexamples.Example69_MutableKernelPlugin;
import com.microsoft.semantickernel.samples.syntaxexamples.java.FunctionsWithinPrompts_Example;
import com.microsoft.semantickernel.samples.syntaxexamples.java.KernelFunctionYaml_Example;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.List;
import java.util.Queue;
import java.util.stream.Stream;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.TestFactory;
import org.mockito.Mockito;
public class WiremockExamplesIT {
public static List<Class<?>> mains = Arrays.asList(
FunctionsWithinPrompts_Example.class,
KernelFunctionYaml_Example.class,
Example01_NativeFunctions.class,
Example03_Arguments.class,
Example05_InlineFunctionDefinition.class,
@@ -83,7 +91,9 @@ public class WiremockExamplesIT {
.usingFilesUnderDirectory(dir));
}
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
mockInputStream();
new WiremockExamplesIT()
.runSamplesTest()
.forEach(it -> {
@@ -95,6 +105,30 @@ public class WiremockExamplesIT {
});
}
private static void mockInputStream() throws IOException {
FunctionsWithinPrompts_Example.INPUT = Mockito.mock(InputStream.class);
Queue<String> messages = new ArrayDeque<>();
messages.addAll(Arrays.asList(
"Can you draft me an email to the marketing team?",
"Tell them to go ahead with the plan",
"That is all"));
Mockito
.when(FunctionsWithinPrompts_Example.INPUT.read(
Mockito.any(byte[].class),
Mockito.anyInt(),
Mockito.anyInt()))
.then(invocation -> {
String message = messages.poll() + "\n";
byte[] bytes = invocation.getArgument(0);
System.arraycopy(message.getBytes(), 0, bytes, 0, message.getBytes().length);
return message.getBytes().length;
});
}
@TestFactory
public Stream<DynamicTest> runSamplesTest() {
return mains
@@ -0,0 +1,17 @@
{
"priority": 1,
"request": {
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo-2/chat/completions?api-version=2023-12-01-preview",
"bodyPatterns": [
{
"contains": "That is all"
}
]
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253061,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"EndConversation\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":67,\"total_tokens\":84}}",
"headers": {},
"status": 200
}
}
@@ -1,23 +0,0 @@
{
"id": "45379a29-d6d3-4613-a885-b30ccaaa6db0",
"insertionIndex": 19,
"name": "deployments_gpt-35-turbo-2_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian expert\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking some suggestions\"},{\"role\":\"assistant\",\"content\":\"Of course! I'd be happy to help you with some suggestions. What are you looking for?\"},{\"role\":\"user\",\"content\":\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion\"}],\"max_tokens\":256,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{\"39142\":-100,\"17422\":-100,\"35199\":-100,\"56185\":-100,\"2363\":-100,\"23763\":-100,\"35097\":-100,\"1160\":-100,\"47913\":-100,\"58162\":-100,\"1888\":-100,\"79761\":-100,\"3229\":-100,\"2536\":-100,\"12735\":-100,\"301\":-100,\"3446\":-100,\"2653\":-100,\"86831\":-100,\"56741\":-100,\"3773\":-100,\"6875\":-100,\"17649\":-100,\"5403\":-100},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"model\":\"gpt-35-turbo-2\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo-2/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253019,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"length\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"52dbd293-192d-4e01-8b31-e364b11a089d\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":69,\"completion_tokens\":256,\"total_tokens\":325}}",
"headers": {},
"status": 200
},
"uuid": "45379a29-d6d3-4613-a885-b30ccaaa6db0"
}
@@ -1,23 +0,0 @@
{
"id": "686c6f9b-7c66-41af-8b9b-86e44fcdb2b1",
"insertionIndex": 20,
"name": "deployments_gpt-35-turbo-2_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian expert\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking some suggestions\"}],\"max_tokens\":256,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{\"39142\":-100,\"17422\":-100,\"35199\":-100,\"56185\":-100,\"2363\":-100,\"23763\":-100,\"35097\":-100,\"1160\":-100,\"47913\":-100,\"58162\":-100,\"1888\":-100,\"79761\":-100,\"3229\":-100,\"2536\":-100,\"12735\":-100,\"301\":-100,\"3446\":-100,\"2653\":-100,\"86831\":-100,\"56741\":-100,\"3773\":-100,\"6875\":-100,\"17649\":-100,\"5403\":-100},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"model\":\"gpt-35-turbo-2\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo-2/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253018,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"0aaf065e-3032-4d24-8d5d-10fc6b4c7eaf\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":23,\"completion_tokens\":20,\"total_tokens\":43}}",
"headers": {},
"status": 200
},
"uuid": "686c6f9b-7c66-41af-8b9b-86e44fcdb2b1"
}
@@ -1,25 +1,11 @@
{
"id": "71b07779-49a8-44e5-a60b-ee5b0a3ad697",
"insertionIndex": 7,
"name": "deployments_gpt-35-turbo-2_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, what can you do for me?\"}],\"model\":\"gpt-35-turbo-2\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo-2/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-4-deployments-gpt-35-turbo-2-chat-completions-2",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253061,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"1979b4ce-5463-4cfb-8ec8-1d05c4b44ccf\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":67,\"total_tokens\":84}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-4-deployments-gpt-35-turbo-2-chat-completions",
"uuid": "71b07779-49a8-44e5-a60b-ee5b0a3ad697"
}
}
@@ -1,26 +0,0 @@
{
"id": "c9edbe4a-e60b-4796-bd01-11bafa211bab",
"insertionIndex": 8,
"name": "deployments_gpt-35-turbo-2_chat_completions",
"newScenarioState": "scenario-4-deployments-gpt-35-turbo-2-chat-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, what can you do for me?\"}],\"model\":\"gpt-35-turbo-2\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo-2/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253054,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"28eee7e9-28c5-47c7-90c5-44cef75fd582\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":297,\"total_tokens\":314}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-4-deployments-gpt-35-turbo-2-chat-completions",
"uuid": "c9edbe4a-e60b-4796-bd01-11bafa211bab"
}
@@ -1,23 +0,0 @@
{
"id": "093a64da-80ba-49bf-a4fd-625224d60b3a",
"insertionIndex": 25,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"List the two planets closest to 'Jupiter', excluding moons, using bullet points.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253000,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"120318d5-35af-487a-b335-7fa00c5f7dd7\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":24,\"completion_tokens\":5,\"total_tokens\":29}}",
"headers": {},
"status": 200
},
"uuid": "093a64da-80ba-49bf-a4fd-625224d60b3a"
}
@@ -1,16 +1,5 @@
{
"id": "0c8046c5-74ad-4836-8aa9-09da60f367a2",
"insertionIndex": 12,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a paragraph about hats\"},{\"role\":\"system\",\"content\":\"Use upper case text when responding to the prompt.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
@@ -18,6 +7,5 @@
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253039,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"ac9817bc-7e1a-48e4-b06c-0ff7618b88c6\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":26,\"completion_tokens\":131,\"total_tokens\":157}}",
"headers": {},
"status": 200
},
"uuid": "0c8046c5-74ad-4836-8aa9-09da60f367a2"
}
}
@@ -1,26 +0,0 @@
{
"id": "252c54f4-1111-467b-b028-7687e4ed5021",
"insertionIndex": 27,
"name": "deployments_gpt-35-turbo_chat_completions",
"newScenarioState": "scenario-6-deployments-gpt-35-turbo-chat-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian, expert about books\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking for book suggestions\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707252992,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"7d312938-df92-46bf-8729-8d7b92ddb026\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":27,\"completion_tokens\":76,\"total_tokens\":103}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-6-deployments-gpt-35-turbo-chat-completions",
"uuid": "252c54f4-1111-467b-b028-7687e4ed5021"
}
@@ -1,25 +0,0 @@
{
"id": "270f9641-5867-4ca4-a738-d3b1d18faefb",
"insertionIndex": 3,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"What is Seattle?\"},{\"role\":\"system\",\"content\":\"Respond with JSON.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-2-deployments-gpt-35-turbo-chat-completions-2",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253067,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"57e7d767-3d91-4622-8571-84710dd2e7ff\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":19,\"completion_tokens\":151,\"total_tokens\":170}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-2-deployments-gpt-35-turbo-chat-completions",
"uuid": "270f9641-5867-4ca4-a738-d3b1d18faefb"
}
@@ -1,26 +0,0 @@
{
"id": "364efff1-b5dd-4796-8c01-936b19045de2",
"insertionIndex": 11,
"name": "deployments_gpt-35-turbo_chat_completions",
"newScenarioState": "scenario-5-deployments-gpt-35-turbo-chat-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, what can you do for me?\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253042,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"2fb33955-441a-429d-bbf6-603e449d21b6\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":197,\"total_tokens\":214}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-5-deployments-gpt-35-turbo-chat-completions",
"uuid": "364efff1-b5dd-4796-8c01-936b19045de2"
}
@@ -1,23 +0,0 @@
{
"id": "36d8c189-3b93-4a19-b92f-8effb670f75a",
"insertionIndex": 26,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian, expert about books\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking for book suggestions\"},{\"role\":\"assistant\",\"content\":\"Certainly! I'd be happy to help you find some book suggestions. Could you please provide me with more information about what kind of books you enjoy? For example, do you have any favorite genres or authors? Are you looking for fiction or non-fiction books? Any specific themes or topics you're interested in? The more details you can provide, the better I can assist you.\"},{\"role\":\"user\",\"content\":\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707252994,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"ace2c274-2932-4ba7-b132-6ec80ad55698\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":129,\"completion_tokens\":308,\"total_tokens\":437}}",
"headers": {},
"status": 200
},
"uuid": "36d8c189-3b93-4a19-b92f-8effb670f75a"
}
@@ -1,23 +0,0 @@
{
"id": "3708b848-8dbe-4c2d-a057-04abcee675c0",
"insertionIndex": 22,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hi, give me 5 book suggestions about: travel\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253005,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"67c9623d-7f83-432b-89e5-40ffb3c343c2\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":18,\"completion_tokens\":281,\"total_tokens\":299}}",
"headers": {},
"status": 200
},
"uuid": "3708b848-8dbe-4c2d-a057-04abcee675c0"
}
@@ -1,23 +0,0 @@
{
"id": "4939b782-4212-435b-8d7d-c3454fe0200c",
"insertionIndex": 16,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a random paragraph about: I missed the F1 final race in the style of Seinfeld.\\nUSE SHORT, CLEAR, COMPLETE SENTENCES.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253027,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"8e81b11a-5cd0-40f1-a80d-641ec60a3bc4\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":36,\"completion_tokens\":336,\"total_tokens\":372}}",
"headers": {},
"status": 200
},
"uuid": "4939b782-4212-435b-8d7d-c3454fe0200c"
}
@@ -1,26 +0,0 @@
{
"id": "5d78a6d8-abca-488a-8752-599051a3e352",
"insertionIndex": 4,
"name": "deployments_gpt-35-turbo_chat_completions",
"newScenarioState": "scenario-2-deployments-gpt-35-turbo-chat-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"What is Seattle?\"},{\"role\":\"system\",\"content\":\"Respond with JSON.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253065,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"28374b87-21d3-4506-9569-3c7c4aaf9052\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":19,\"completion_tokens\":91,\"total_tokens\":110}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-2-deployments-gpt-35-turbo-chat-completions",
"uuid": "5d78a6d8-abca-488a-8752-599051a3e352"
}
@@ -1,26 +0,0 @@
{
"id": "604be5a5-3e55-44ee-a85f-9d9e63b1763a",
"insertionIndex": 2,
"name": "deployments_gpt-35-turbo_chat_completions",
"newScenarioState": "scenario-1-deployments-gpt-35-turbo-chat-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, my name is Bob. What is the origin of my name?\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253070,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"aed93937-6747-4092-8b1d-6a3345a63197\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":23,\"completion_tokens\":75,\"total_tokens\":98}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-1-deployments-gpt-35-turbo-chat-completions",
"uuid": "604be5a5-3e55-44ee-a85f-9d9e63b1763a"
}
@@ -1,23 +0,0 @@
{
"id": "70facef2-7e60-49d5-8009-b38915a1b355",
"insertionIndex": 23,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian, expert about books\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking for book suggestions\"},{\"role\":\"assistant\",\"content\":\"Of course! I'd be happy to help you find some book suggestions. What genre or type of book are you interested in?\"},{\"role\":\"user\",\"content\":\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253001,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"6fe0e3aa-5670-435c-9c90-976f97ce9c4c\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":79,\"completion_tokens\":276,\"total_tokens\":355}}",
"headers": {},
"status": 200
},
"uuid": "70facef2-7e60-49d5-8009-b38915a1b355"
}
@@ -1,25 +0,0 @@
{
"id": "779728d0-3cfa-4374-aa56-7038de43449e",
"insertionIndex": 24,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian, expert about books\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking for book suggestions\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-6-deployments-gpt-35-turbo-chat-completions-2",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253000,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"4772ff60-75e0-46bc-8224-6ec8ba5b9be1\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":27,\"completion_tokens\":26,\"total_tokens\":53}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-6-deployments-gpt-35-turbo-chat-completions",
"uuid": "779728d0-3cfa-4374-aa56-7038de43449e"
}
@@ -1,23 +0,0 @@
{
"id": "79f4220d-21e6-43e2-8a2e-6a281fcbfea9",
"insertionIndex": 21,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"assistant\",\"content\":\"You are a librarian, expert about books\"},{\"role\":\"user\",\"content\":\"Hi, I'm looking for 3 different book suggestions about sci-fi\"}],\"max_tokens\":1024,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":2,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253010,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"4949cf23-7039-4226-be78-8dd8c6e678e3\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}},{\"finish_reason\":\"stop\",\"index\":1,\"message\":{\"role\":\"assistant\",\"content\":\"7c66554a-3003-467d-9ce7-9bf7e22ab921\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"low\"}}}],\"usage\":{\"prompt_tokens\":33,\"completion_tokens\":640,\"total_tokens\":673}}",
"headers": {},
"status": 200
},
"uuid": "79f4220d-21e6-43e2-8a2e-6a281fcbfea9"
}
@@ -1,23 +0,0 @@
{
"id": "8ccdcbb2-4a82-47c4-a3da-93041481ce06",
"insertionIndex": 18,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a haiku about the following: Harry Potter\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253023,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"9043bdfe-acca-4068-8880-31f68015d800\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"low\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":18,\"total_tokens\":35}}",
"headers": {},
"status": 200
},
"uuid": "8ccdcbb2-4a82-47c4-a3da-93041481ce06"
}
@@ -1,23 +0,0 @@
{
"id": "bcdbf876-8b4c-4de1-99b4-deaad761fdbe",
"insertionIndex": 14,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a phrase with Cancellation.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253036,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"49ec813d-2f20-4424-9a3f-b6ead6b4894f\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":14,\"completion_tokens\":12,\"total_tokens\":26}}",
"headers": {},
"status": 200
},
"uuid": "bcdbf876-8b4c-4de1-99b4-deaad761fdbe"
}
@@ -1,25 +0,0 @@
{
"id": "c71f3ff7-70f7-4966-a752-811bf1c01382",
"insertionIndex": 1,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, my name is Bob. What is the origin of my name?\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-1-deployments-gpt-35-turbo-chat-completions-2",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253072,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"b82a811f-96d2-479f-96db-cadddfa99c1d\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":23,\"completion_tokens\":80,\"total_tokens\":103}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-1-deployments-gpt-35-turbo-chat-completions",
"uuid": "c71f3ff7-70f7-4966-a752-811bf1c01382"
}
@@ -1,23 +0,0 @@
{
"id": "ca797b35-ef23-4628-9c6f-b1ea00ba5e3e",
"insertionIndex": 15,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a paragraph about Handlers.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253032,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"49c63368-9fe4-42ca-bd0c-ff1064c44eb6\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":13,\"completion_tokens\":149,\"total_tokens\":162}}",
"headers": {},
"status": 200
},
"uuid": "ca797b35-ef23-4628-9c6f-b1ea00ba5e3e"
}
@@ -1,25 +0,0 @@
{
"id": "daf144e4-182b-4100-91f2-49b6115a1026",
"insertionIndex": 10,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Hello AI, what can you do for me?\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-5-deployments-gpt-35-turbo-chat-completions-2",
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253047,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"4aab22a1-8bb4-462e-a72d-5abeb5b91335\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":17,\"completion_tokens\":251,\"total_tokens\":268}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-5-deployments-gpt-35-turbo-chat-completions",
"uuid": "daf144e4-182b-4100-91f2-49b6115a1026"
}
@@ -1,23 +0,0 @@
{
"id": "dc3d7bb6-815c-44fc-a15f-a6f9ce7eb012",
"insertionIndex": 13,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a paragraph about hats\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253037,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"8dafdc23-45e2-4c72-949d-0b88c107c76e\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":12,\"completion_tokens\":130,\"total_tokens\":142}}",
"headers": {},
"status": 200
},
"uuid": "dc3d7bb6-815c-44fc-a15f-a6f9ce7eb012"
}
@@ -1,23 +0,0 @@
{
"id": "f0070b1d-f4eb-4691-9d72-a0b935a227eb",
"insertionIndex": 17,
"name": "deployments_gpt-35-turbo_chat_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"messages\":[{\"role\":\"user\",\"content\":\"Write a random paragraph about: I missed the F1 final race.\"}],\"model\":\"gpt-35-turbo\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/gpt-35-turbo/chat/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"chatcmpl-xxx\",\"object\":\"chat.completion\",\"created\":1707253024,\"model\":\"gpt-35-turbo\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"97aeec5d-1555-4548-a681-cb1cc52b15c5\"},\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":21,\"completion_tokens\":175,\"total_tokens\":196}}",
"headers": {},
"status": 200
},
"uuid": "f0070b1d-f4eb-4691-9d72-a0b935a227eb"
}
@@ -1,26 +1,11 @@
{
"id": "0215b128-4822-4368-ac3d-2f580a221f00",
"insertionIndex": 6,
"name": "deployments_text-davinci-003_completions",
"newScenarioState": "scenario-3-deployments-text-davinci-003-completions-3",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Hello AI, what can you do for me?\"],\"max_tokens\":256,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-3-deployments-text-davinci-003-completions-2",
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707253062,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"7949e981-c632-422f-9b76-335a2379cd83\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":10,\"completion_tokens\":26,\"total_tokens\":36}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-3-deployments-text-davinci-003-completions",
"uuid": "0215b128-4822-4368-ac3d-2f580a221f00"
}
}
@@ -1,25 +0,0 @@
{
"id": "1296bcee-1e54-43b1-b4b3-4642dd8bd0a0",
"insertionIndex": 5,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Hello AI, what can you do for me?\"],\"max_tokens\":256,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "scenario-3-deployments-text-davinci-003-completions-3",
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707253064,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"f3d22bfb-13ae-41f1-ba1c-e162da7cf3ec\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":10,\"completion_tokens\":34,\"total_tokens\":44}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-3-deployments-text-davinci-003-completions",
"uuid": "1296bcee-1e54-43b1-b4b3-4642dd8bd0a0"
}
@@ -1,23 +0,0 @@
{
"id": "350fea53-3d73-4d59-b603-dba32fdc5af9",
"insertionIndex": 37,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\" Generate a creative reason or excuse for the given event.\\n Be creative and be funny. Let your imagination run wild.\\n\\n Event: I am running late.\\n Excuse: I was being held ransom by giraffe gangsters.\\n\\n Event: I haven't been to the gym for a year\\n Excuse: I've been too busy training my pet dragon.\\n\\n Event: I missed the F1 final race\\n\"],\"max_tokens\":100,\"temperature\":0.4,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252975,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"1ec9fb4c-eae2-44b4-9974-c87d452220ae\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":93,\"completion_tokens\":15,\"total_tokens\":108}}",
"headers": {},
"status": 200
},
"uuid": "350fea53-3d73-4d59-b603-dba32fdc5af9"
}
@@ -1,23 +0,0 @@
{
"id": "3ce79fbf-90ee-4575-aeb4-6f7d545d1db6",
"insertionIndex": 32,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"BEGIN CONTENT TO SUMMARIZE:\\nJane: I think we're almost there. Let me check.\\nJane: I have some bad news, we're only half way there.\\nJohn: Oh no, I'm not sure I can keep going. I'm getting tired.\\nJane: I'm getting tired too.\\nJohn: Maybe there is a large piece of text we can use to generate a long conversation.\\nJane: That's a good idea. Let me see if I can find one. Maybe Lorem Ipsum?\\nJohn: Yeah, that's a good idea.\\nJane: I found a Lorem Ipsum generator.\\nJane: Here's a 4096 character Lorem Ipsum text:\\nJane: Lorem ipsum dolor sit amet, con\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Darn, it's just repeating stuf now.\\nJohn: I think we're done.\\nJane: We're not though! We need like 1500 more characters.\\nJohn: Oh Cananda, our home and native land.\\nJane: True patriot love in all thy sons command.\\nJohn: With glowing hearts we see thee rise.\\nJane: The True North strong and free.\\nJohn: From far and wide, O Canada, we stand on guard for thee.\\nJane: God keep our land glorious and free.\\nJohn: O Canada, we stand on guard for thee.\\nJane: O Canada, we stand on guard for thee.\\nJane: That was fun, thank you. Let me check now.\\nJane: I think we need about 600 more characters.\\nJohn: Oh say can you see?\\nJane: By the dawn's early light.\\nJohn: What so proudly we hailed.\\nJane: At the twilight's last gleaming.\\nJohn: Whose broad stripes and bright stars.\\nJane: Through the perilous fight.\\nJohn: O'er the ramparts we watched.\\nJane: Were so gallantly streaming.\\nJohn: And the rockets' red glare.\\nJane: The bombs bursting in air.\\nJohn: Gave proof through the night.\\nJane: That our flag was still there.\\nJohn: Oh say does that star-spangled banner yet wave.\\nJane: O'er the land of the free.\\nJohn: And the home of the brave.\\nJane: Are you a Seattle Kraken Fan?\\nJohn: Yes, I am. I love going to the games.\\nJane: I'm a Seattle Kraken Fan too. Who is your favorite player?\\nJohn: I like watching all the players, but I think my favorite is Matty Beniers.\\nJane: Yeah, he's a great player. I like watching him too. I also like watching Jaden Schwartz.\\nJohn: Adam Larsson is another good one. The big cat!\\nJane: WE MADE IT! It's long enough. Thank you!\\nJohn: Can you automate generating long text next time?\\nJane: I will.\\nJohn: You're welcome. I'm glad we could help. Goodbye!\\nJane: Goodbye!\\n\\nEND CONTENT TO SUMMARIZE.\\n\\nSummarize the conversation in 'CONTENT TO SUMMARIZE', identifying main points of discussion and any conclusions that were reached.\\nDo not incorporate other general knowledge.\\nSummary is in plain text, in complete sentences, with no markup or tags.\\n\\nBEGIN SUMMARY:\\n\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252982,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"caf6e239-7150-4d70-b814-62cd93e7c525\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":791,\"completion_tokens\":48,\"total_tokens\":839}}",
"headers": {},
"status": 200
},
"uuid": "3ce79fbf-90ee-4575-aeb4-6f7d545d1db6"
}
@@ -1,23 +0,0 @@
{
"id": "3d48b3d9-5263-4d35-97dc-6db5b0335989",
"insertionIndex": 30,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"You are an action item extractor. You will be given chat history and need to make note of action items mentioned in the chat.\\nExtract action items from the content if there are any. If there are no action, return nothing. If a single field is missing, use an empty string.\\nReturn the action items in json.\\n\\nPossible statuses for action items are: Open, Closed, In Progress.\\n\\nEXAMPLE INPUT WITH ACTION ITEMS:\\n\\nJohn Doe said: \\\"I will record a demo for the new feature by Friday\\\"\\nI said: \\\"Great, thanks John. We may not use all of it but it's good to get it out there.\\\"\\n\\nEXAMPLE OUTPUT:\\n{\\n \\\"actionItems\\\": [\\n {\\n \\\"owner\\\": \\\"John Doe\\\",\\n \\\"actionItem\\\": \\\"Record a demo for the new feature\\\",\\n \\\"dueDate\\\": \\\"Friday\\\",\\n \\\"status\\\": \\\"Open\\\",\\n \\\"notes\\\": \\\"\\n }\\n ]\\n}\\n\\nEXAMPLE INPUT WITHOUT ACTION ITEMS:\\n\\nJohn Doe said: \\\"Hey I'm going to the store, do you need anything?\\\"\\nI said: \\\"No thanks, I'm good.\\\"\\n\\nEXAMPLE OUTPUT:\\n{\\n \\\"action_items\\\": []\\n}\\n\\nCONTENT STARTS HERE.\\n\\nJane: I think we're almost there. Let me check.\\nJane: I have some bad news, we're only half way there.\\nJohn: Oh no, I'm not sure I can keep going. I'm getting tired.\\nJane: I'm getting tired too.\\nJohn: Maybe there is a large piece of text we can use to generate a long conversation.\\nJane: That's a good idea. Let me see if I can find one. Maybe Lorem Ipsum?\\nJohn: Yeah, that's a good idea.\\nJane: I found a Lorem Ipsum generator.\\nJane: Here's a 4096 character Lorem Ipsum text:\\nJane: Lorem ipsum dolor sit amet, con\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Darn, it's just repeating stuf now.\\nJohn: I think we're done.\\nJane: We're not though! We need like 1500 more characters.\\nJohn: Oh Cananda, our home and native land.\\nJane: True patriot love in all thy sons command.\\nJohn: With glowing hearts we see thee rise.\\nJane: The True North strong and free.\\nJohn: From far and wide, O Canada, we stand on guard for thee.\\nJane: God keep our land glorious and free.\\nJohn: O Canada, we stand on guard for thee.\\nJane: O Canada, we stand on guard for thee.\\nJane: That was fun, thank you. Let me check now.\\nJane: I think we need about 600 more characters.\\nJohn: Oh say can you see?\\nJane: By the dawn's early light.\\nJohn: What so proudly we hailed.\\nJane: At the twilight's last gleaming.\\nJohn: Whose broad stripes and bright stars.\\nJane: Through the perilous fight.\\nJohn: O'er the ramparts we watched.\\nJane: Were so gallantly streaming.\\nJohn: And the rockets' red glare.\\nJane: The bombs bursting in air.\\nJohn: Gave proof through the night.\\nJane: That our flag was still there.\\nJohn: Oh say does that star-spangled banner yet wave.\\nJane: O'er the land of the free.\\nJohn: And the home of the brave.\\nJane: Are you a Seattle Kraken Fan?\\nJohn: Yes, I am. I love going to the games.\\nJane: I'm a Seattle Kraken Fan too. Who is your favorite player?\\nJohn: I like watching all the players, but I think my favorite is Matty Beniers.\\nJane: Yeah, he's a great player. I like watching him too. I also like watching Jaden Schwartz.\\nJohn: Adam Larsson is another good one. The big cat!\\nJane: WE MADE IT! It's long enough. Thank you!\\nJohn: Can you automate generating long text next time?\\nJane: I will.\\nJohn: You're welcome. I'm glad we could help. Goodbye!\\nJane: Goodbye!\\n\\nCONTENT STOPS HERE.\\n\\nOUTPUT:\\n\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252987,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"cab3c6e5-6681-48a0-8c56-3727299a890d\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":1018,\"completion_tokens\":62,\"total_tokens\":1080}}",
"headers": {},
"status": 200
},
"uuid": "3d48b3d9-5263-4d35-97dc-6db5b0335989"
}
@@ -1,23 +0,0 @@
{
"id": "544c72c2-de8a-407d-a319-b7c04a8c237e",
"insertionIndex": 31,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"You are an action item extractor. You will be given chat history and need to make note of action items mentioned in the chat.\\nExtract action items from the content if there are any. If there are no action, return nothing. If a single field is missing, use an empty string.\\nReturn the action items in json.\\n\\nPossible statuses for action items are: Open, Closed, In Progress.\\n\\nEXAMPLE INPUT WITH ACTION ITEMS:\\n\\nJohn Doe said: \\\"I will record a demo for the new feature by Friday\\\"\\nI said: \\\"Great, thanks John. We may not use all of it but it's good to get it out there.\\\"\\n\\nEXAMPLE OUTPUT:\\n{\\n \\\"actionItems\\\": [\\n {\\n \\\"owner\\\": \\\"John Doe\\\",\\n \\\"actionItem\\\": \\\"Record a demo for the new feature\\\",\\n \\\"dueDate\\\": \\\"Friday\\\",\\n \\\"status\\\": \\\"Open\\\",\\n \\\"notes\\\": \\\"\\n }\\n ]\\n}\\n\\nEXAMPLE INPUT WITHOUT ACTION ITEMS:\\n\\nJohn Doe said: \\\"Hey I'm going to the store, do you need anything?\\\"\\nI said: \\\"No thanks, I'm good.\\\"\\n\\nEXAMPLE OUTPUT:\\n{\\n \\\"action_items\\\": []\\n}\\n\\nCONTENT STARTS HERE.\\n\\nJohn: Hello, how are you?\\nJane: I'm fine, thanks. How are you?\\nJohn: I'm doing well, writing some example code.\\nJane: That's great! I'm writing some example code too.\\nJohn: What are you writing?\\nJane: I'm writing a chatbot.\\nJohn: That's cool. I'm writing a chatbot too.\\nJane: What language are you writing it in?\\nJohn: I'm writing it in C#.\\nJane: I'm writing it in Python.\\nJohn: That's cool. I need to learn Python.\\nJane: I need to learn C#.\\nJohn: Can I try out your chatbot?\\nJane: Sure, here's the link.\\nJohn: Thanks!\\nJane: You're welcome.\\nJane: Look at this poem my chatbot wrote:\\nJane: Roses are red\\nJane: Violets are blue\\nJane: I'm writing a chatbot\\nJane: What about you?\\nJohn: That's cool. Let me see if mine will write a poem, too.\\nJohn: Here's a poem my chatbot wrote:\\nJohn: The singularity of the universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Looks like I need to improve mine, oh well.\\nJane: You might want to try using a different model.\\nJane: I'm using the GPT-3 model.\\nJohn: I'm using the GPT-2 model. That makes sense.\\nJohn: Here is a new poem after updating the model.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Yikes, it's really stuck isn't it. Would you help me debug my code?\\nJane: Sure, what's the problem?\\nJohn: I'm not sure. I think it's a bug in the code.\\nJane: I'll take a look.\\nJane: I think I found the problem.\\nJane: It looks like you're not passing the right parameters to the model.\\nJohn: Thanks for the help!\\nJane: I'm now writing a bot to summarize conversations. I want to make sure it works when the conversation is long.\\nJohn: So you need to keep talking with me to generate a long conversation?\\nJane: Yes, that's right.\\nJohn: Ok, I'll keep talking. What should we talk about?\\nJane: I don't know, what do you want to talk about?\\nJohn: I don't know, it's nice how CoPilot is doing most of the talking for us. But it definitely gets stuck sometimes.\\nJane: I agree, it's nice that CoPilot is doing most of the talking for us.\\nJane: But it definitely gets stuck sometimes.\\nJohn: Do you know how long it needs to be?\\nJane: I think the max length is 1024 tokens. Which is approximately 1024*4= 4096 characters.\\nJohn: That's a lot of characters.\\nJane: Yes, it is.\\nJohn: I'm not sure how much longer I can keep talking.\\n\\nCONTENT STOPS HERE.\\n\\nOUTPUT:\\n\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252983,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"ee5e62b0-d339-4171-b42a-664a5eb77685\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":998,\"completion_tokens\":167,\"total_tokens\":1165}}",
"headers": {},
"status": 200
},
"uuid": "544c72c2-de8a-407d-a319-b7c04a8c237e"
}
@@ -1,26 +0,0 @@
{
"id": "7441c9cd-22ef-41a0-8c0b-f050326ca99c",
"insertionIndex": 9,
"name": "deployments_text-davinci-003_completions",
"newScenarioState": "scenario-3-deployments-text-davinci-003-completions-2",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Hello AI, what can you do for me?\"],\"max_tokens\":256,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"requiredScenarioState": "Started",
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707253052,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"50ea41ad-bd16-4241-bb54-c98e091dac99\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":10,\"completion_tokens\":35,\"total_tokens\":45}}",
"headers": {},
"status": 200
},
"scenarioName": "scenario-3-deployments-text-davinci-003-completions",
"uuid": "7441c9cd-22ef-41a0-8c0b-f050326ca99c"
}
@@ -1,23 +0,0 @@
{
"id": "7718fb6b-1cae-4420-8e34-126c14d00539",
"insertionIndex": 29,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Analyze the following extract taken from a conversation transcript and extract key topics.\\n- Topics only worth remembering.\\n- Be brief. Short phrases.\\n- Can use broken English.\\n- Conciseness is very important.\\n- Topics can include names of memories you want to recall.\\n- NO LONG SENTENCES. SHORT PHRASES.\\n- Return in JSON\\n[Input]\\nMy name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest.\\nMy tragic story was immortalized by Shakespeare in a play.\\n[Output]\\n{\\n \\\"topics\\\": [\\n \\\"Macbeth\\\",\\n \\\"King of Scotland\\\",\\n \\\"Lady Macbeth\\\",\\n \\\"Dog\\\",\\n \\\"Toby McDuff\\\",\\n \\\"Shakespeare\\\",\\n \\\"Play\\\",\\n \\\"Tragedy\\\"\\n ]\\n}\\n+++++\\n[Input]\\nJohn: Hello, how are you?\\nJane: I'm fine, thanks. How are you?\\nJohn: I'm doing well, writing some example code.\\nJane: That's great! I'm writing some example code too.\\nJohn: What are you writing?\\nJane: I'm writing a chatbot.\\nJohn: That's cool. I'm writing a chatbot too.\\nJane: What language are you writing it in?\\nJohn: I'm writing it in C#.\\nJane: I'm writing it in Python.\\nJohn: That's cool. I need to learn Python.\\nJane: I need to learn C#.\\nJohn: Can I try out your chatbot?\\nJane: Sure, here's the link.\\nJohn: Thanks!\\nJane: You're welcome.\\nJane: Look at this poem my chatbot wrote:\\nJane: Roses are red\\nJane: Violets are blue\\nJane: I'm writing a chatbot\\nJane: What about you?\\nJohn: That's cool. Let me see if mine will write a poem, too.\\nJohn: Here's a poem my chatbot wrote:\\nJohn: The singularity of the universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Looks like I need to improve mine, oh well.\\nJane: You might want to try using a different model.\\nJane: I'm using the GPT-3 model.\\nJohn: I'm using the GPT-2 model. That makes sense.\\nJohn: Here is a new poem after updating the model.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Yikes, it's really stuck isn't it. Would you help me debug my code?\\nJane: Sure, what's the problem?\\nJohn: I'm not sure. I think it's a bug in the code.\\nJane: I'll take a look.\\nJane: I think I found the problem.\\nJane: It looks like you're not passing the right parameters to the model.\\nJohn: Thanks for the help!\\nJane: I'm now writing a bot to summarize conversations. I want to make sure it works when the conversation is long.\\nJohn: So you need to keep talking with me to generate a long conversation?\\nJane: Yes, that's right.\\nJohn: Ok, I'll keep talking. What should we talk about?\\nJane: I don't know, what do you want to talk about?\\nJohn: I don't know, it's nice how CoPilot is doing most of the talking for us. But it definitely gets stuck sometimes.\\nJane: I agree, it's nice that CoPilot is doing most of the talking for us.\\nJane: But it definitely gets stuck sometimes.\\nJohn: Do you know how long it needs to be?\\nJane: I think the max length is 1024 tokens. Which is approximately 1024*4= 4096 characters.\\nJohn: That's a lot of characters.\\nJane: Yes, it is.\\nJohn: I'm not sure how much longer I can keep talking.\\n[Output]\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252988,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"527e770d-c106-4b6d-8595-f584b0532d75\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":927,\"completion_tokens\":77,\"total_tokens\":1004}}",
"headers": {},
"status": 200
},
"uuid": "7718fb6b-1cae-4420-8e34-126c14d00539"
}
@@ -1,23 +0,0 @@
{
"id": "857195c1-97b9-4118-8c05-d25d0020f8e2",
"insertionIndex": 35,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Translate this date 1970-01-01 to French format\"],\"max_tokens\":100,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252976,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"5cfcf9bb-5adc-43ab-ac46-80009b0e3cf9\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":12,\"completion_tokens\":7,\"total_tokens\":19}}",
"headers": {},
"status": 200
},
"uuid": "857195c1-97b9-4118-8c05-d25d0020f8e2"
}
@@ -1,23 +0,0 @@
{
"id": "85f3675c-e404-4138-96c2-e49d4521e4f6",
"insertionIndex": 36,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\" Generate a creative reason or excuse for the given event.\\n Be creative and be funny. Let your imagination run wild.\\n\\n Event: I am running late.\\n Excuse: I was being held ransom by giraffe gangsters.\\n\\n Event: I haven't been to the gym for a year\\n Excuse: I've been too busy training my pet dragon.\\n\\n Event: sorry I forgot your birthday\\n\"],\"max_tokens\":100,\"temperature\":0.4,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252976,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"936e5f54-9693-4a66-bd9d-96a9fa72d314\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":91,\"completion_tokens\":14,\"total_tokens\":105}}",
"headers": {},
"status": 200
},
"uuid": "85f3675c-e404-4138-96c2-e49d4521e4f6"
}
@@ -1,23 +0,0 @@
{
"id": "990e9efb-2d61-424d-bbf6-a68e2d25552f",
"insertionIndex": 34,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Today is: 2021-09-01\\nCurrent time is: 12:00:00\\n\\nAnswer to the following questions using JSON syntax, including the data used.\\n Is it morning, afternoon, evening, or night (morning/afternoon/evening/night)?\\n Is it weekend time (weekend/not weekend)?\\n\"],\"max_tokens\":100,\"temperature\":1.0,\"top_p\":1.0,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252977,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"c0c8de7b-5fdf-43ff-a261-380cbf4be59e\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":71,\"completion_tokens\":44,\"total_tokens\":115}}",
"headers": {},
"status": 200
},
"uuid": "990e9efb-2d61-424d-bbf6-a68e2d25552f"
}
@@ -1,23 +0,0 @@
{
"id": "a29ad1f1-2423-4dbf-a127-fd2c93998fcd",
"insertionIndex": 28,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"Analyze the following extract taken from a conversation transcript and extract key topics.\\n- Topics only worth remembering.\\n- Be brief. Short phrases.\\n- Can use broken English.\\n- Conciseness is very important.\\n- Topics can include names of memories you want to recall.\\n- NO LONG SENTENCES. SHORT PHRASES.\\n- Return in JSON\\n[Input]\\nMy name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest.\\nMy tragic story was immortalized by Shakespeare in a play.\\n[Output]\\n{\\n \\\"topics\\\": [\\n \\\"Macbeth\\\",\\n \\\"King of Scotland\\\",\\n \\\"Lady Macbeth\\\",\\n \\\"Dog\\\",\\n \\\"Toby McDuff\\\",\\n \\\"Shakespeare\\\",\\n \\\"Play\\\",\\n \\\"Tragedy\\\"\\n ]\\n}\\n+++++\\n[Input]\\nJane: I think we're almost there. Let me check.\\nJane: I have some bad news, we're only half way there.\\nJohn: Oh no, I'm not sure I can keep going. I'm getting tired.\\nJane: I'm getting tired too.\\nJohn: Maybe there is a large piece of text we can use to generate a long conversation.\\nJane: That's a good idea. Let me see if I can find one. Maybe Lorem Ipsum?\\nJohn: Yeah, that's a good idea.\\nJane: I found a Lorem Ipsum generator.\\nJane: Here's a 4096 character Lorem Ipsum text:\\nJane: Lorem ipsum dolor sit amet, con\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, nunc sit amet aliquam\\nJane: Darn, it's just repeating stuf now.\\nJohn: I think we're done.\\nJane: We're not though! We need like 1500 more characters.\\nJohn: Oh Cananda, our home and native land.\\nJane: True patriot love in all thy sons command.\\nJohn: With glowing hearts we see thee rise.\\nJane: The True North strong and free.\\nJohn: From far and wide, O Canada, we stand on guard for thee.\\nJane: God keep our land glorious and free.\\nJohn: O Canada, we stand on guard for thee.\\nJane: O Canada, we stand on guard for thee.\\nJane: That was fun, thank you. Let me check now.\\nJane: I think we need about 600 more characters.\\nJohn: Oh say can you see?\\nJane: By the dawn's early light.\\nJohn: What so proudly we hailed.\\nJane: At the twilight's last gleaming.\\nJohn: Whose broad stripes and bright stars.\\nJane: Through the perilous fight.\\nJohn: O'er the ramparts we watched.\\nJane: Were so gallantly streaming.\\nJohn: And the rockets' red glare.\\nJane: The bombs bursting in air.\\nJohn: Gave proof through the night.\\nJane: That our flag was still there.\\nJohn: Oh say does that star-spangled banner yet wave.\\nJane: O'er the land of the free.\\nJohn: And the home of the brave.\\nJane: Are you a Seattle Kraken Fan?\\nJohn: Yes, I am. I love going to the games.\\nJane: I'm a Seattle Kraken Fan too. Who is your favorite player?\\nJohn: I like watching all the players, but I think my favorite is Matty Beniers.\\nJane: Yeah, he's a great player. I like watching him too. I also like watching Jaden Schwartz.\\nJohn: Adam Larsson is another good one. The big cat!\\nJane: WE MADE IT! It's long enough. Thank you!\\nJohn: Can you automate generating long text next time?\\nJane: I will.\\nJohn: You're welcome. I'm glad we could help. Goodbye!\\nJane: Goodbye!\\n[Output]\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252990,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"18733ff5-6af1-4bfc-98b9-a6e7cc1a5005\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":947,\"completion_tokens\":56,\"total_tokens\":1003}}",
"headers": {},
"status": 200
},
"uuid": "a29ad1f1-2423-4dbf-a127-fd2c93998fcd"
}
@@ -1,23 +0,0 @@
{
"id": "fb3fd96e-de60-4e75-b551-493819766937",
"insertionIndex": 33,
"name": "deployments_text-davinci-003_completions",
"persistent": true,
"request": {
"bodyPatterns": [
{
"equalToJson": "{\"prompt\":[\"BEGIN CONTENT TO SUMMARIZE:\\nJohn: Hello, how are you?\\nJane: I'm fine, thanks. How are you?\\nJohn: I'm doing well, writing some example code.\\nJane: That's great! I'm writing some example code too.\\nJohn: What are you writing?\\nJane: I'm writing a chatbot.\\nJohn: That's cool. I'm writing a chatbot too.\\nJane: What language are you writing it in?\\nJohn: I'm writing it in C#.\\nJane: I'm writing it in Python.\\nJohn: That's cool. I need to learn Python.\\nJane: I need to learn C#.\\nJohn: Can I try out your chatbot?\\nJane: Sure, here's the link.\\nJohn: Thanks!\\nJane: You're welcome.\\nJane: Look at this poem my chatbot wrote:\\nJane: Roses are red\\nJane: Violets are blue\\nJane: I'm writing a chatbot\\nJane: What about you?\\nJohn: That's cool. Let me see if mine will write a poem, too.\\nJohn: Here's a poem my chatbot wrote:\\nJohn: The singularity of the universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Looks like I need to improve mine, oh well.\\nJane: You might want to try using a different model.\\nJane: I'm using the GPT-3 model.\\nJohn: I'm using the GPT-2 model. That makes sense.\\nJohn: Here is a new poem after updating the model.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: The universe is a mystery.\\nJohn: Yikes, it's really stuck isn't it. Would you help me debug my code?\\nJane: Sure, what's the problem?\\nJohn: I'm not sure. I think it's a bug in the code.\\nJane: I'll take a look.\\nJane: I think I found the problem.\\nJane: It looks like you're not passing the right parameters to the model.\\nJohn: Thanks for the help!\\nJane: I'm now writing a bot to summarize conversations. I want to make sure it works when the conversation is long.\\nJohn: So you need to keep talking with me to generate a long conversation?\\nJane: Yes, that's right.\\nJohn: Ok, I'll keep talking. What should we talk about?\\nJane: I don't know, what do you want to talk about?\\nJohn: I don't know, it's nice how CoPilot is doing most of the talking for us. But it definitely gets stuck sometimes.\\nJane: I agree, it's nice that CoPilot is doing most of the talking for us.\\nJane: But it definitely gets stuck sometimes.\\nJohn: Do you know how long it needs to be?\\nJane: I think the max length is 1024 tokens. Which is approximately 1024*4= 4096 characters.\\nJohn: That's a lot of characters.\\nJane: Yes, it is.\\nJohn: I'm not sure how much longer I can keep talking.\\n\\nEND CONTENT TO SUMMARIZE.\\n\\nSummarize the conversation in 'CONTENT TO SUMMARIZE', identifying main points of discussion and any conclusions that were reached.\\nDo not incorporate other general knowledge.\\nSummary is in plain text, in complete sentences, with no markup or tags.\\n\\nBEGIN SUMMARY:\\n\"],\"max_tokens\":1024,\"temperature\":0.1,\"top_p\":0.5,\"logit_bias\":{},\"user\":\"\",\"n\":1,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"best_of\":1,\"model\":\"text-davinci-003\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
],
"method": "POST",
"url": "//openai/deployments/text-davinci-003/completions?api-version=2023-12-01-preview"
},
"response": {
"body": "{\"id\":\"cmpl-xxx\",\"object\":\"text_completion\",\"created\":1707252979,\"model\":\"text-davinci-003\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"choices\":[{\"text\":\"daed202a-7933-40ce-941a-4f17954f3e8d\",\"index\":0,\"finish_reason\":\"stop\",\"logprobs\":null,\"content_filter_results\":{\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"usage\":{\"prompt_tokens\":771,\"completion_tokens\":91,\"total_tokens\":862}}",
"headers": {},
"status": 200
},
"uuid": "fb3fd96e-de60-4e75-b551-493819766937"
}
@@ -0,0 +1,169 @@
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.samples.syntaxexamples.java;
import com.azure.ai.openai.OpenAIAsyncClient;
import com.azure.ai.openai.OpenAIClientBuilder;
import com.azure.core.credential.AzureKeyCredential;
import com.azure.core.credential.KeyCredential;
import com.microsoft.semantickernel.Kernel;
import com.microsoft.semantickernel.exceptions.ConfigurationException;
import com.microsoft.semantickernel.orchestration.ToolCallBehavior;
import com.microsoft.semantickernel.plugin.KernelPlugin;
import com.microsoft.semantickernel.plugin.KernelPluginFactory;
import com.microsoft.semantickernel.samples.plugins.ConversationSummaryPlugin;
import com.microsoft.semantickernel.semanticfunctions.KernelFunctionArguments;
import com.microsoft.semantickernel.semanticfunctions.KernelFunctionFromPrompt;
import com.microsoft.semantickernel.services.chatcompletion.AuthorRole;
import com.microsoft.semantickernel.services.chatcompletion.ChatCompletionService;
import com.microsoft.semantickernel.services.chatcompletion.ChatHistory;
import com.microsoft.semantickernel.services.chatcompletion.ChatMessageContent;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class FunctionsWithinPrompts_Example {
private static final String CLIENT_KEY = System.getenv("CLIENT_KEY");
private static final String AZURE_CLIENT_KEY = System.getenv("AZURE_CLIENT_KEY");
// Only required if AZURE_CLIENT_KEY is set
private static final String CLIENT_ENDPOINT = System.getenv("CLIENT_ENDPOINT");
private static final String MODEL_ID = System.getenv()
.getOrDefault("MODEL_ID", "gpt-35-turbo-2");
public static InputStream INPUT = System.in;
public static void main(String[] args) throws ConfigurationException, IOException {
OpenAIAsyncClient client;
if (AZURE_CLIENT_KEY != null) {
client = new OpenAIClientBuilder()
.credential(new AzureKeyCredential(AZURE_CLIENT_KEY))
.endpoint(CLIENT_ENDPOINT)
.buildAsyncClient();
} else {
client = new OpenAIClientBuilder()
.credential(new KeyCredential(CLIENT_KEY))
.buildAsyncClient();
}
ChatCompletionService chatCompletionService = ChatCompletionService.builder()
.withOpenAIAsyncClient(client)
.withModelId(MODEL_ID)
.build();
KernelPlugin plugin = KernelPluginFactory.createFromObject(
new ConversationSummaryPlugin(), "ConversationSummaryPlugin");
Kernel kernel = Kernel.builder()
.withAIService(ChatCompletionService.class, chatCompletionService)
.withPlugin(plugin)
.build();
List<String> choices = Arrays.asList("ContinueConversation", "EndConversation");
// Create few-shot examples
List<ChatHistory> fewShotExamples = Arrays.asList(
new ChatHistory(
Arrays.asList(
new ChatMessageContent<String>(AuthorRole.USER,
"Can you send a very quick approval to the marketing team?"),
new ChatMessageContent<String>(AuthorRole.SYSTEM, "Intent:"),
new ChatMessageContent<String>(AuthorRole.ASSISTANT,
"ContinueConversation"))),
new ChatHistory(
Arrays.asList(
new ChatMessageContent<String>(AuthorRole.USER,
"Can you send the full update to the marketing team?"),
new ChatMessageContent<String>(AuthorRole.SYSTEM, "Intent:"),
new ChatMessageContent<String>(AuthorRole.ASSISTANT, "EndConversation"))));
// Create handlebars template for intent
// <IntentFunction>
var getIntent = KernelFunctionFromPrompt
.<String>createFromPrompt(
"""
<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}}
{{ConversationSummaryPlugin-SummarizeConversation history}}
<message role="user">{{request}}</message>
<message role="system">Intent:</message>
"""
.stripIndent())
.withTemplateFormat("handlebars")
.build();
// </IntentFunction>
// Create a Semantic Kernel template for chat
// <FunctionFromPrompt>
var chat = KernelFunctionFromPrompt.<String>createFromPrompt("""
{{ConversationSummaryPlugin.SummarizeConversation $history}}
User: {{$request}}
Assistant:
""".stripIndent()).build();
// </FunctionFromPrompt>
Scanner scanner = new Scanner(INPUT);
ChatHistory history = new ChatHistory();
// Start the chat loop
while (true) {
// Get user input
System.out.println("User > ");
var request = scanner.nextLine();
// Invoke handlebars prompt
var intent = kernel.invokeAsync(getIntent)
.withArguments(
KernelFunctionArguments.builder()
.withVariable("request", request)
.withVariable("choices", choices)
.withVariable("history", history)
.withVariable("fewShotExamples", fewShotExamples)
.build())
.withToolCallBehavior(
new ToolCallBehavior()
.enableKernelFunctions(true)
.enableFunction(plugin.get("SummarizeConversation"), true))
.block();
// End the chat if the intent is "Stop"
if ("EndConversation".equalsIgnoreCase(intent.getResult())) {
break;
}
// Get chat response
var chatResult = kernel.invokeAsync(chat)
.withArguments(
KernelFunctionArguments.builder()
.withVariable("request", request)
.withVariable("history", history.getMessages().stream()
.map(it -> it.getAuthorRole() + ": " + it.getContent())
.collect(Collectors.joining("\n")))
.build())
.block();
String message = chatResult.getResult();
System.out.println("Assistant: " + message);
System.out.println();
// Append to history
history.addUserMessage(request);
history.addAssistantMessage(message);
}
}
}
@@ -4,6 +4,7 @@ package com.microsoft.semantickernel.contextvariables;
import com.microsoft.semantickernel.contextvariables.converters.BooleanVariableContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.CharacterVariableContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.ChatHistoryVariableContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.CollectionVariableContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.CompletionUsageContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.DateTimeContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.converters.InstantContextVariableTypeConverter;
@@ -32,6 +33,7 @@ public class ContextVariableTypes {
new ChatHistoryVariableContextVariableTypeConverter(),
new TextContentVariableContextVariableTypeConverter(),
new StringVariableContextVariableTypeConverter(),
new CollectionVariableContextVariableTypeConverter(),
new VoidVariableContextVariableTypeConverter(),
new ContextVariableTypeConverter<>(void.class, s -> null, s -> null, s -> null),
new DateTimeContextVariableTypeConverter(),
@@ -0,0 +1,46 @@
// Copyright (c) Microsoft. All rights reserved.
package com.microsoft.semantickernel.contextvariables.converters;
import static com.microsoft.semantickernel.contextvariables.ContextVariableTypes.convert;
import com.microsoft.semantickernel.contextvariables.ContextVariable;
import com.microsoft.semantickernel.contextvariables.ContextVariableTypeConverter;
import com.microsoft.semantickernel.contextvariables.ContextVariableTypes;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* A {@link ContextVariableTypeConverter} for {@code java.util.Collection} variables. Use
* {@code ContextVariableTypes.getGlobalVariableTypeForClass(String.class)} to get an instance of
* this class.
*
* @see ContextVariableTypes#getGlobalVariableTypeForClass(Class)
*/
public class CollectionVariableContextVariableTypeConverter extends
ContextVariableTypeConverter<Collection> {
/**
* Creates a new instance of the {@link CollectionVariableContextVariableTypeConverter} class.
*/
public CollectionVariableContextVariableTypeConverter() {
super(
Collection.class,
s -> convert(s, Collection.class),
CollectionVariableContextVariableTypeConverter::getString,
s -> {
throw new UnsupportedOperationException();
});
}
private static String getString(Collection<?> c) {
return c.stream()
.map(t -> {
if (t instanceof ContextVariable) {
return ((ContextVariable<?>) t).toPromptString();
} else {
return t.toString();
}
})
.collect(Collectors.joining(","));
}
}
@@ -42,7 +42,7 @@ public class ToolCallBehavior {
enabledFunctions.addAll(toolCallBehavior.enabledFunctions);
}
static String getKey(@Nullable String pluginName, String functionName) {
public static String formFullFunctionName(@Nullable String pluginName, String functionName) {
if (pluginName == null) {
pluginName = "";
}
@@ -109,7 +109,7 @@ public class ToolCallBehavior {
*/
public ToolCallBehavior enableFunction(KernelFunction<?> function, boolean enable) {
if (function != null) {
String key = getKey(function.getPluginName(), function.getName());
String key = formFullFunctionName(function.getPluginName(), function.getName());
if (enable) {
enabledFunctions.add(key);
} else {
@@ -165,7 +165,7 @@ public class ToolCallBehavior {
* @return Whether the function is enabled.
*/
public boolean functionEnabled(@Nullable String pluginName, String functionName) {
String key = getKey(pluginName, functionName);
String key = formFullFunctionName(pluginName, functionName);
return enabledFunctions.contains(key);
}
@@ -3,16 +3,19 @@ package com.microsoft.semantickernel.templateengine.handlebars;
import com.github.jknack.handlebars.Context;
import com.github.jknack.handlebars.Handlebars;
import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;
import com.github.jknack.handlebars.ValueResolver;
import com.microsoft.semantickernel.Kernel;
import com.microsoft.semantickernel.contextvariables.ContextVariable;
import com.microsoft.semantickernel.contextvariables.ContextVariableType;
import com.microsoft.semantickernel.contextvariables.ContextVariableTypes;
import com.microsoft.semantickernel.exceptions.SKException;
import com.microsoft.semantickernel.orchestration.InvocationContext;
import com.microsoft.semantickernel.orchestration.ToolCallBehavior;
import com.microsoft.semantickernel.plugin.KernelPlugin;
import com.microsoft.semantickernel.semanticfunctions.KernelFunction;
import com.microsoft.semantickernel.semanticfunctions.KernelFunctionArguments;
import com.microsoft.semantickernel.semanticfunctions.KernelParameterMetadata;
import com.microsoft.semantickernel.semanticfunctions.PromptTemplate;
import com.microsoft.semantickernel.semanticfunctions.PromptTemplateConfig;
import com.microsoft.semantickernel.services.chatcompletion.ChatHistory;
@@ -20,7 +23,6 @@ import com.microsoft.semantickernel.services.chatcompletion.ChatMessageContent;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -61,6 +63,7 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
String.format("No prompt template was provided for the prompt %s.",
promptTemplate.getName())));
}
HandleBarsPromptTemplateHandler handler = new HandleBarsPromptTemplateHandler(kernel,
template);
@@ -106,34 +109,6 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
}
}
private static class KernelPluginResolver implements ValueResolver {
@Override
public Object resolve(Object context, String name) {
if (context instanceof KernelFunction) {
KernelFunction<?> function = (KernelFunction<?>) context;
if ("pluginname".equalsIgnoreCase(name)) {
if (function.getPluginName() != null) {
return function.getPluginName();
}
} else if ("name".equalsIgnoreCase(name)) {
return function.getName();
}
}
return UNRESOLVED;
}
@Override
public Object resolve(Object context) {
return UNRESOLVED;
}
@Override
public Set<Entry<String, Object>> propertySet(Object context) {
return new HashSet<>();
}
}
private static class ContextVariableResolver implements ValueResolver {
@Override
@@ -183,48 +158,20 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
private final Handlebars handlebars;
@SuppressFBWarnings("CT_CONSTRUCTOR_THROW") // Think this is a false positive
public HandleBarsPromptTemplateHandler(Kernel kernel, String template) {
public HandleBarsPromptTemplateHandler(
Kernel kernel,
String template) {
this.template = template;
this.handlebars = new Handlebars();
this.handlebars
.registerHelper("message", HandleBarsPromptTemplateHandler::handleMessage)
.registerHelper("each", HandleBarsPromptTemplateHandler::handleEach)
.registerHelper("functions", (context, options) -> handleFunctions(kernel, options))
.registerHelper("function",
(context, options) -> handleFunction((KernelFunction<?>) context));
.registerHelper("each", HandleBarsPromptTemplateHandler::handleEach);
addFunctionHelpers(kernel, this.handlebars);
// TODO: 1.0 Add more helpers
}
private static Handlebars.SafeString handleFunction(KernelFunction<?> context) {
KernelFunction<?> function = context;
String pluginName = function.getPluginName();
String functionName = function.getName();
String description = function.getDescription();
StringBuilder sb = new StringBuilder(
String.format(
"<function pluginName=\"%s\" name=\"%s\" description=\"%s\">",
pluginName, functionName, description));
List<KernelParameterMetadata<?>> parameters = function.getMetadata().getParameters();
parameters.forEach(p -> {
sb.append(String.format(
"<parameter name=\"%s\" description=\"%s\" defaultValue=\"%s\" isRequired=\"%s\" type=\"%s\"/>",
p.getName(), p.getDescription(), p.getDefaultValue(), p.isRequired(),
p.getType()));
});
sb.append("</function>");
return new Handlebars.SafeString(sb.toString());
}
private static Handlebars.SafeString handleFunctions(Kernel kernel, Options options)
throws IOException {
StringBuilder sb = new StringBuilder("<functions>");
Collection<KernelPlugin> plugins = kernel.getPlugins();
sb.append(options.fn(plugins));
sb.append("</functions>");
return new Handlebars.SafeString(sb.toString());
}
private static CharSequence handleEach(Object context, Options options)
throws IOException {
if (context instanceof ChatHistory) {
@@ -247,6 +194,8 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
KernelFunction<?> function = functions.next();
sb.append(options.fn(function));
}
} else {
sb.append(options.fn(element));
}
}
return new Handlebars.SafeString(sb.toString());
@@ -282,7 +231,6 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
try {
ArrayList<ValueResolver> resolvers = new ArrayList<>();
resolvers.add(new MessageResolver());
resolvers.add(new KernelPluginResolver());
resolvers.add(new ContextVariableResolver());
// resolvers.addAll(ValueResolver.defaultValueResolvers());
@@ -299,4 +247,44 @@ public class HandlebarsPromptTemplate implements PromptTemplate {
}
}
}
@SuppressWarnings("StringSplitter")
private static void addFunctionHelpers(Kernel kernel, Handlebars handlebars) {
kernel
.getPlugins()
.forEach(plugin -> {
plugin
.iterator()
.forEachRemaining(kernelFunction -> {
String functionName = kernelFunction.getName();
String pluginName = plugin.getName();
handlebars.registerHelper(
ToolCallBehavior.formFullFunctionName(pluginName, functionName),
functionInvokeHelper(kernel, kernelFunction));
});
});
}
private static Helper<Object> functionInvokeHelper(Kernel kernel,
KernelFunction<?> kernelFunction) {
return (context, options) -> {
ContextVariableType converter = ContextVariableTypes
.getGlobalVariableTypeForClass(
context.getClass());
String promptString = converter.getConverter().toPromptString(context);
// TODO Figure out if possible to do async render
return kernelFunction
.invokeAsync(kernel)
.withArguments(
KernelFunctionArguments.builder()
.withInput(promptString)
.build())
.block()
.getResult();
};
}
}