Skip to content

.Net: Markdown prompt support (without tool call support)#5961

Merged
markwallace-microsoft merged 39 commits intomicrosoft:feature-promptyfrom
LittleLittleCloud:u/xiaoyun/prompty
Apr 29, 2024
Merged

.Net: Markdown prompt support (without tool call support)#5961
markwallace-microsoft merged 39 commits intomicrosoft:feature-promptyfrom
LittleLittleCloud:u/xiaoyun/prompty

Conversation

@LittleLittleCloud
Copy link
Copy Markdown
Contributor

@LittleLittleCloud LittleLittleCloud commented Apr 22, 2024

Motivation and Context

Description

This PR brings markdown prompt template support for semantic kernel. It essentially does a code-level copy of the original markdown prompt template implementation to the sk repo, plus an extension API to execute the template.

Because the markdown prompt template support is still in an very, very early stage. All code is put under Experimental namespace and all the class except the extension API is marked as internal only.

You can find the spec for the markdown prompt template here

The intergration comes with two projects

  • PromptTemplates.Liquid: liquid syntax support for the markdown prompt template, which renders liquid-like template into the chat format that can be processed by ChatPromptParser
  • Function.Prompty: load and create KernelFunctionFromPrompt from prompty file via CreateFunctionFromPrompty API

The tool call support will come in the next PR as this PR is already growing large. Also tool call support needs some extra care which might need further discussion on how to implement cohere to sk pattern

Contribution Checklist

@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Apr 22, 2024
@github-actions github-actions Bot changed the title [.Net] [WIP] Markdown prompt support .Net: [.Net] [WIP] Markdown prompt support Apr 22, 2024
@LittleLittleCloud LittleLittleCloud changed the title .Net: [.Net] [WIP] Markdown prompt support .Net: [WIP] Markdown prompt support Apr 22, 2024
Comment thread dotnet/src/SemanticKernel.Abstractions/SemanticKernel.Abstractions.csproj Outdated
Comment thread dotnet/src/Extensions/PromptTemplates.Prompty/Experimental.Prompty.csproj Outdated
Comment thread dotnet/src/Extensions/PromptTemplates.Prompty/PromptyKernelFunction.cs Outdated
@markwallace-microsoft markwallace-microsoft self-assigned this Apr 24, 2024
@LittleLittleCloud LittleLittleCloud changed the base branch from main to feature-prompty April 24, 2024 23:09
@LittleLittleCloud LittleLittleCloud marked this pull request as ready for review April 25, 2024 00:13
@LittleLittleCloud LittleLittleCloud requested a review from a team as a code owner April 25, 2024 00:13
@LittleLittleCloud LittleLittleCloud changed the title .Net: [WIP] Markdown prompt support .Net: Markdown prompt support (without tool call support) Apr 25, 2024
Comment thread dotnet/src/Extensions/PromptTemplates.Liquid/LiquidPromptTemplate.cs Outdated
Comment thread dotnet/src/Extensions/PromptTemplates.Liquid/LiquidPromptTemplate.cs Outdated
Comment thread dotnet/src/Extensions/PromptTemplates.Liquid/LiquidPromptTemplate.cs Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtension.cs Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtension.cs Outdated
public string? AzureDeployment { get; set; }

[YamlMember(Alias = "api_key")]
public string? ApiKey { get; set; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this information really put into a prompty file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This information would tie a Prompty file to one particular deployment. These will change frequently as new models emerge and these artifacts should be easily transferable to other contexts e.g. a Prompty file the Data Scientists developed should be transferable to another team to deploy. Or if I'm building a product my Prompty files should run with any customer deployment.
In our YAML file we include the model configuration i.e. temperature, top_p, ... but not the model deployment, that is treated as a seperate concern.

Comment thread dotnet/docs/EXPERIMENTS.md Outdated
Comment thread dotnet/src/Extensions/PromptTemplates.Liquid/LiquidPromptTemplate.cs Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Core/Types/ParserType.cs
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtension.cs Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtension.cs Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtension.cs Outdated
Comment thread dotnet/docs/EXPERIMENTS.md Outdated
Comment thread dotnet/src/Functions/Functions.Prompty/Extensions/PromptyKernelExtensions.cs Outdated
@markwallace-microsoft markwallace-microsoft merged commit 09778cd into microsoft:feature-prompty Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants