-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Closed
Copy link
Labels
pythonPull requests for the Python Semantic KernelPull requests for the Python Semantic Kernel
Description
Currently we have Kernel examples that are very simple using C#:
Kernel kernel = Kernel.CreateBuilder()
.AddOpenAIChatCompletion(modelId: “gpt-4o”, apiKey: “…”)
.Build();
Console.WriteLine(await kernel.InvokePromptAsync("Why is the sky blue?"));In python there's no way to use it as function_name and plugin_name are required arguments and need to be created manually with a prompttemplateconfig.
Desired but not supported today
kernel = Kernel()
kernel.add_service(OpenAIChatCompletion(ai_model_id="gpt-4o", api_key="..."))
print(asyncio.run(kernel.invoke_prompt("Why is the sky blue")))Currently to achieve a result all those lines are required in python:
kernel = Kernel()
kernel.add_service(OpenAIChatCompletion(ai_model_id="gpt-4o", api_key="..."))
prompt_template_config = PromptTemplateConfig(template="why is the sky blue")
tldr_function = kernel.add_function(function_name="tldrFunction",plugin_name="tldrPlugin", prompt_template_config = prompt_template_config)
result = asyncio.run(kernel.invoke(tldr_function))
print(result)Metadata
Metadata
Assignees
Labels
pythonPull requests for the Python Semantic KernelPull requests for the Python Semantic Kernel
Type
Projects
Status
Sprint: Done