mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
### Motivation and Context * Removing the requirements.txt and just pinning each notebook to a pip package that should work. Doing this allows users to run notebooks without error even if the code in the core repo updates. When a new pip package is released, we will bump the version number in each notebook. * Fix usage of context variables. Apps should avoid using anonymous context variables and prefer using the context, to retain access to the kernel internals during the orchestration. --------- Co-authored-by: Alex Chao <[email protected]> Co-authored-by: Devis Lucato <[email protected]>
3.2 KiB
3.2 KiB
In [ ]:
!python -m pip install semantic-kernel==0.2.7.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"))