Functions.Markdown NuGet パッケージは非推奨となり、クリーンアップ イニシアチブの一部として将来のリリースで削除される予定です。 推奨される置換は Functions.Yaml パッケージです。
マークダウン プロンプト テンプレート
Functions.Yaml パッケージから新しい API にコードを移行する前に、まずマークダウン プロンプト テンプレートを新しい YAML 形式に移行することを検討してください。 そのため、次のような Markdown プロンプト テンプレートがある場合は、次のようになります。
This is a semantic kernel prompt template
```sk.prompt
Hello AI, tell me about {{$input}}
```
```sk.execution_settings
{
"service1" : {
"model_id": "gpt4",
"temperature": 0.7,
"function_choice_behavior": {
"type": "auto",
}
}
}
```
```sk.execution_settings
{
"service2" : {
"model_id": "gpt-4o-mini",
"temperature": 0.7
}
}
YAML と同等のプロンプト テンプレートは次のようになります。
name: TellMeAbout
description: This is a semantic kernel prompt template
template: Hello AI, tell me about {{$input}}
template_format: semantic-kernel
execution_settings:
service1:
model_id: gpt4
temperature: 0.7
function_choice_behavior:
type: auto
service2:
model_id: gpt-4o-mini
temperature: 0.7
KernelFunctionMarkdown.FromPromptMarkdown メソッド
コードで KernelFunctionMarkdown.FromPromptMarkdown
メソッドを使用してプロンプトからカーネル関数を作成する場合は、 KernelFunctionYaml.FromPromptYaml
メソッドに置き換えます。
// Before
string promptTemplateConfig = """
This is a semantic kernel prompt template
```sk.prompt
Hello AI, tell me about {{$input}}
```
""";
KernelFunction function = KernelFunctionMarkdown.FromPromptMarkdown(promptTemplateConfig, "TellMeAbout");
//After
string promptTemplateConfig =
"""
name: TellMeAbout
description: This is a semantic kernel prompt template
template: Hello AI, tell me about {{$input}}
""";
KernelFunction function = KernelFunctionYaml.FromPromptYaml(promptTemplateConfig);
KernelFunctionYaml.FromPromptYaml
メソッドは、関数名をパラメーターとして受け入れないことに注意してください。 関数名が YAML 構成の一部になりました。
MarkdownKernelExtensions.CreateFunctionFromMarkdown メソッド
同様に、コードで MarkdownKernelExtensions.CreateFunctionFromMarkdown
Kernel 拡張メソッドを使用してプロンプトからカーネル関数を作成する場合は、 PromptYamlKernelExtensions.CreateFunctionFromPromptYaml
メソッドに置き換えます。
// Before
string promptTemplateConfig = """
This is a semantic kernel prompt template
```sk.prompt
Hello AI, tell me about {{$input}}
```
""";
Kernel kernel = new Kernel();
KernelFunction function = kernel.CreateFunctionFromMarkdown(promptTemplateConfig, "TellMeAbout");
//After
string promptTemplateConfig =
"""
name: TellMeAbout
description: This is a semantic kernel prompt template
template: Hello AI, tell me about {{$input}}
""";
Kernel kernel = new Kernel();
KernelFunction function = kernel.CreateFunctionFromPromptYaml(promptTemplateConfig);
PromptYamlKernelExtensions.CreateFunctionFromPromptYaml
メソッドは、関数名をパラメーターとして受け入れないことに注意してください。 関数名が YAML 構成の一部になりました。