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
Notebook: notebooks/01_a_introduction_to_semantic_kernel.ipynb kann im zweiten Code-Block nicht ausgeführt werden innerhalb des vorbereiteten DevContainers.
Fehlermeldung:
ImportError: cannot import name 'Url' from 'pydantic.networks' (/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/pydantic/networks.py)
Code-Block:
fromsemantic_kernelimportKernelfromsemantic_kernel.connectors.ai.open_aiimportAzureChatCompletion, AzureTextEmbeddingfromsemantic_kernel.contentsimportChatHistorykernel=Kernel()
service_id="chat-gpt"chat_service=AzureChatCompletion(
service_id=service_id,
)
embedding_service_id="embeddings"kernel.add_service(AzureTextEmbedding(service_id=embedding_service_id))
settings=chat_service.get_prompt_execution_settings_class()
settings.temperature=0.7settings.top_p=0.8kernel.add_service(chat_service)
# Test the kernelprint("Kernel initialized successfully!")
Trace:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[2], <a href='vscode-notebook-cell:?execution_count=2&line=1'>line 1</a>
----> <a href='vscode-notebook-cell:?execution_count=2&line=1'>1</a> from semantic_kernel import Kernel
<a href='vscode-notebook-cell:?execution_count=2&line=2'>2</a> from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion, AzureTextEmbedding
<a href='vscode-notebook-cell:?execution_count=2&line=3'>3</a> from semantic_kernel.contents import ChatHistory
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/__init__.py:3
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/__init__.py:1'>1</a> # Copyright (c) Microsoft. All rights reserved.
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/__init__.py:3'>3</a> from semantic_kernel.kernel import Kernel
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/__init__.py:5'>5</a> __version__ = "1.15.0"
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/__init__.py:6'>6</a> __all__ = ["Kernel", "__version__"]
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:8
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:5'>5</a> from copy import copy
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:6'>6</a> from typing import TYPE_CHECKING, Any, Literal, TypeVar
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:8'>8</a> from semantic_kernel.connectors.ai.embeddings.embedding_generator_base import EmbeddingGeneratorBase
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:9'>9</a> from semantic_kernel.const import METADATA_EXCEPTION_KEY
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel.py:10'>10</a> from semantic_kernel.contents.chat_history import ChatHistory
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/__init__.py:3
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/__init__.py:1'>1</a> # Copyright (c) Microsoft. All rights reserved.
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/__init__.py:3'>3</a> from semantic_kernel.connectors.ai.prompt_execution_settings import PromptExecutionSettings
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/__init__.py:5'>5</a> __all__ = ["PromptExecutionSettings"]
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:8
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:4'>4</a> from typing import Any, TypeVar
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:6'>6</a> from pydantic import Field, model_validator
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:8'>8</a> from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:9'>9</a> from semantic_kernel.kernel_pydantic import KernelBaseModel
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/prompt_execution_settings.py:11'>11</a> logger = logging.getLogger(__name__)
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:10
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:6'>6</a> from typing import TYPE_CHECKING, Literal, TypeVar
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:8'>8</a> from typing_extensions import deprecated
---> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:10'>10</a> from semantic_kernel.connectors.ai.function_calling_utils import _combine_filter_dicts
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:11'>11</a> from semantic_kernel.exceptions.service_exceptions import ServiceInitializationError
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_choice_behavior.py:12'>12</a> from semantic_kernel.kernel_pydantic import KernelBaseModel
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:6
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:3'>3</a> from collections import OrderedDict
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:4'>4</a> from typing import TYPE_CHECKING, Any
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:6'>6</a> from semantic_kernel.contents.chat_message_content import ChatMessageContent
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:7'>7</a> from semantic_kernel.contents.function_result_content import FunctionResultContent
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/connectors/ai/function_calling_utils.py:8'>8</a> from semantic_kernel.contents.utils.author_role import AuthorRole
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/__init__.py:3
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/__init__.py:1'>1</a> # Copyright (c) Microsoft. All rights reserved.
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/__init__.py:3'>3</a> from semantic_kernel.contents.annotation_content import AnnotationContent
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/__init__.py:4'>4</a> from semantic_kernel.contents.audio_content import AudioContent
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/__init__.py:5'>5</a> from semantic_kernel.contents.chat_history import ChatHistory
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:10
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:7'>7</a> from pydantic import Field
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:9'>9</a> from semantic_kernel.contents.const import ANNOTATION_CONTENT_TAG, ContentTypes
---> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:10'>10</a> from semantic_kernel.contents.kernel_content import KernelContent
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:11'>11</a> from semantic_kernel.utils.experimental_decorator import experimental_class
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/annotation_content.py:13'>13</a> logger = logging.getLogger(__name__)
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:8
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:4'>4</a> from typing import Any, TypeVar
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:6'>6</a> from pydantic import Field
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:8'>8</a> from semantic_kernel.kernel_pydantic import KernelBaseModel
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:10'>10</a> _T = TypeVar("_T", bound="KernelContent")
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/contents/kernel_content.py:13'>13</a> class KernelContent(KernelBaseModel, ABC):
File /workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:7
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:4'>4</a> from typing import Annotated, Any, ClassVar, TypeVar
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:6'>6</a> from pydantic import BaseModel, ConfigDict, Field, UrlConstraints
----> <a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:7'>7</a> from pydantic.networks import Url
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:8'>8</a> from pydantic_settings import BaseSettings, SettingsConfigDict
<a href='/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/semantic_kernel/kernel_pydantic.py:10'>10</a> HttpsUrl = Annotated[Url, UrlConstraints(max_length=2083, allowed_schemes=["https"])]
ImportError: cannot import name 'Url' from 'pydantic.networks' (/workspaces/wd-ai-hackathon/.venv/lib/python3.12/site-packages/pydantic/networks.py)
Steps to reproduce:
DevContainer erstellen
Sanity Check in notebooks/00_hello_world.ipynb ausführen
In notebooks/01_a_introduction_to_semantic_kernel.ipynb wechseln
Ersten Code-Block ausführen -> sollte funktionieren
Zweiten Code-Block ausführen -> Fehlermeldung
The text was updated successfully, but these errors were encountered:
Problem lag an pydantic version.
Wenn version nicht explizit gesetzt wird, dann wird die latest version im Container verwendet.
Hierzu auch ein Issue auf dem offiziellen Repo: microsoft/semantic-kernel#9777
pydantic <= 2.9.2 sollte kein Problem machen.
Description:
Notebook:
notebooks/01_a_introduction_to_semantic_kernel.ipynb
kann im zweiten Code-Block nicht ausgeführt werden innerhalb des vorbereiteten DevContainers.Fehlermeldung:
Code-Block:
Trace:
Steps to reproduce:
notebooks/00_hello_world.ipynb
ausführennotebooks/01_a_introduction_to_semantic_kernel.ipynb
wechselnThe text was updated successfully, but these errors were encountered: