diff --git a/samples/apps/copilot-chat-app/webapi/CopilotChat/Controllers/ChatController.cs b/samples/apps/copilot-chat-app/webapi/CopilotChat/Controllers/ChatController.cs index f13b4aaff4f8..b906f9e0bd19 100644 --- a/samples/apps/copilot-chat-app/webapi/CopilotChat/Controllers/ChatController.cs +++ b/samples/apps/copilot-chat-app/webapi/CopilotChat/Controllers/ChatController.cs @@ -150,6 +150,9 @@ public async Task ChatAsync( /// private async Task RegisterPlannerSkillsAsync(CopilotChatPlanner planner, OpenApiSkillsAuthHeaders openApiSkillsAuthHeaders, ContextVariables variables) { + // Register Transform output skill + planner.Kernel.ImportSemanticSkillFromDirectory(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "CopilotChat", "Skills"), "DataTransformationSkills"); + // Register authenticated skills with the planner's kernel only if the request includes an auth header for the skill. // Klarna Shopping diff --git a/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/config.json b/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/config.json new file mode 100644 index 000000000000..bf7525a5b45c --- /dev/null +++ b/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/config.json @@ -0,0 +1,34 @@ +{ + "schema": 1, + "description": "Format or transform context variables for plan functions. Use this method when a function parameter requires a specific format (such as list or JSON string) or transformation (such as filtering or capitalization) that is not already done by another function. If unsure whether a function's output matches a subsequent function's input, use this method.", + "type": "completion", + "completion": { + "max_tokens": 1000, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "stop_sequences": [ + "[END FORMATTEDOUTPUT]" + ] + }, + "input": { + "parameters": [ + { + "name": "rationale", + "description": "Description of the specific format or transformation that must be applied to inputVariable to respect the requested format or transformation. Must be as precise as possible and can contain examples of the expected result if available", + "defaultValue": "" + }, + { + "name": "outputFormat", + "description": "Description of the format of the output. Must be as precized as possible and can contain examples of the expected result if available (it can for example include the specific request format such a the JSON description or an example given in the parameter description of the called function)", + "defaultValue": "" + }, + { + "name": "inputVariable", + "description": "Input data, coming from a previous function, that must be formatted or transformed", + "defaultValue": "" + } + ] + } +} diff --git a/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/skprompt.txt b/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/skprompt.txt new file mode 100644 index 000000000000..5eade9a7623d --- /dev/null +++ b/samples/apps/copilot-chat-app/webapi/CopilotChat/Skills/DataTransformationSkills/TransformOutputSkill/skprompt.txt @@ -0,0 +1,24 @@ +A function is composed of parameters, the goal is to apply a transformation or specific formatting to respect the requirement of a parameter function. Considering the description of the transformation or formatting to apply ([RATIONALE] section), format of the expected output ([outputFormat] section) and goal of the global plan ([GOAL] section), format the content of the input ([inputVariable] section) to respect all requirements. + +[START EXAMPLE] +[START inputVariable] +Here is the list of Stores: [Paris Saint Sulpice,Paris Auteuil, Cannes] +[END inputVariable] +[START outputFormat]Comma separated list of store names (example: Paris Saint Sulpice,Cannes)[END outputFormat] +[START GOAL]User intent: Please search for black t-shirts made of wool fabric and provide me with their availability at stores located in Paris.[END GOAL] +[START RATIONALE]Filter the list of stores to only include stores located in Paris[END RATIONALE] +[START FORMATTEDOUTPUT] +Paris Saint Sulpice,Paris Auteuil +[END FORMATTEDOUTPUT] +[END EXAMPLE] + +Real data start here : +[START inputVariable] +{{$inputVariable}} +[END inputVariable] +[START outputFormat] +{{$outputFormat}} +[END outputFormat] +[START GOAL]{{$planUserIntent}}[END GOAL] +[START RATIONALE]{{$rationale}}[END RATIONALE] +[START FORMATTEDOUTPUT] \ No newline at end of file diff --git a/samples/apps/copilot-chat-app/webapi/CopilotChatWebApi.csproj b/samples/apps/copilot-chat-app/webapi/CopilotChatWebApi.csproj index 95f4dd6f790e..59f85aa47575 100644 --- a/samples/apps/copilot-chat-app/webapi/CopilotChatWebApi.csproj +++ b/samples/apps/copilot-chat-app/webapi/CopilotChatWebApi.csproj @@ -69,4 +69,16 @@ <_Parameter1>false + + + + Always + + + + + + Always + +