mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
### Motivation and Context The python notebooks are pinned to 0.2.7.dev0 while the latest pip package for python is 0.3.1.dev0. This PR updates the notebooks to pull the 0.3.1.dev0 and adds 2 new notebooks demonstrating new features added to SK between these versions. ### Description - All notebooks depend on semantic-kernel==0.3.1.dev0 - Added a notebook demonstrating streaming completion responses - Added a notebook demonstrating multiple responses per prompt (including streaming them) ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [ ] The code builds clean without any errors or warnings - [ ] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) - [ ] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with `dotnet format` - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄 --------- Co-authored-by: Lee Miller <[email protected]> Co-authored-by: Shawn Callegari <[email protected]>
3.3 KiB
3.3 KiB
In [ ]:
!python -m pip install semantic-kernel==0.3.1.dev0In [ ]:
import semantic_kernel as sk
kernel = sk.Kernel()In [ ]:
from semantic_kernel.connectors.ai.open_ai import OpenAITextCompletion
api_key, org_id = sk.openai_settings_from_dot_env()
kernel.add_text_completion_service("dv", OpenAITextCompletion("text-davinci-003", api_key, org_id))In [ ]:
from semantic_kernel.connectors.ai.open_ai import AzureTextCompletion
deployment, api_key, endpoint = sk.azure_openai_settings_from_dot_env()
kernel.add_text_completion_service("dv", AzureTextCompletion(deployment, endpoint, api_key))In [ ]:
skill = kernel.import_semantic_skill_from_directory("../../skills", "FunSkill")
joke_function = skill["Joke"]
print(joke_function("time travel to dinosaur age"))