from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.prompt_template import InputVariable, PromptTemplateConfig
kernel.add_service(
OpenAIChatCompletion(ai_model_id="gpt-4o-mini"),
)
prompt = """{{$input}}
Please provide a concise response to the question above.
"""
prompt_template_config = PromptTemplateConfig(
template=prompt,
name="question_answerer",
template_format="semantic-kernel",
input_variables=[
InputVariable(name="input", description="The question from the user", is_required=True),
]
)
summarize = kernel.add_function(
function_name="answerQuestionFunc",
plugin_name="questionAnswererPlugin",
prompt_template_config=prompt_template_config,
)
await kernel.invoke(summarize, input="What's the meaning of life?")