diff --git a/java/README.md b/java/README.md index e3834b0e1c..190eb7f26f 100644 --- a/java/README.md +++ b/java/README.md @@ -16,7 +16,7 @@ and frameworks. ## Quickstart To get an idea of how to use the Semantic Kernel for Java, you can check -the [syntax examples](samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples) folder for +the [syntax-examples](samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples) folder for examples of common AI-enabled scenarios. ## Get started diff --git a/java/api-test/integration-tests/pom.xml b/java/api-test/integration-tests/pom.xml index 00a7c44e58..277d200365 100644 --- a/java/api-test/integration-tests/pom.xml +++ b/java/api-test/integration-tests/pom.xml @@ -17,7 +17,7 @@ com.microsoft.semantic-kernel - semantickernel-sample-code + semantickernel-syntax-examples ${project.version} test diff --git a/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/Example03_ArgumentsTest.java b/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/Example03_ArgumentsTest.java index de86e82f8c..ac1821246a 100644 --- a/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/Example03_ArgumentsTest.java +++ b/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/Example03_ArgumentsTest.java @@ -5,7 +5,7 @@ import com.microsoft.semantickernel.Kernel; import com.microsoft.semantickernel.orchestration.FunctionResult; import com.microsoft.semantickernel.plugin.KernelPlugin; import com.microsoft.semantickernel.plugin.KernelPluginFactory; -import com.microsoft.semantickernel.samples.syntaxexamples.Example03_Arguments.StaticTextPlugin; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example03_Arguments.StaticTextPlugin; import com.microsoft.semantickernel.semanticfunctions.KernelFunctionArguments; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/WiremockExamplesIT.java b/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/WiremockExamplesIT.java index 65b55900ce..0eeabc135f 100644 --- a/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/WiremockExamplesIT.java +++ b/java/api-test/integration-tests/src/test/java/com/microsoft/semantickernel/tests/WiremockExamplesIT.java @@ -3,30 +3,25 @@ package com.microsoft.semantickernel.tests; import com.github.tomakehurst.wiremock.WireMockServer; import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import com.microsoft.semantickernel.samples.syntaxexamples.Example01_NativeFunctions; -import com.microsoft.semantickernel.samples.syntaxexamples.Example03_Arguments; -import com.microsoft.semantickernel.samples.syntaxexamples.Example05_InlineFunctionDefinition; -import com.microsoft.semantickernel.samples.syntaxexamples.Example06_TemplateLanguage; -import com.microsoft.semantickernel.samples.syntaxexamples.Example09_FunctionTypes; -import com.microsoft.semantickernel.samples.syntaxexamples.Example10_DescribeAllPluginsAndFunctions; -import com.microsoft.semantickernel.samples.syntaxexamples.Example13_ConversationSummaryPlugin; -import com.microsoft.semantickernel.samples.syntaxexamples.Example17_ChatGPT; -import com.microsoft.semantickernel.samples.syntaxexamples.Example27_PromptFunctionsUsingChatGPT; -import com.microsoft.semantickernel.samples.syntaxexamples.Example33_Chat; -import com.microsoft.semantickernel.samples.syntaxexamples.Example41_HttpClientUsage; import com.microsoft.semantickernel.samples.syntaxexamples.Example43_GetModelResult; -import com.microsoft.semantickernel.samples.syntaxexamples.Example44_MultiChatCompletion; import com.microsoft.semantickernel.samples.syntaxexamples.Example49_LogitBias; import com.microsoft.semantickernel.samples.syntaxexamples.Example55_TextChunker; -import com.microsoft.semantickernel.samples.syntaxexamples.Example56_TemplateMethodFunctionsWithMultipleArguments; import com.microsoft.semantickernel.samples.syntaxexamples.Example57_KernelHooks; -import com.microsoft.semantickernel.samples.syntaxexamples.Example58_ConfigureExecutionSettings; -import com.microsoft.semantickernel.samples.syntaxexamples.Example60_AdvancedMethodFunctions; import com.microsoft.semantickernel.samples.syntaxexamples.Example61_MultipleLLMs; import com.microsoft.semantickernel.samples.syntaxexamples.Example62_CustomAIServiceSelector; -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.chatcompletion.Example17_ChatGPT; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example33_Chat; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example44_MultiChatCompletion; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example63_ChatCompletionPrompts; +import com.microsoft.semantickernel.samples.syntaxexamples.configuration.Example41_HttpClientUsage; +import com.microsoft.semantickernel.samples.syntaxexamples.configuration.Example58_ConfigureExecutionSettings; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example01_NativeFunctions; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example03_Arguments; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example05_InlineFunctionDefinition; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example09_FunctionTypes; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example27_PromptFunctionsUsingChatGPT; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example60_AdvancedMethodFunctions; import com.microsoft.semantickernel.samples.syntaxexamples.java.FunctionsWithinPrompts_Example; import com.microsoft.semantickernel.samples.syntaxexamples.java.KernelFunctionYaml_Example; import java.io.IOException; @@ -37,6 +32,11 @@ import java.util.Arrays; import java.util.List; import java.util.Queue; import java.util.stream.Stream; +import com.microsoft.semantickernel.samples.syntaxexamples.plugins.Example10_DescribeAllPluginsAndFunctions; +import com.microsoft.semantickernel.samples.syntaxexamples.plugins.Example13_ConversationSummaryPlugin; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example06_TemplateLanguage; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example56_TemplateMethodFunctionsWithMultipleArguments; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example64_MultiplePromptTemplates; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.mockito.Mockito; diff --git a/java/samples/README.md b/java/samples/README.md new file mode 100644 index 0000000000..660690a871 --- /dev/null +++ b/java/samples/README.md @@ -0,0 +1,8 @@ +## Kernel Samples + +| Type | Description | +|-----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------| +| [semantickernel-demos](semantickernel-demos) | Look here to find a sample which demonstrate how to use many of Semantic Kernel features. | +| [semantickernel-learn-resources](semantickernel-learn-resources) | Code snippets that are related to online documentation sources like Microsoft Learn, DevBlogs and others | +| [semantickernel-concepts](semantickernel-concepts) | This section contains samples which illustrate how to use Semantic Kernel concepts. | +| [semantickernel-sample-plugins](semantickernel-sample-plugins) | This section contains samples which illustrate how to create Semantic Kernel plugins. | \ No newline at end of file diff --git a/java/samples/pom.xml b/java/samples/pom.xml index 94b326aef4..e27cb3f40b 100644 --- a/java/samples/pom.xml +++ b/java/samples/pom.xml @@ -15,9 +15,10 @@ Parent pom for sample code for using the Semantic Kernel project - sample-code - semantickernel-openapi-plugin - booking-agent-m365 + semantickernel-concepts + semantickernel-demos + semantickernel-learn-resources + semantickernel-sample-plugins diff --git a/java/samples/semantickernel-concepts/pom.xml b/java/samples/semantickernel-concepts/pom.xml new file mode 100644 index 0000000000..1d2377cca9 --- /dev/null +++ b/java/samples/semantickernel-concepts/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.microsoft.semantic-kernel + semantickernel-samples-parent + 1.0.3-SNAPSHOT + ../pom.xml + + + semantickernel-concepts + 1.0.3-SNAPSHOT + pom + semantickernel-concepts + + + semantickernel-syntax-examples + + diff --git a/java/samples/sample-code/README.md b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/README.md similarity index 100% rename from java/samples/sample-code/README.md rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/README.md diff --git a/java/samples/sample-code/pom.xml b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/pom.xml similarity index 97% rename from java/samples/sample-code/pom.xml rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/pom.xml index 6ed7a76456..95430de75e 100644 --- a/java/samples/sample-code/pom.xml +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/pom.xml @@ -3,12 +3,12 @@ 4.0.0 com.microsoft.semantic-kernel - semantickernel-samples-parent + semantickernel-concepts 1.0.3-SNAPSHOT ../pom.xml - semantickernel-sample-code + semantickernel-syntax-examples Semantic Kernel Samples Sample code for using the Semantic Kernel project jar diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/connectors/web/bing/BingConnector.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/connectors/web/bing/BingConnector.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/connectors/web/bing/BingConnector.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/connectors/web/bing/BingConnector.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/TimePlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/TimePlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/TimePlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/TimePlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/text/TextPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/text/TextPlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/text/TextPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/text/TextPlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/web/SearchUrlPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/web/SearchUrlPlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/web/SearchUrlPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/web/SearchUrlPlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/web/WebSearchEnginePlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/web/WebSearchEnginePlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/plugins/web/WebSearchEnginePlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/plugins/web/WebSearchEnginePlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example11_WebSearchQueries.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example11_WebSearchQueries.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example11_WebSearchQueries.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example11_WebSearchQueries.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example42_KernelBuilder.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example42_KernelBuilder.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example42_KernelBuilder.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example42_KernelBuilder.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example43_GetModelResult.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example43_GetModelResult.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example43_GetModelResult.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example43_GetModelResult.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example49_LogitBias.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example49_LogitBias.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example49_LogitBias.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example49_LogitBias.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example55_TextChunker.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example55_TextChunker.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example55_TextChunker.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example55_TextChunker.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example57_KernelHooks.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example57_KernelHooks.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example57_KernelHooks.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example57_KernelHooks.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example61_MultipleLLMs.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example61_MultipleLLMs.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example61_MultipleLLMs.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example61_MultipleLLMs.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example62_CustomAIServiceSelector.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example62_CustomAIServiceSelector.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example62_CustomAIServiceSelector.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example62_CustomAIServiceSelector.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example67_KernelStreaming.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example67_KernelStreaming.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example67_KernelStreaming.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example67_KernelStreaming.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example69_MutableKernelPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example69_MutableKernelPlugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example69_MutableKernelPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example69_MutableKernelPlugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java similarity index 55% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java index 81b933f377..7341cf5278 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/RunAll.java @@ -1,6 +1,26 @@ // Copyright (c) Microsoft. All rights reserved. package com.microsoft.semantickernel.samples.syntaxexamples; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example17_ChatGPT; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example30_ChatWithPrompts; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example33_Chat; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example44_MultiChatCompletion; +import com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion.Example63_ChatCompletionPrompts; +import com.microsoft.semantickernel.samples.syntaxexamples.configuration.Example08_RetryHandler; +import com.microsoft.semantickernel.samples.syntaxexamples.configuration.Example41_HttpClientUsage; +import com.microsoft.semantickernel.samples.syntaxexamples.configuration.Example58_ConfigureExecutionSettings; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example01_NativeFunctions; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example03_Arguments; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example05_InlineFunctionDefinition; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example09_FunctionTypes; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example27_PromptFunctionsUsingChatGPT; +import com.microsoft.semantickernel.samples.syntaxexamples.functions.Example60_AdvancedMethodFunctions; +import com.microsoft.semantickernel.samples.syntaxexamples.plugins.Example10_DescribeAllPluginsAndFunctions; +import com.microsoft.semantickernel.samples.syntaxexamples.plugins.Example13_ConversationSummaryPlugin; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example06_TemplateLanguage; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example56_TemplateMethodFunctionsWithMultipleArguments; +import com.microsoft.semantickernel.samples.syntaxexamples.template.Example64_MultiplePromptTemplates; + import java.util.Arrays; import java.util.List; import java.util.Scanner; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example82_Audio.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/audio/Example82_Audio.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example82_Audio.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/audio/Example82_Audio.java index 7b07f15ecb..e41a9a9757 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example82_Audio.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/audio/Example82_Audio.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.audio; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example17_ChatGPT.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example17_ChatGPT.java similarity index 97% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example17_ChatGPT.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example17_ChatGPT.java index 16b701ef6d..6bdcd6e61d 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example17_ChatGPT.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example17_ChatGPT.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example30_ChatWithPrompts.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example30_ChatWithPrompts.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example30_ChatWithPrompts.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example30_ChatWithPrompts.java index e16c015310..3a7b7dcdad 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example30_ChatWithPrompts.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example30_ChatWithPrompts.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example33_Chat.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example33_Chat.java similarity index 97% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example33_Chat.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example33_Chat.java index 0d498ed2a5..ec1c243223 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example33_Chat.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example33_Chat.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example44_MultiChatCompletion.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example44_MultiChatCompletion.java similarity index 97% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example44_MultiChatCompletion.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example44_MultiChatCompletion.java index 5384291eee..52cec6e36b 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example44_MultiChatCompletion.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example44_MultiChatCompletion.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example63_ChatCompletionPrompts.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example63_ChatCompletionPrompts.java similarity index 97% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example63_ChatCompletionPrompts.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example63_ChatCompletionPrompts.java index 89006440da..166f156528 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example63_ChatCompletionPrompts.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/chatcompletion/Example63_ChatCompletionPrompts.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.chatcompletion; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example08_RetryHandler.java similarity index 96% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example08_RetryHandler.java index 2a2c77c8ab..37a490e65f 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example08_RetryHandler.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example08_RetryHandler.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.configuration; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example26_AADAuth.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example26_AADAuth.java similarity index 95% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example26_AADAuth.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example26_AADAuth.java index 59c607308e..3466265717 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example26_AADAuth.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example26_AADAuth.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.configuration; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example41_HttpClientUsage.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example41_HttpClientUsage.java similarity index 96% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example41_HttpClientUsage.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example41_HttpClientUsage.java index 30ddafb77e..bc7c218cf0 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example41_HttpClientUsage.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example41_HttpClientUsage.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.configuration; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example58_ConfigureExecutionSettings.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example58_ConfigureExecutionSettings.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example58_ConfigureExecutionSettings.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example58_ConfigureExecutionSettings.java index 609e06b75a..f6096eb491 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example58_ConfigureExecutionSettings.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/configuration/Example58_ConfigureExecutionSettings.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.configuration; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example01_NativeFunctions.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example01_NativeFunctions.java similarity index 86% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example01_NativeFunctions.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example01_NativeFunctions.java index 01baafccdb..1e3701e711 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example01_NativeFunctions.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example01_NativeFunctions.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.microsoft.semantickernel.samples.plugins.text.TextPlugin; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example03_Arguments.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example03_Arguments.java similarity index 96% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example03_Arguments.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example03_Arguments.java index dbca6fd24e..2096386dda 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example03_Arguments.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example03_Arguments.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.microsoft.semantickernel.Kernel; import com.microsoft.semantickernel.orchestration.FunctionResult; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example05_InlineFunctionDefinition.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example05_InlineFunctionDefinition.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example05_InlineFunctionDefinition.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example05_InlineFunctionDefinition.java index bce940b69a..7aa6e18b1d 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example05_InlineFunctionDefinition.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example05_InlineFunctionDefinition.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example09_FunctionTypes.java similarity index 99% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example09_FunctionTypes.java index 53a44f7854..d0a7849498 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example09_FunctionTypes.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example09_FunctionTypes.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import static com.microsoft.semantickernel.contextvariables.ContextVariableTypes.convert; @@ -72,7 +72,8 @@ public class Example09_FunctionTypes { KernelPlugin summarize = KernelPluginFactory .importPluginFromDirectory( - Path.of(PLUGIN_DIR, "java/samples/sample-code/src/main/resources/Plugins"), + Path.of(PLUGIN_DIR, + "java/samples/semantickernel-syntax-examples/src/main/resources/Plugins"), "SummarizePlugin", null); diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example27_PromptFunctionsUsingChatGPT.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example27_PromptFunctionsUsingChatGPT.java similarity index 97% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example27_PromptFunctionsUsingChatGPT.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example27_PromptFunctionsUsingChatGPT.java index f126aca804..0dae3c7e1b 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example27_PromptFunctionsUsingChatGPT.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example27_PromptFunctionsUsingChatGPT.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example59_OpenAIFunctionCalling.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example59_OpenAIFunctionCalling.java similarity index 99% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example59_OpenAIFunctionCalling.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example59_OpenAIFunctionCalling.java index f3cff9c595..7f769b9219 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example59_OpenAIFunctionCalling.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example59_OpenAIFunctionCalling.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example60_AdvancedMethodFunctions.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example60_AdvancedMethodFunctions.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example60_AdvancedMethodFunctions.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example60_AdvancedMethodFunctions.java index c7324bedb7..618790d0b2 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example60_AdvancedMethodFunctions.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/functions/Example60_AdvancedMethodFunctions.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.functions; import com.microsoft.semantickernel.Kernel; import com.microsoft.semantickernel.contextvariables.ContextVariableTypeConverter; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsHandlebars_Example.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsHandlebars_Example.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsHandlebars_Example.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsHandlebars_Example.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsWithinPrompts_Example.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsWithinPrompts_Example.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsWithinPrompts_Example.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/FunctionsWithinPrompts_Example.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/KernelFunctionYaml_Example.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/KernelFunctionYaml_Example.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/KernelFunctionYaml_Example.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/java/KernelFunctionYaml_Example.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example07_BingAndGooglePlugins.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example07_BingAndGooglePlugins.java similarity index 99% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example07_BingAndGooglePlugins.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example07_BingAndGooglePlugins.java index 0f7b6c8413..6db7deb7bf 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example07_BingAndGooglePlugins.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example07_BingAndGooglePlugins.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.plugins; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example10_DescribeAllPluginsAndFunctions.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example10_DescribeAllPluginsAndFunctions.java similarity index 96% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example10_DescribeAllPluginsAndFunctions.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example10_DescribeAllPluginsAndFunctions.java index 2781b2401b..7ab9e1f15c 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example10_DescribeAllPluginsAndFunctions.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example10_DescribeAllPluginsAndFunctions.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.plugins; import java.nio.file.Path; import java.util.Locale; @@ -73,7 +73,8 @@ public class Example10_DescribeAllPluginsAndFunctions { kernelBuilder.withPlugin( KernelPluginFactory .importPluginFromDirectory( - Path.of(PLUGIN_DIR, "java/samples/sample-code/src/main/resources/Plugins"), + Path.of(PLUGIN_DIR, + "java/samples/semantickernel-syntax-examples/src/main/resources/Plugins"), "SummarizePlugin", null)); diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example13_ConversationSummaryPlugin.java similarity index 99% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example13_ConversationSummaryPlugin.java index db1c1a1ec7..eeff25c84e 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example13_ConversationSummaryPlugin.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/plugins/Example13_ConversationSummaryPlugin.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.plugins; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example06_TemplateLanguage.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example06_TemplateLanguage.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example06_TemplateLanguage.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example06_TemplateLanguage.java index 0761779086..86e61d5136 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example06_TemplateLanguage.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example06_TemplateLanguage.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.template; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example56_TemplateMethodFunctionsWithMultipleArguments.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example56_TemplateMethodFunctionsWithMultipleArguments.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example56_TemplateMethodFunctionsWithMultipleArguments.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example56_TemplateMethodFunctionsWithMultipleArguments.java index f1854ebf60..dc663d2d10 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example56_TemplateMethodFunctionsWithMultipleArguments.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example56_TemplateMethodFunctionsWithMultipleArguments.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.template; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example64_MultiplePromptTemplates.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example64_MultiplePromptTemplates.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example64_MultiplePromptTemplates.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example64_MultiplePromptTemplates.java index 28fe19d821..ae534e70f0 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/Example64_MultiplePromptTemplates.java +++ b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/syntaxexamples/template/Example64_MultiplePromptTemplates.java @@ -1,5 +1,5 @@ // Copyright (c) Microsoft. All rights reserved. -package com.microsoft.semantickernel.samples.syntaxexamples; +package com.microsoft.semantickernel.samples.syntaxexamples.template; import com.azure.ai.openai.OpenAIAsyncClient; import com.azure.ai.openai.OpenAIClientBuilder; diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/util/LocaleParser.java b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/util/LocaleParser.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/util/LocaleParser.java rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/java/com/microsoft/semantickernel/samples/util/LocaleParser.java diff --git a/java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionRoot/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/ExamplePlugins/ExampleFunctionWithService/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/Prompts/Chat/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/Chat/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/Prompts/Chat/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/Chat/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/Prompts/Chat/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/Chat/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/Prompts/Chat/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/Chat/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/Prompts/getIntent.prompt.yaml b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/getIntent.prompt.yaml similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/Prompts/getIntent.prompt.yaml rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/Prompts/getIntent.prompt.yaml diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/MakeAbstractReadable/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Notegen/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Notegen/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Notegen/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Notegen/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Notegen/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Notegen/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Notegen/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Notegen/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Summarize/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Summarize/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Summarize/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Summarize/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Summarize/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Summarize/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Summarize/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Summarize/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Topics/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Topics/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Topics/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Topics/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Topics/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Topics/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/SummarizePlugin/Topics/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/SummarizePlugin/Topics/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/Plugins/WriterPlugin/ShortPoem/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/WriterPlugin/ShortPoem/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/WriterPlugin/ShortPoem/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/WriterPlugin/ShortPoem/config.json diff --git a/java/samples/sample-code/src/main/resources/Plugins/WriterPlugin/ShortPoem/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/WriterPlugin/ShortPoem/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/Plugins/WriterPlugin/ShortPoem/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/Plugins/WriterPlugin/ShortPoem/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-system-prompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-system-prompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-system-prompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-system-prompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-context.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-context.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-context.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-context.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-prompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-prompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-prompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/30-user-prompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/config.json diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStory.yaml b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStory.yaml similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStory.yaml rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStory.yaml diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStoryHandlebars.yaml b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStoryHandlebars.yaml similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStoryHandlebars.yaml rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/java/GenerateStoryHandlebars.yaml diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/config.json diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/Answer/AnswerQuestion/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/config.json b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/config.json similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/config.json rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/config.json diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/Plugins/ExamplePlugins/ExampleFunction/skprompt.txt diff --git a/java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/require_context_variable_planner_prompt.txt b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/require_context_variable_planner_prompt.txt similarity index 100% rename from java/samples/sample-code/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/require_context_variable_planner_prompt.txt rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/com/microsoft/semantickernel/samples/syntaxexamples/javaspecific/require_context_variable_planner_prompt.txt diff --git a/java/samples/sample-code/src/main/resources/log4j2.xml b/java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/log4j2.xml similarity index 100% rename from java/samples/sample-code/src/main/resources/log4j2.xml rename to java/samples/semantickernel-concepts/semantickernel-syntax-examples/src/main/resources/log4j2.xml diff --git a/java/samples/booking-agent-m365/pom.xml b/java/samples/semantickernel-demos/booking-agent-m365/pom.xml similarity index 97% rename from java/samples/booking-agent-m365/pom.xml rename to java/samples/semantickernel-demos/booking-agent-m365/pom.xml index e71d3cddb7..909d3c0c6d 100644 --- a/java/samples/booking-agent-m365/pom.xml +++ b/java/samples/semantickernel-demos/booking-agent-m365/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.microsoft.semantic-kernel - semantickernel-samples-parent + semantickernel-demos 1.0.3-SNAPSHOT ../pom.xml diff --git a/java/samples/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingAgent.java b/java/samples/semantickernel-demos/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingAgent.java similarity index 100% rename from java/samples/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingAgent.java rename to java/samples/semantickernel-demos/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingAgent.java diff --git a/java/samples/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingPlugin.java b/java/samples/semantickernel-demos/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingPlugin.java similarity index 100% rename from java/samples/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingPlugin.java rename to java/samples/semantickernel-demos/booking-agent-m365/src/main/java/com/microsoft/semantickernel/BookingPlugin.java diff --git a/java/samples/booking-agent-m365/src/main/resources/log4j2.xml b/java/samples/semantickernel-demos/booking-agent-m365/src/main/resources/log4j2.xml similarity index 100% rename from java/samples/booking-agent-m365/src/main/resources/log4j2.xml rename to java/samples/semantickernel-demos/booking-agent-m365/src/main/resources/log4j2.xml diff --git a/java/samples/semantickernel-demos/pom.xml b/java/samples/semantickernel-demos/pom.xml new file mode 100644 index 0000000000..21284c2ca2 --- /dev/null +++ b/java/samples/semantickernel-demos/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.microsoft.semantic-kernel + semantickernel-samples-parent + 1.0.3-SNAPSHOT + ../pom.xml + + + semantickernel-demos + 1.0.3-SNAPSHOT + pom + semantic-kernel-demos + + + booking-agent-m365 + + diff --git a/java/samples/semantickernel-spring-starter/pom.xml b/java/samples/semantickernel-demos/semantickernel-spring-starter/pom.xml similarity index 100% rename from java/samples/semantickernel-spring-starter/pom.xml rename to java/samples/semantickernel-demos/semantickernel-spring-starter/pom.xml diff --git a/java/samples/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/AzureOpenAIConnectionProperties.java b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/AzureOpenAIConnectionProperties.java similarity index 100% rename from java/samples/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/AzureOpenAIConnectionProperties.java rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/AzureOpenAIConnectionProperties.java diff --git a/java/samples/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/SemanticKernelAutoConfiguration.java b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/SemanticKernelAutoConfiguration.java similarity index 100% rename from java/samples/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/SemanticKernelAutoConfiguration.java rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/java/com/microsoft/semantickernel/starter/SemanticKernelAutoConfiguration.java diff --git a/java/samples/semantickernel-spring-starter/src/main/resources/application.properties b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/resources/application.properties similarity index 100% rename from java/samples/semantickernel-spring-starter/src/main/resources/application.properties rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/main/resources/application.properties diff --git a/java/samples/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/AzureOpenAIConnectionPropertiesTest.java b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/AzureOpenAIConnectionPropertiesTest.java similarity index 100% rename from java/samples/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/AzureOpenAIConnectionPropertiesTest.java rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/AzureOpenAIConnectionPropertiesTest.java diff --git a/java/samples/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/SemanticKernelAutoConfigurationTest.java b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/SemanticKernelAutoConfigurationTest.java similarity index 100% rename from java/samples/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/SemanticKernelAutoConfigurationTest.java rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/java/com/microsoft/semantickernel/azureopenai/SemanticKernelAutoConfigurationTest.java diff --git a/java/samples/semantickernel-spring-starter/src/test/resources/application.properties b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/resources/application.properties similarity index 100% rename from java/samples/semantickernel-spring-starter/src/test/resources/application.properties rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/resources/application.properties diff --git a/java/samples/semantickernel-openapi-plugin/src/test/resources/log4j2.xml b/java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/resources/log4j2.xml similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/resources/log4j2.xml rename to java/samples/semantickernel-demos/semantickernel-spring-starter/src/test/resources/log4j2.xml diff --git a/java/samples/semantickernel-learn-resources/pom.xml b/java/samples/semantickernel-learn-resources/pom.xml new file mode 100644 index 0000000000..3a0d1e2bce --- /dev/null +++ b/java/samples/semantickernel-learn-resources/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.microsoft.semantic-kernel + semantickernel-samples-parent + 1.0.3-SNAPSHOT + ../pom.xml + + + semantickernel-learn-resources + jar + + + + + com.microsoft.semantic-kernel + semantickernel-bom + ${project.version} + pom + import + + + + + + + com.microsoft.semantic-kernel + semantickernel-api + + + + org.apache.logging.log4j + log4j-api + runtime + + + org.apache.logging.log4j + log4j-core + runtime + + + org.apache.logging.log4j + log4j-slf4j2-impl + runtime + + + com.fasterxml.jackson.core + jackson-databind + compile + + + com.fasterxml.jackson.core + jackson-core + compile + + + com.azure + azure-identity + + + com.microsoft.semantic-kernel + semantickernel-aiservices-openai + + + + diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/AIServices.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/AIServices.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/AIServices.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/AIServices.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/ConfiguringPrompts.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/ConfiguringPrompts.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/ConfiguringPrompts.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/ConfiguringPrompts.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/CreatingFunctions.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/CreatingFunctions.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/CreatingFunctions.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/CreatingFunctions.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/FunctionsWithinPrompts.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/FunctionsWithinPrompts.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/FunctionsWithinPrompts.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/FunctionsWithinPrompts.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Plugin.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Plugin.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Plugin.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Plugin.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Prompts.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Prompts.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Prompts.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Prompts.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java similarity index 98% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java index 6b59c08990..a8b2a5f80f 100644 --- a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java +++ b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/SerializingPrompts.java @@ -39,7 +39,7 @@ public class SerializingPrompts { private static final String MODEL_ID = System.getenv() .getOrDefault("MODEL_ID", "gpt-3.5-turbo"); - private static final String PLUGINS_DIR = "java/samples/sample-code/src/main/resources/Plugins"; + private static final String PLUGINS_DIR = "java/samples/semantickernel-syntax-examples/src/main/resources/Plugins"; public static void main(String[] args) throws IOException { System.out.println("======== Serializing Prompts ========"); diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Templates.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Templates.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Templates.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/Templates.java diff --git a/java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/UsingTheKernel.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/UsingTheKernel.java similarity index 100% rename from java/samples/sample-code/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/UsingTheKernel.java rename to java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/documentationexamples/UsingTheKernel.java diff --git a/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java new file mode 100644 index 0000000000..247fc48c1c --- /dev/null +++ b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/ConversationSummaryPlugin.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft. All rights reserved. +package com.microsoft.semantickernel.samples.plugins; + +import com.microsoft.semantickernel.Kernel; +import com.microsoft.semantickernel.contextvariables.ContextVariableTypes; +import com.microsoft.semantickernel.orchestration.PromptExecutionSettings; +import com.microsoft.semantickernel.semanticfunctions.KernelFunction; +import com.microsoft.semantickernel.semanticfunctions.KernelFunctionArguments; +import com.microsoft.semantickernel.semanticfunctions.annotations.DefineKernelFunction; +import com.microsoft.semantickernel.semanticfunctions.annotations.KernelFunctionParameter; +import com.microsoft.semantickernel.text.TextChunker; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import java.util.List; + +/// +/// Semantic plugin that enables conversations summarization. +/// +public class ConversationSummaryPlugin { + + /// + /// The max tokens to process in a single prompt function call. + /// + private static final int MaxTokens = 1024; + + private KernelFunction summarizeConversationFunction; + private KernelFunction conversationActionItemsFunction; + private KernelFunction conversationTopicsFunction; + + /// + /// Initializes a new instance of the class. + /// + public ConversationSummaryPlugin() { + PromptExecutionSettings settings = PromptExecutionSettings.builder() + .withMaxTokens(MaxTokens) + .withTemperature(0.1) + .withTopP(0.5) + .build(); + + this.summarizeConversationFunction = KernelFunction + .createFromPrompt(PromptFunctionConstants.SummarizeConversationDefinition) + .withDefaultExecutionSettings(settings) + .withName("summarizeConversation") + .withDescription( + "Given a section of a conversation transcript, summarize the part of the conversation.") + .build(); + + this.conversationActionItemsFunction = KernelFunction + .createFromPrompt(PromptFunctionConstants.GetConversationActionItemsDefinition) + .withDefaultExecutionSettings(settings) + .withName("conversationActionItems") + .withDescription("Given a section of a conversation transcript, identify action items.") + .build(); + + this.conversationTopicsFunction = KernelFunction + .createFromPrompt(PromptFunctionConstants.GetConversationTopicsDefinition) + .withDefaultExecutionSettings(settings) + .withName("conversationTopics") + .withDescription( + "Analyze a conversation transcript and extract key topics worth remembering.") + .build(); + } + + private static Mono processAsync(KernelFunction func, String input, + Kernel kernel) { + List lines = TextChunker.splitPlainTextLines(input, MaxTokens); + List paragraphs = TextChunker.splitPlainTextParagraphs(lines, MaxTokens); + + return Flux.fromIterable(paragraphs) + .concatMap(paragraph -> { + // The first parameter is the input text. + return func.invokeAsync(kernel) + .withArguments( + new KernelFunctionArguments.Builder() + .withInput(paragraph) + .build()) + .withResultType( + ContextVariableTypes.getGlobalVariableTypeForClass(String.class)); + }) + .reduce("", (acc, next) -> { + return acc + "\n" + next.getResult(); + }); + } + + /// + /// Given a long conversation transcript, summarize the conversation. + /// + /// A long conversation transcript. + /// The containing services, plugins, and other state for use throughout the operation. + @DefineKernelFunction(description = "Given a long conversation transcript, summarize the conversation.", name = "SummarizeConversation", returnType = "java.lang.String") + public Mono SummarizeConversationAsync( + @KernelFunctionParameter(description = "A long conversation transcript.", name = "input") String input, + Kernel kernel) { + return processAsync(this.summarizeConversationFunction, input, kernel); + } + + /// + /// Given a long conversation transcript, identify action items. + /// + /// A long conversation transcript. + /// The containing services, plugins, and other state for use throughout the operation. + @DefineKernelFunction(description = "Given a long conversation transcript, identify action items.", name = "GetConversationActionItems", returnType = "java.lang.String") + public Mono GetConversationActionItemsAsync( + @KernelFunctionParameter(description = "A long conversation transcript.", name = "input") String input, + Kernel kernel) { + return processAsync(this.conversationActionItemsFunction, input, kernel); + } + + /// + /// Given a long conversation transcript, identify topics. + /// + /// A long conversation transcript. + /// The containing services, plugins, and other state for use throughout the operation. + @DefineKernelFunction(description = "Given a long conversation transcript, identify topics worth remembering.", name = "GetConversationTopics", returnType = "java.lang.String") + + public Mono GetConversationTopicsAsync( + @KernelFunctionParameter(description = "A long conversation transcript.", name = "input") String input, + Kernel kernel) { + return processAsync(this.conversationTopicsFunction, input, kernel); + } +} diff --git a/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java new file mode 100644 index 0000000000..1f9a7ce348 --- /dev/null +++ b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/MathPlugin.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft. All rights reserved. +package com.microsoft.semantickernel.samples.plugins; + +import com.microsoft.semantickernel.semanticfunctions.annotations.DefineKernelFunction; +import com.microsoft.semantickernel.semanticfunctions.annotations.KernelFunctionParameter; + +// +public class MathPlugin { + // + + // + @DefineKernelFunction(name = "sqrt", description = "Take the square root of a number") + public static double sqrt( + @KernelFunctionParameter(name = "number1", description = "The number to take a square root of", type = double.class) double number1) { + return Math.sqrt(number1); + } + // + + @DefineKernelFunction(name = "add", description = "Add two numbers") + public static double add( + @KernelFunctionParameter(name = "number1", description = "The first number to add", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The second number to add", type = double.class) double number2) { + return number1 + number2; + } + + @DefineKernelFunction(name = "subtract", description = "Subtract two numbers") + public static double subtract( + @KernelFunctionParameter(name = "number1", description = "The first number to subtract from", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The second number to subtract away", type = double.class) double number2) { + return number1 - number2; + } + + @DefineKernelFunction(name = "multiply", description = "Multiply two numbers. When increasing by a percentage, don't forget to add 1 to the percentage.") + public static double multiply( + @KernelFunctionParameter(name = "number1", description = "The first number to multiply", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The second number to multiply", type = double.class) double number2) { + return number1 * number2; + } + + @DefineKernelFunction(name = "divide", description = "Divide two numbers") + public static double divide( + @KernelFunctionParameter(name = "number1", description = "The first number to divide from", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The second number to divide by", type = double.class) double number2) { + return number1 / number2; + } + + @DefineKernelFunction(name = "power", description = "Raise a number to a power") + public static double power( + @KernelFunctionParameter(name = "number1", description = "The number to raise", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The power to raise the number to", type = double.class) double number2) { + return Math.pow(number1, number2); + } + + @DefineKernelFunction(name = "log", description = "Take the log of a number") + public static double log( + @KernelFunctionParameter(name = "number1", description = "The number to take the log of", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The base of the log", type = double.class) double number2) { + return Math.log(number1) / Math.log(number2); + } + + @DefineKernelFunction(name = "round", description = "Round a number to the target number of decimal places") + public static double round( + @KernelFunctionParameter(name = "number1", description = "The number to round", type = double.class) double number1, + @KernelFunctionParameter(name = "number2", description = "The number of decimal places to round to", type = double.class) int number2) { + return Math.round(number1 * Math.pow(10, number2)) / Math.pow(10, number2); + } + + @DefineKernelFunction(name = "abs", description = "Take the absolute value of a number") + public static double abs( + @KernelFunctionParameter(name = "number1", description = "The number to take the absolute value of", type = double.class) double number1) { + return Math.abs(number1); + } + + @DefineKernelFunction(name = "floor", description = "Take the floor of a number") + public static double floor( + @KernelFunctionParameter(name = "number1", description = "The number to take the floor of", type = double.class) double number1) { + return Math.floor(number1); + } + + @DefineKernelFunction(name = "ceiling", description = "Take the ceiling of a number") + public static double ceiling( + @KernelFunctionParameter(name = "number1", description = "The number to take the ceiling of", type = double.class) double number1) { + return Math.ceil(number1); + } + + @DefineKernelFunction(name = "sin", description = "Take the sine of a number") + public static double sin( + @KernelFunctionParameter(name = "number1", description = "The number to take the sine of", type = double.class) double number1) { + return Math.sin(number1); + } + + @DefineKernelFunction(name = "cos", description = "Take the cosine of a number") + public static double cos( + @KernelFunctionParameter(name = "number1", description = "The number to take the cosine of", type = double.class) double number1) { + return Math.cos(number1); + } + + @DefineKernelFunction(name = "tan", description = "Take the tangent of a number") + public static double tan( + @KernelFunctionParameter(name = "number1", description = "The number to take the tangent of", type = double.class) double number1) { + return Math.tan(number1); + } + + @DefineKernelFunction(name = "asin", description = "Take the arcsine of a number") + public static double asin( + @KernelFunctionParameter(name = "number1", description = "The number to take the arcsine of", type = double.class) double number1) { + return Math.asin(number1); + } + + @DefineKernelFunction(name = "acos", description = "Take the arccosine of a number") + public static double acos( + @KernelFunctionParameter(name = "number1", description = "The number to take the arccosine of", type = double.class) double number1) { + return Math.acos(number1); + } + + @DefineKernelFunction(name = "atan", description = "Take the arctangent of a number") + public static double atan( + @KernelFunctionParameter(name = "number1", description = "The number to take the arctangent of", type = double.class) double number1) { + return Math.atan(number1); + } +} diff --git a/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java new file mode 100644 index 0000000000..22c51f383a --- /dev/null +++ b/java/samples/semantickernel-learn-resources/src/main/java/com/microsoft/semantickernel/samples/plugins/PromptFunctionConstants.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft. All rights reserved. +package com.microsoft.semantickernel.samples.plugins; + +public class PromptFunctionConstants { + + public static final String SummarizeConversationDefinition = """ + BEGIN CONTENT TO SUMMARIZE: + {{$INPUT}} + + END CONTENT TO SUMMARIZE. + + Summarize the conversation in 'CONTENT TO SUMMARIZE', identifying main points of discussion and any conclusions that were reached. + Do not incorporate other general knowledge. + Summary is in plain text, in complete sentences, with no markup or tags. + + BEGIN SUMMARY: + """ + .stripIndent(); + + public static final String GetConversationActionItemsDefinition = """ + You are an action item extractor. You will be given chat history and need to make note of action items mentioned in the chat. + Extract 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. + Return the action items in json. + + Possible statuses for action items are: Open, Closed, In Progress. + + EXAMPLE INPUT WITH ACTION ITEMS: + + John Doe said: "I will record a demo for the new feature by Friday" + I said: "Great, thanks John. We may not use all of it but it's good to get it out there." + + EXAMPLE OUTPUT: + { + "actionItems": [ + { + "owner": "John Doe", + "actionItem": "Record a demo for the new feature", + "dueDate": "Friday", + "status": "Open", + "notes": "" + } + ] + } + + EXAMPLE INPUT WITHOUT ACTION ITEMS: + + John Doe said: "Hey I'm going to the store, do you need anything?" + I said: "No thanks, I'm good." + + EXAMPLE OUTPUT: + { + "action_items": [] + } + + CONTENT STARTS HERE. + + {{$INPUT}} + + CONTENT STOPS HERE. + + OUTPUT: + """ + .stripIndent(); + + public static final String GetConversationTopicsDefinition = """ + Analyze the following extract taken from a conversation transcript and extract key topics. + - Topics only worth remembering. + - Be brief. Short phrases. + - Can use broken English. + - Conciseness is very important. + - Topics can include names of memories you want to recall. + - NO LONG SENTENCES. SHORT PHRASES. + - Return in JSON + [Input] + My 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. + My tragic story was immortalized by Shakespeare in a play. + [Output] + { + "topics": [ + "Macbeth", + "King of Scotland", + "Lady Macbeth", + "Dog", + "Toby McDuff", + "Shakespeare", + "Play", + "Tragedy" + ] + } + +++++ + [Input] + {{$INPUT}} + [Output]""" + .stripIndent(); +} diff --git a/java/samples/semantickernel-learn-resources/src/main/resources/log4j2.xml b/java/samples/semantickernel-learn-resources/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..2774f660d5 --- /dev/null +++ b/java/samples/semantickernel-learn-resources/src/main/resources/log4j2.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/samples/semantickernel-sample-plugins/pom.xml b/java/samples/semantickernel-sample-plugins/pom.xml new file mode 100644 index 0000000000..ead537a2a9 --- /dev/null +++ b/java/samples/semantickernel-sample-plugins/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.microsoft.semantic-kernel + semantickernel-samples-parent + 1.0.3-SNAPSHOT + ../pom.xml + + + semantickernel-sample-plugins + 1.0.3-SNAPSHOT + pom + semantickernel-sample-plugins + + + semantickernel-openapi-plugin + + diff --git a/java/samples/semantickernel-openapi-plugin/pom.xml b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/pom.xml similarity index 98% rename from java/samples/semantickernel-openapi-plugin/pom.xml rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/pom.xml index 4714374944..531909c070 100644 --- a/java/samples/semantickernel-openapi-plugin/pom.xml +++ b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.microsoft.semantic-kernel - semantickernel-samples-parent + semantickernel-sample-plugins 1.0.3-SNAPSHOT ../pom.xml diff --git a/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/OpenAPIHttpRequestPlugin.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/OpenAPIHttpRequestPlugin.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/OpenAPIHttpRequestPlugin.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/OpenAPIHttpRequestPlugin.java diff --git a/java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/main/java/com/microsoft/semantickernel/samples/openapi/SemanticKernelOpenAPIImporter.java diff --git a/java/samples/semantickernel-openapi-plugin/src/test/java/ExampleAdoptiumImporter.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleAdoptiumImporter.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/java/ExampleAdoptiumImporter.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleAdoptiumImporter.java diff --git a/java/samples/semantickernel-openapi-plugin/src/test/java/ExampleAuthenticatedRequestImporter.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleAuthenticatedRequestImporter.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/java/ExampleAuthenticatedRequestImporter.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleAuthenticatedRequestImporter.java diff --git a/java/samples/semantickernel-openapi-plugin/src/test/java/ExampleOpenAPIParent.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleOpenAPIParent.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/java/ExampleOpenAPIParent.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExampleOpenAPIParent.java diff --git a/java/samples/semantickernel-openapi-plugin/src/test/java/ExamplePetstoreImporter.java b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExamplePetstoreImporter.java similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/java/ExamplePetstoreImporter.java rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/java/ExamplePetstoreImporter.java diff --git a/java/samples/semantickernel-openapi-plugin/src/test/resources/adoptium.json b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/adoptium.json similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/resources/adoptium.json rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/adoptium.json diff --git a/java/samples/semantickernel-openapi-plugin/src/test/resources/adoptium.yaml b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/adoptium.yaml similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/resources/adoptium.yaml rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/adoptium.yaml diff --git a/java/samples/semantickernel-openapi-plugin/src/test/resources/authenticatedRequest.yaml b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/authenticatedRequest.yaml similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/resources/authenticatedRequest.yaml rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/authenticatedRequest.yaml diff --git a/java/samples/semantickernel-spring-starter/src/test/resources/log4j2.xml b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/log4j2.xml similarity index 100% rename from java/samples/semantickernel-spring-starter/src/test/resources/log4j2.xml rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/log4j2.xml diff --git a/java/samples/semantickernel-openapi-plugin/src/test/resources/petstore.yaml b/java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/petstore.yaml similarity index 100% rename from java/samples/semantickernel-openapi-plugin/src/test/resources/petstore.yaml rename to java/samples/semantickernel-sample-plugins/semantickernel-openapi-plugin/src/test/resources/petstore.yaml