Skip to content

Commit

Permalink
build: bump semantic-kernel from 0.9.7b1 to 0.9.8b1 (#894)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chinedum Echeta <60179183+cecheta@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and cecheta authored May 13, 2024
1 parent 602ba31 commit fab857b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 53 deletions.
8 changes: 4 additions & 4 deletions code/backend/batch/utilities/orchestrator/SemanticKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import logging

from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai.utils import get_tool_call_object
from semantic_kernel.connectors.ai.function_call_behavior import FunctionCallBehavior
from semantic_kernel.contents import ChatHistory
from semantic_kernel.contents.finish_reason import FinishReason
from semantic_kernel.contents.chat_message_content import ChatMessageContent
from semantic_kernel.contents.finish_reason import FinishReason

from ..common.Answer import Answer
from ..helpers.llm_helper import LLMHelper
Expand Down Expand Up @@ -49,8 +49,8 @@ async def orchestrate(
)

settings = self.llm_helper.get_sk_service_settings(self.chat_service)
settings.tools = get_tool_call_object(
kernel=self.kernel, filter={"include_plugin": ["Chat"]}
settings.function_call_behavior = FunctionCallBehavior.EnableFunctions(
filters={"included_plugins": ["Chat"]}
)

orchestrate_function = self.kernel.add_function(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def test_post_makes_correct_call_to_openai_chat_completions(
},
},
],
"tool_choice": "auto",
"top_p": 1.0,
},
headers={
Expand Down
52 changes: 10 additions & 42 deletions code/tests/utilities/orchestrator/test_SemanticKernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from backend.batch.utilities.parser.OutputParserTool import OutputParserTool
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
from semantic_kernel.connectors.ai.function_call_behavior import EnabledFunctions
from semantic_kernel.connectors.ai.open_ai.prompt_execution_settings.azure_chat_prompt_execution_settings import (
AzureChatPromptExecutionSettings,
)
Expand Down Expand Up @@ -163,7 +164,7 @@ async def test_chat_plugin_added(


@pytest.mark.asyncio
async def test_openai_functions_included(
async def test_kernel_function_call_behavior(
orchestrator: SemanticKernelOrchestrator,
):
# given
Expand All @@ -175,48 +176,15 @@ async def test_openai_functions_included(
await orchestrator.orchestrate("question", [])

# then
tools = kernel_mock.add_function.call_args.kwargs["prompt_execution_settings"].tools
function_call_behavior: EnabledFunctions = (
kernel_mock.add_function.call_args.kwargs[
"prompt_execution_settings"
].function_call_behavior
)

assert tools == [
{
"type": "function",
"function": {
"name": "Chat-search_documents",
"description": "Provide answers to any fact question coming from users.",
"parameters": {
"type": "object",
"properties": {
"question": {
"description": "A standalone question, converted from the chat history",
"type": "string",
}
},
"required": ["question"],
},
},
},
{
"type": "function",
"function": {
"name": "Chat-text_processing",
"description": "Useful when you want to apply a transformation on the text, like translate, summarize, rephrase and so on.",
"parameters": {
"type": "object",
"properties": {
"text": {
"description": "The text to be processed",
"type": "string",
},
"operation": {
"description": "The operation to be performed on the text. Like Translate to Italian, Summarize, Paraphrase, etc. If a language is specified, return that as part of the operation. Preserve the operation name in the user language.",
"type": "string",
},
},
"required": ["text", "operation"],
},
},
},
]
assert function_call_behavior.auto_invoke_kernel_functions is False
assert function_call_behavior.enable_kernel_functions is True
assert function_call_behavior.filters == {"included_plugins": ["Chat"]}


@pytest.mark.asyncio
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ opentelemetry-instrumentation-httpx = "^0.45b0"
pillow = "10.3.0"
azure-mgmt-cognitiveservices = "^13.5.0"
jsonschema = "^4.22.0"
semantic-kernel = {version = "^0.9.7b1", python = "<3.13"}
semantic-kernel = {version = "^0.9.8b1", python = "<3.13"}

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.0"
Expand Down

0 comments on commit fab857b

Please sign in to comment.