Skip to content

.Net [ChatRoles] 1. Convert SK templating engine chat role syntax to intermediate SK format #3250

Closed

Description

@SergeyMenshykh

As an engineer working on SK,
I want templating engines to generate an intermediate format for chat roles,
So that subsequent components (such as semantic functions or connectors) can recognize it and map it to chat messages or history

Scope:

  1. Create ADR and present it to the team.
  2. Collect feedback and implement the conversion functionality in the 'BasicPromptTemplateEngine' class.

Context

Today, various templating engines have their unique syntax and may represent chat completion roles in a manner specific to the engine's syntax:

Image

To prevent the handling of templating engine-specific syntax in other SK components besides the prompt template, we need a mechanism to map templating engine-specific syntax to the SK format. For example, if the SK prompt uses syntax like:

  • Handlebars: "{{#system}}You are a banker.{{/system}}"
  • Jinja2: "system: You are a banker"

Then it should be converted to the SK format, so that the resulting prompt, as it will be described in the ADR, looks like "<role:system>You are a banker.<role:system>." This way, the other SK components (connectors?) participating in the semantic function execution can rely on a well-defined format to extract those roles from the rendered prompt and map them to chat messages for chat completion APIs.

Activity

  1. converted this from a draft issue on Oct 23, 2023
  2. added
    kernelIssues or pull requests impacting the core kernel
    and removed
    .NETIssue or Pull requests regarding .NET code
    on Oct 23, 2023
  3. added this to the v1.0.0 milestone on Oct 23, 2023
  4. moved this from Sprint: Planned to Sprint: In Progress in Semantic Kernelon Oct 23, 2023
  5. changed the title [-].Net [ChatRoles] Convert templating engune chat role syntax to intermediate SK format[/-] [+].Net [ChatRoles] Convert SK templating engine chat role syntax to intermediate SK format[/+] on Oct 23, 2023
  6. moved this from Sprint: In Progress to Sprint: In Review in Semantic Kernelon Oct 24, 2023
  7. added
    sk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
    on Oct 24, 2023
  8. moved this from Sprint: In Review to Sprint: Done in Semantic Kernelon Oct 25, 2023
  9. changed the title [-].Net [ChatRoles] Convert SK templating engine chat role syntax to intermediate SK format[/-] [+].Net [ChatRoles] 1. Convert SK templating engine chat role syntax to intermediate SK format[/+] on Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codekernelIssues or pull requests impacting the core kernelsk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions