You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncdefmain():
# Initialize the kernelkernel=Kernel()
# Add Azure OpenAI chat completionservice_id="default"kernel.add_service(
AzureChatCompletion(
service_id=service_id,
),
)
# Set the logging level for semantic_kernel.kernel to DEBUG.setup_logging()
logging.getLogger("kernel").setLevel(logging.DEBUG)
# Add a plugin (the LightsPlugin class is defined below)plugin=kernel.add_plugin(parent_directory="./plugins/", plugin_name="LightsPlugin")
execution_settings=AzureChatPromptExecutionSettings(
function_choice_behavior=FunctionChoiceBehavior.Auto()
)
# Create a history of the conversationhistory=ChatHistory()
# Initiate a back-and-forth chatuserInput=NonewhileTrue:
# Collect user inputuserInput=input("User > ")
# Terminate the loop if the user says "exit"ifuserInput=="exit":
break# Add user input to the historyhistory.add_user_message(userInput)
chat_completion : AzureChatCompletion=kernel.get_service(type=ChatCompletionClientBase)
# Get the response from the AIresult=awaitchat_completion.get_chat_message_content(
chat_history=history,
settings=execution_settings,
kernel=kernel,
kernel_arguments=KernelArguments()
)
# Print the resultsprint("Assistant > "+str(result))
# Add the message from the agent to the chat historyhistory.add_message(result)
# Run the main functionif__name__=="__main__":
asyncio.run(main())
Expected behavior
My expectation was to get a response from the "assistant" similar to the c# version.
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
OS: Windows
IDE: VS Code
Language: Python
Source: Semantic Kernel 1.17.1, Python 3.11.9
Additional context
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
Bug: While using AzureChatCompletion FunctionChoiceBehavior.Auto() returns error
.Net: Bug: While using AzureChatCompletion FunctionChoiceBehavior.Auto() returns error
Jan 7, 2025
github-actionsbot
changed the title
.Net: Bug: While using AzureChatCompletion FunctionChoiceBehavior.Auto() returns error
Python: Bug: While using AzureChatCompletion FunctionChoiceBehavior.Auto() returns error
Jan 7, 2025
Describe the bug
While calling chat_completion.get_chat_message_content(...) returns the following error:
To Reproduce
from MS Learn example: https://learn.microsoft.com/en-us/semantic-kernel/get-started/quick-start-guide?pivots=programming-language-python
I have this code
Expected behavior
My expectation was to get a response from the "assistant" similar to the c# version.
Screenshots
If applicable, add screenshots to help explain your problem.
Platform
Additional context
The text was updated successfully, but these errors were encountered: