Functions.Markdown NuGet 패키지는 더 이상 사용되지 않으며 정리 이니셔티브의 일환으로 향후 릴리스에서 제거될 예정입니다. Functions.Yaml 패키지를 대체하는 것이 좋습니다.
Markdown 프롬프트 템플릿
Functions.Yaml 패키지에서 새 API로 코드를 마이그레이션하기 전에 먼저 markdown 프롬프트 템플릿을 새 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
사용하여 프롬프트에서 커널 함수를 만드는 경우 메서드로 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 구성의 일부입니다.