mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
df9d85d1f0
* openai updates * rebuild of openai structure * updated responses structure * renamed sample * added file id support to code interpreter * added hosted file ids to code interpretor * mypy fixes * removed default az cred from codebase * updated agent name setup * added kwargs to entra methods * and further kwargs * extra comment * updated all samples * readded custom get methods for responses * updated int tests with ad credential * missed one
97 lines
2.1 KiB
Python
97 lines
2.1 KiB
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
import logging
|
|
from typing import Any
|
|
|
|
logger = logging.getLogger("agent_framework")
|
|
|
|
|
|
class AgentFrameworkException(Exception):
|
|
"""Base exceptions for the Agent Framework.
|
|
|
|
Automatically logs the message as debug.
|
|
"""
|
|
|
|
def __init__(self, message: str, inner_exception: Exception | None = None, *args: Any, **kwargs: Any):
|
|
"""Create an AgentFrameworkException.
|
|
|
|
This emits a debug log, with the inner_exception if provided.
|
|
"""
|
|
logger.debug(message, exc_info=inner_exception)
|
|
super().__init__(message, *args, **kwargs) # type: ignore
|
|
|
|
|
|
class AgentException(AgentFrameworkException):
|
|
"""Base class for all agent exceptions."""
|
|
|
|
pass
|
|
|
|
|
|
class AgentExecutionException(AgentException):
|
|
"""An error occurred while executing the agent."""
|
|
|
|
pass
|
|
|
|
|
|
# region Service Exceptions
|
|
|
|
|
|
class ServiceException(AgentFrameworkException):
|
|
"""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 ServiceContentFilterException(ServiceResponseException):
|
|
"""An error was raised by the content filter of the service."""
|
|
|
|
pass
|
|
|
|
|
|
class ServiceInvalidAuthError(ServiceException):
|
|
"""An error occurred while authenticating the service."""
|
|
|
|
pass
|
|
|
|
|
|
class ServiceInvalidExecutionSettingsError(ServiceResponseException):
|
|
"""An error occurred while validating the execution settings of the service."""
|
|
|
|
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 ToolException(AgentFrameworkException):
|
|
"""An error occurred while executing a tool."""
|
|
|
|
pass
|
|
|
|
|
|
class ToolExecutionException(ToolException):
|
|
"""An error occurred while executing a tool."""
|
|
|
|
pass
|