chore: import upstream snapshot with attribution
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run

This commit is contained in:
wehub-resource-sync
2026-07-13 13:21:23 +08:00
commit b957a53def
5423 changed files with 863745 additions and 0 deletions
@@ -0,0 +1,13 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.agent_exceptions import * # noqa: F403
from semantic_kernel.exceptions.content_exceptions import * # noqa: F403
from semantic_kernel.exceptions.filter_exceptions import * # noqa: F403
from semantic_kernel.exceptions.function_exceptions import * # noqa: F403
from semantic_kernel.exceptions.kernel_exceptions import * # noqa: F403
from semantic_kernel.exceptions.memory_connector_exceptions import * # noqa: F403
from semantic_kernel.exceptions.process_exceptions import * # noqa: F403
from semantic_kernel.exceptions.search_exceptions import * # noqa: F403
from semantic_kernel.exceptions.service_exceptions import * # noqa: F403
from semantic_kernel.exceptions.template_engine_exceptions import * # noqa: F403
from semantic_kernel.exceptions.vector_store_exceptions import * # noqa: F403
@@ -0,0 +1,58 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class AgentException(KernelException):
"""Base class for all agent exceptions."""
pass
class AgentFileNotFoundException(AgentException):
"""The requested file was not found."""
pass
class AgentInitializationException(AgentException):
"""An error occurred while initializing the agent."""
pass
class AgentExecutionException(AgentException):
"""An error occurred while executing the agent."""
pass
class AgentInvokeException(AgentException):
"""An error occurred while invoking the agent."""
pass
class AgentChatException(AgentException):
"""An error occurred while invoking the agent chat."""
pass
class AgentChatHistoryReducerException(AgentException):
"""An error occurred while reducing the chat history."""
pass
class AgentThreadInitializationException(AgentException):
"""An error occurred while initializing the agent thread."""
pass
class AgentThreadOperationException(AgentException):
"""An error occurred while performing an operation on the agent thread."""
pass
@@ -0,0 +1,56 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class ContentException(KernelException):
"""Base class for all content exceptions."""
pass
class ContentInitializationError(ContentException):
"""An error occurred while initializing the content."""
pass
class ContentSerializationError(ContentException):
"""An error occurred while serializing the content."""
pass
class ContentAdditionException(ContentException):
"""An error occurred while adding content."""
pass
class FunctionCallInvalidNameException(ContentException):
"""An error occurred while validating the function name."""
pass
class FunctionCallInvalidArgumentsException(ContentException):
"""An error occurred while validating the function arguments."""
pass
class ChatHistoryReducerException(ContentException):
"""An error occurred while reducing chat history."""
pass
__all__ = [
"ChatHistoryReducerException",
"ContentAdditionException",
"ContentException",
"ContentInitializationError",
"ContentSerializationError",
"FunctionCallInvalidArgumentsException",
"FunctionCallInvalidNameException",
]
@@ -0,0 +1,20 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class FilterException(KernelException):
"""Base class for all filter exceptions."""
pass
class FilterManagementException(FilterException):
"""An error occurred while adding or removing the filter to/from the kernel."""
pass
__all__ = [
"FilterException",
"FilterManagementException",
]
@@ -0,0 +1,91 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class FunctionException(KernelException):
"""Base class for all function exceptions."""
pass
class FunctionSyntaxError(FunctionException):
"""Base class for all function syntax exceptions."""
pass
class FunctionInitializationError(FunctionException):
"""An error occurred while initializing the function."""
def __init__(self, message: str):
"""Adds the context of the error to the generic message."""
super().__init__("KernelFunction failed to initialize: " + message)
class PluginInitializationError(FunctionException):
"""An error occurred while initializing the plugin."""
pass
class PluginInvalidNameError(FunctionSyntaxError):
"""An error occurred while validating the plugin name."""
pass
class FunctionInvalidNameError(FunctionSyntaxError):
"""An error occurred while validating the function name."""
pass
class FunctionInvalidParamNameError(FunctionSyntaxError):
"""An error occurred while validating the function parameter name."""
pass
class FunctionNameNotUniqueError(FunctionSyntaxError):
"""An error occurred while validating the function name."""
pass
class FunctionExecutionException(FunctionException):
"""Base class for all function execution exceptions."""
pass
class FunctionResultError(FunctionException):
"""An error occurred while validating the function result."""
pass
class FunctionInvalidParameterConfiguration(FunctionException):
"""An error occurred while validating the function parameter configuration."""
pass
class PromptRenderingException(FunctionException):
"""An error occurred while rendering a prompt."""
pass
__all__ = [
"FunctionException",
"FunctionExecutionException",
"FunctionInitializationError",
"FunctionInvalidNameError",
"FunctionInvalidParamNameError",
"FunctionNameNotUniqueError",
"FunctionResultError",
"FunctionSyntaxError",
"PluginInitializationError",
"PluginInvalidNameError",
"PromptRenderingException",
]
@@ -0,0 +1,70 @@
# Copyright (c) Microsoft. All rights reserved.
# Even though there is no strict separation between errors and exceptions in Python, it is a good practice to use:
# - Exceptions for exceptional conditions that a reasonable application may wish to catch.
# - Errors for exceptional conditions that are not reasonable to catch.
# for instance syntax errors in a template should be called ...Error,
# while rendering of the same template should raise an ...Exception.
# every error should derive from KernelException (including errors)
# all raised exceptions should use the raise ... from exc syntax to preserve the original traceback
class KernelException(Exception):
"""The base class for all Semantic Kernel exceptions."""
pass
class KernelServiceNotFoundError(KernelException):
"""Raised when a service is not found in the kernel."""
pass
class KernelPluginNotFoundError(KernelException):
"""Raised when a plugin is not found in the kernel."""
pass
class KernelPluginInvalidConfigurationError(KernelException):
"""Raised when a plugin configuration is invalid."""
pass
class KernelFunctionNotFoundError(KernelException):
"""Raised when a function is not found in the kernel."""
pass
class KernelFunctionAlreadyExistsError(KernelException):
"""Raised when a function is already registered in the kernel."""
pass
class KernelInvokeException(KernelException):
"""Raised when an error occurs while invoking a function in the kernel."""
pass
class OperationCancelledException(KernelException):
"""Raised when an operation is cancelled."""
pass
__all__ = [
"KernelException",
"KernelFunctionAlreadyExistsError",
"KernelFunctionNotFoundError",
"KernelInvokeException",
"KernelPluginInvalidConfigurationError",
"KernelPluginNotFoundError",
"KernelServiceNotFoundError",
"OperationCancelledException",
]
@@ -0,0 +1,36 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class MemoryConnectorException(KernelException):
"""Base class for all memory connector exceptions."""
pass
class MemoryConnectorConnectionException(MemoryConnectorException):
"""An error occurred while connecting to the memory connector."""
pass
class MemoryConnectorInitializationError(MemoryConnectorException):
"""An error occurred while initializing the memory connector."""
pass
class MemoryConnectorResourceNotFound(MemoryConnectorException):
"""The requested resource was not found in the memory connector."""
pass
__all__ = [
"MemoryConnectorConnectionException",
"MemoryConnectorException",
"MemoryConnectorInitializationError",
"MemoryConnectorResourceNotFound",
]
@@ -0,0 +1,34 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class ProcessException(KernelException):
"""Base class for all process exceptions."""
pass
class ProcessInvalidConfigurationException(ProcessException):
"""An invalid configuration was provided for the process."""
pass
class ProcessTargetFunctionNameMismatchException(ProcessException):
"""A message targeting a function has resulted in a different function becoming invocable."""
pass
class ProcessFunctionNotFoundException(ProcessException):
"""A function was not found in the process."""
pass
class ProcessEventUndefinedException(ProcessException):
"""An event was not defined in the process."""
pass
@@ -0,0 +1,35 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class SearchException(KernelException):
"""Base class for all Search related exceptions."""
pass
class SearchResultEmptyError(SearchException):
"""Raised when there are no hits in the search results."""
pass
class TextSearchException(SearchException):
"""An error occurred while executing a text search function."""
pass
class TextSearchOptionsException(SearchException):
"""Raised when invalid options are given to a TextSearch function."""
pass
__all__ = [
"SearchException",
"SearchResultEmptyError",
"TextSearchException",
"TextSearchOptionsException",
]
@@ -0,0 +1,78 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class ServiceException(KernelException):
"""Base class for all service exceptions."""
pass
class ServiceInitializationError(ServiceException):
"""An error occurred while initializing the service."""
pass
class ServiceResponseException(ServiceException):
"""Base class for all service response exceptions."""
pass
class ServiceInvalidAuthError(ServiceException):
"""An error occurred while authenticating the service."""
pass
class ServiceInvalidTypeError(ServiceResponseException):
"""An error occurred while validating the type of the service request."""
pass
class ServiceInvalidRequestError(ServiceResponseException):
"""An error occurred while validating the request to the service."""
pass
class ServiceInvalidResponseError(ServiceResponseException):
"""An error occurred while validating the response from the service."""
pass
class ServiceInvalidExecutionSettingsError(ServiceResponseException):
"""An error occurred while validating the execution settings of the service."""
pass
class ServiceContentFilterException(ServiceResponseException):
"""An error was raised by the content filter of the service."""
pass
class ServiceResourceNotFoundError(ServiceException):
"""The request service could not be found."""
pass
__all__ = [
"ServiceContentFilterException",
"ServiceException",
"ServiceInitializationError",
"ServiceInvalidAuthError",
"ServiceInvalidExecutionSettingsError",
"ServiceInvalidRequestError",
"ServiceInvalidResponseError",
"ServiceInvalidTypeError",
"ServiceResourceNotFoundError",
"ServiceResponseException",
]
@@ -0,0 +1,154 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class BlockException(KernelException):
"""Base class for all block exceptions."""
pass
class BlockSyntaxError(BlockException):
"""A invalid block syntax was found."""
pass
class BlockRenderException(BlockException):
"""An error occurred while rendering a block."""
pass
class VarBlockSyntaxError(BlockSyntaxError):
"""A invalid VarBlock syntax was found."""
def __init__(self, content: str) -> None:
"""Adds the context of the error to the generic message."""
super().__init__(
f"A VarBlock starts with a '$' followed by at least one letter, \
number or underscore, anything else is invalid. \
The content provided was: {content}",
)
class VarBlockRenderError(BlockRenderException):
"""An error occurred while rendering a VarBlock."""
pass
class ValBlockSyntaxError(BlockSyntaxError):
"""A invalid ValBlock syntax was found."""
def __init__(self, content: str) -> None:
"""Adds the context of the error to the generic message."""
super().__init__(
f"A ValBlock starts with a single or double quote followed by at least one letter, \
finishing with the same type of quote as the first one. \
The content provided was: {content}",
)
class NamedArgBlockSyntaxError(BlockSyntaxError):
"""A invalid NamedArgBlock syntax was found."""
def __init__(self, content: str) -> None:
"""Adds the context of the error to the generic message."""
super().__init__(
f"A NamedArgBlock starts with a name (letters, numbers or underscore) \
followed by a single equal sign, then the value of the argument, \
which can either be a VarBlock (starting with '$') \
or a ValBlock (text surrounded by quotes). \
The content provided was: {content}",
)
class FunctionIdBlockSyntaxError(BlockSyntaxError):
"""A invalid FunctionIdBlock syntax was found."""
def __init__(self, content: str) -> None:
"""Adds the context of the error to the generic message."""
super().__init__(
f"A FunctionIdBlock is composed of either a plugin name and \
function name separated by a single dot, or just a function name. \
Both plugin and function names can only contain letters, numbers and underscores. \
The content provided was: {content}",
)
class CodeBlockSyntaxError(BlockSyntaxError):
"""A invalid CodeBlock syntax was found."""
pass
class CodeBlockTokenError(BlockException):
"""An error occurred while tokenizing a CodeBlock."""
pass
class CodeBlockRenderException(BlockRenderException):
"""An error occurred while rendering a CodeBlock."""
pass
class TemplateSyntaxError(BlockSyntaxError):
"""A invalid Template syntax was found."""
pass
class TemplateRenderException(BlockRenderException):
"""An error occurred while rendering a Template."""
pass
class HandlebarsTemplateSyntaxError(BlockSyntaxError):
"""A invalid HandlebarsTemplate syntax was found."""
pass
class HandlebarsTemplateRenderException(BlockRenderException):
"""An error occurred while rendering a HandlebarsTemplate."""
pass
class Jinja2TemplateSyntaxError(BlockSyntaxError):
"""A invalid Jinja2Template syntax was found."""
pass
class Jinja2TemplateRenderException(BlockRenderException):
"""An error occurred while rendering a Jinja2Template."""
pass
__all__ = [
"BlockException",
"BlockRenderException",
"BlockSyntaxError",
"CodeBlockRenderException",
"CodeBlockSyntaxError",
"CodeBlockTokenError",
"FunctionIdBlockSyntaxError",
"HandlebarsTemplateRenderException",
"HandlebarsTemplateSyntaxError",
"Jinja2TemplateRenderException",
"Jinja2TemplateSyntaxError",
"NamedArgBlockSyntaxError",
"TemplateRenderException",
"TemplateSyntaxError",
"ValBlockSyntaxError",
"VarBlockRenderError",
"VarBlockSyntaxError",
]
@@ -0,0 +1,85 @@
# Copyright (c) Microsoft. All rights reserved.
from semantic_kernel.exceptions.kernel_exceptions import KernelException
class VectorStoreException(KernelException):
"""Base class for all vector store exceptions."""
pass
class VectorStoreInitializationException(VectorStoreException):
"""Class for all vector store initialization exceptions."""
pass
class VectorStoreModelException(VectorStoreException):
"""Base class for all vector store model exceptions."""
pass
class VectorStoreModelSerializationException(VectorStoreModelException):
"""An error occurred while serializing the vector store model."""
pass
class VectorStoreModelDeserializationException(VectorStoreModelException):
"""An error occurred while deserializing the vector store model."""
pass
class VectorStoreModelValidationError(VectorStoreModelException):
"""An error occurred while validating the vector store model."""
pass
class VectorStoreMixinException(VectorStoreException):
"""Raised when a mixin is used without the VectorSearchBase Class."""
pass
class VectorStoreOperationException(VectorStoreException):
"""An error occurred while performing an operation on the vector store record collection."""
pass
class VectorStoreOperationNotSupportedException(VectorStoreOperationException):
"""An error occurred while performing an operation on the vector store record collection."""
pass
class VectorSearchExecutionException(VectorStoreOperationException):
"""Raised when there is an error executing a VectorSearch function."""
pass
class VectorSearchOptionsException(VectorStoreOperationException):
"""Raised when invalid options are given to a VectorSearch function."""
pass
__all__ = [
"VectorSearchExecutionException",
"VectorSearchOptionsException",
"VectorStoreException",
"VectorStoreInitializationException",
"VectorStoreMixinException",
"VectorStoreModelDeserializationException",
"VectorStoreModelException",
"VectorStoreModelException",
"VectorStoreModelSerializationException",
"VectorStoreModelValidationError",
"VectorStoreOperationException",
"VectorStoreOperationNotSupportedException",
]