Skip to content

.NET: [Feature]: Adding Prompts as Tools (like semantic kernel) #3388

@htaljaard

Description

@htaljaard

Description

I have been doing some digging and cannot see a similar issue on this topic.

In Semantic Kernel we had the option to add a prompt as a tool. This was immensely helpful in structuring certain outputs for users - lesson plans, proposals - any structured writing.

How do we achieve this in MAF?

Code Sample

var templateFactory = new HandlebarsPromptTemplateFactory();
var promptTemplateConfig = new PromptTemplateConfig()
{
    Template = template,
    TemplateFormat = "handlebars",
    Name = "ContosoChatPrompt",
};

var kernel = Kernel.CreateBuilder()
    .AddAzureOpenAIChatClient(
    apiKey: aiFoundryApiKey, deploymentName: deploymentName, endpoint: openAIEndpoint)
    .Build();

kernel.CreateFunctionFromPrompt(promptTemplateConfig);

Language/SDK

.NET

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions