Skip to content

Commit

Permalink
.Net: Promote Liquid prompt template support to preview (#9665)
Browse files Browse the repository at this point in the history
### Motivation and Context

- Promoting Liquid template support to preview
- Remove SKEXP0001 from allow_dangerously_set_content

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
  • Loading branch information
markwallace-microsoft authored Nov 12, 2024
1 parent 7a1ef30 commit 051a3d0
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public sealed class HandlebarsPromptTemplateFactory : IPromptTemplateFactory
/// <summary>
/// Default options for built-in Handlebars helpers.
/// </summary>
/// TODO [@teresaqhoang]: Support override of default options
private readonly HandlebarsPromptTemplateOptions _options;

/// <summary>
Expand All @@ -32,7 +31,6 @@ public sealed class HandlebarsPromptTemplateFactory : IPromptTemplateFactory
/// For prompts which are being used with a chat completion service this should be set to false to protect against prompt injection attacks.
/// When using other AI services e.g. Text-To-Image this can be set to true to allow for more complex prompts.
/// </remarks>
[Experimental("SKEXP0001")]
public bool AllowDangerouslySetContent { get; init; } = false;

/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions dotnet/src/Extensions/PromptTemplates.Liquid/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public async Task<string> RenderAsync(Kernel kernel, KernelArguments? arguments
return renderedResult;
}

#region Private
private string Encoding(string text)
{
text = this.ReplaceReservedStringBackToColonIfNeeded(text);
Expand Down Expand Up @@ -286,4 +287,5 @@ protected override Expression VisitMemberExpression(MemberExpression memberExpre
return memberExpression;
}
}
#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<AssemblyName>Microsoft.SemanticKernel.PromptTemplates.Liquid</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
<VersionSuffix>alpha</VersionSuffix>
<NoWarn>$(NoWarn);SKEXP0001</NoWarn>
<VersionSuffix>preview</VersionSuffix>
</PropertyGroup>

<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.Onnx;
using Microsoft.SemanticKernel.Embeddings;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ public string Description
/// For prompts which are being used with a chat completion service this should be set to false to protect against prompt injection attacks.
/// When using other AI services e.g. Text-To-Image this can be set to true to allow for more complex prompts.
/// </remarks>
[Experimental("SKEXP0001")]
[JsonPropertyName("allow_dangerously_set_content")]
public bool AllowDangerouslySetContent { get; set; } = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public Dictionary<string, PromptExecutionSettings> ExecutionSettings
/// For prompts which are being used with a chat completion service this should be set to false to protect against prompt injection attacks.
/// When using other AI services e.g. Text-To-Image this can be set to true to allow for more complex prompts.
/// </remarks>
[Experimental("SKEXP0001")]
[JsonPropertyName("allow_dangerously_set_content")]
public bool AllowDangerouslySetContent { get; set; } = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public sealed class KernelPromptTemplateFactory : IPromptTemplateFactory
/// For prompts which are being used with a chat completion service this should be set to false to protect against prompt injection attacks.
/// When using other AI services e.g. Text-To-Image this can be set to true to allow for more complex prompts.
/// </remarks>
[Experimental("SKEXP0001")]
public bool AllowDangerouslySetContent { get; init; } = false;

/// <summary>
Expand Down

0 comments on commit 051a3d0

Please sign in to comment.