First code does not run
Describe the bug running the 01-semantic-kernel.ipynb i found that the last code cannot be executed
To Reproduce Steps to reproduce the behavior: 1.running the complete notebook
Expected behavior Should work but no
Screenshots there the error raised
InternalServerError Traceback (most recent call last) File c:\Python311\Lib\site-packages\semantic_kernel\connectors\ai\open_ai\services\open_ai_handler.py:87, in OpenAIHandler._send_completion_request(self, settings) 86 settings_dict.pop("parallel_tool_calls", None) ---> 87 response = await self.client.chat.completions.create(**settings_dict) 88 else:
File ~\AppData\Roaming\Python\Python311\site-packages\openai\resources\chat\completions\completions.py:2028, in AsyncCompletions.create(self, messages, model, audio, frequency_penalty, function_call, functions, logit_bias, logprobs, max_completion_tokens, max_tokens, metadata, modalities, n, parallel_tool_calls, prediction, presence_penalty, reasoning_effort, response_format, seed, service_tier, stop, store, stream, stream_options, temperature, tool_choice, tools, top_logprobs, top_p, user, web_search_options, extra_headers, extra_query, extra_body, timeout) 2027 validate_response_format(response_format) -> 2028 return await self._post( 2029 "/chat/completions", 2030 body=await async_maybe_transform( 2031 { 2032 "messages": messages, 2033 "model": model, 2034 "audio": audio, 2035 "frequency_penalty": frequency_penalty, 2036 "function_call": function_call, 2037 "functions": functions, 2038 "logit_bias": logit_bias, 2039 "logprobs": logprobs, 2040 "max_completion_tokens": max_completion_tokens, 2041 "max_tokens": max_tokens, 2042 "metadata": metadata, 2043 "modalities": modalities, ... 105 f"{type(self)} service failed to complete the prompt", 106 ex, 107 ) from ex
ServiceResponseException: ("<class 'semantic_kernel.connectors.ai.open_ai.services.open_ai_chat_completion.OpenAIChatCompletion'> service failed to complete the prompt", InternalServerError("Error code: 500 - {'error': {'code': 'unknown', 'message': 'Unhandled exception: Specified method is not supported.', 'details': 'Unhandled exception: Specified method is not supported.'}}"))
Desktop (please complete the following information):
- OS: Windows 11
- inside VS Code
👋 Thanks for contributing @etellezgh! We will review the issue and get back to you soon.
Issue with Semantic Kernel Notebook Imports
Hey team,
I’m trying to run the 01-semantic-kernel.ipynb notebook in a virtual environment with the required package versions (semantic_kernel>=1.27.2, pydantic>=2.10.0,<3.0.0, plus openai, python-dotenv, etc). However, I’m stuck on the cell where we import everything due to two errors:
-
First Error: Got an
ImportError: cannot import name 'Url' from 'pydantic.networks'. I fixed this by patching the import to useHttpUrlforpydanticv2 compatibility, asUrlwas removed inpydantic>=2.0. -
Second Error: After resolving the first issue, I now get
ModuleNotFoundError: No module named 'semantic_kernel.agents'when importingChatCompletionAgentandChatHistoryAgentThread. It seems theagentsmodule might not exist insemantic_kernel==1.27.2or was moved (triedsemantic_kernel.experimental.agentsbut no luck).
I’ve set up a fresh virtual environment, installed the exact versions, and restarted the Jupyter kernel, but I can’t get past this cell. Could you confirm if the notebook is compatible with semantic_kernel>=1.27.2? If the agents module was restructured, what’s the updated import path or recommended version? Any help or updated code would be great!
Thanks, Tammy Python 3.12.10 Mac OS Sequoia 15.4.1
Thanks for reporting, working on a fix. Will submit a PR when complete.
Hey @tdiprima and @etellezgh - I wasnt able to reproduce this but I was I have update the requriements.txt file to support the lastest version of SK and remove Pydantic in case there is a conflict here. Can you try reinstalling?
pip uninstall -r requirements.txt -y
pip install -r requirements.txt
Hi @koreyspace - it worked for me. Thanks for looking into this.
Hey @etellezgh — just a heads up, I noticed a lot of 'Python311' in your message. The setup guide says to use python3.12 instead. Switching to that is what got things working for me!
Closing this for now - if you still have issues @etellezgh please reopen