mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
### Motivation and Context The `python-preview` branch is under active development and many docs/tests/examples are getting a bit out of sync. There are also a few small cleanup chores/refactors to make _usage_ easier (e.g., to make examples cleaner). I've grouped these small fixes (plus a few bug fixes) into this "cleanup" PR. ### Description This PR does the following: 1. Updates the out-of-date example in `README.md` 2. Fixes all 5 of the notebooks we support right now (1,2,3,4, and 6; notebook 5 is planner, I've blanked out most of the code there so we don't confuse people, especially as the planner API is changing) 3. Fixes a bug w/ `stop_sequences` in `(Azure)OpenAITextCompletion` 4. Fixes a bug introduced in our upgrades to the embeddings cosine-sim check (we should add more thorough tests here) 5. Cleans up tests 6. Ensures end-to-end tests are all runnable 7. Fixes up the `kernel_extensions` to work more naturally (so that end users can use them directly on the `kernel` object and get good type-hinting)
48 lines
1.5 KiB
Python
48 lines
1.5 KiB
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
from semantic_kernel import core_skills, memory
|
|
from semantic_kernel.kernel import Kernel
|
|
from semantic_kernel.kernel_builder import KernelBuilder
|
|
from semantic_kernel.kernel_config import KernelConfig
|
|
from semantic_kernel.memory.null_memory import NullMemory
|
|
from semantic_kernel.orchestration.context_variables import ContextVariables
|
|
from semantic_kernel.orchestration.sk_context import SKContext
|
|
from semantic_kernel.orchestration.sk_function_base import SKFunctionBase
|
|
from semantic_kernel.semantic_functions.chat_prompt_template import ChatPromptTemplate
|
|
from semantic_kernel.semantic_functions.prompt_template import PromptTemplate
|
|
from semantic_kernel.semantic_functions.prompt_template_config import (
|
|
PromptTemplateConfig,
|
|
)
|
|
from semantic_kernel.semantic_functions.semantic_function_config import (
|
|
SemanticFunctionConfig,
|
|
)
|
|
from semantic_kernel.utils.null_logger import NullLogger
|
|
from semantic_kernel.utils.settings import (
|
|
azure_openai_settings_from_dot_env,
|
|
openai_settings_from_dot_env,
|
|
)
|
|
|
|
|
|
def create_kernel() -> Kernel:
|
|
return KernelBuilder.create_kernel()
|
|
|
|
|
|
def kernel_builder() -> KernelBuilder:
|
|
return KernelBuilder(KernelConfig(), NullMemory(), NullLogger())
|
|
|
|
|
|
__all__ = [
|
|
"create_kernel",
|
|
"openai_settings_from_dot_env",
|
|
"azure_openai_settings_from_dot_env",
|
|
"PromptTemplateConfig",
|
|
"PromptTemplate",
|
|
"ChatPromptTemplate",
|
|
"SemanticFunctionConfig",
|
|
"ContextVariables",
|
|
"SKFunctionBase",
|
|
"SKContext",
|
|
"memory",
|
|
"core_skills",
|
|
]
|