genai.exceptions module#

exception genai.exceptions.ApiNetworkException[source]#

Bases: BaseApiException

Exception raised when there is a network-related error during API communication (‘httpx’ related error).

message#

Explanation of the error.

Type:

str

__init__(message=None, *args)[source]#
Parameters:

message (str | None) –

Return type:

None

exception genai.exceptions.ApiResponseException[source]#

Bases: BaseApiException

Exception class for API with valid response body.

__init__(response, message=None, *args)[source]#
Parameters:
  • response (BaseErrorResponse | dict) –

  • message (str | None) –

Return type:

None

classmethod from_http_response(response, message=None)[source]#
Parameters:
  • response (Response) –

  • message (str | None) –

response: BaseErrorResponse#
exception genai.exceptions.BaseApiException[source]#

Bases: Exception

Exception class for API related errors.

message: str#
exception genai.exceptions.ValidationError#

Bases: ValueError

error_count()#
errors(*, include_url=True, include_context=True, include_input=True)#
static from_exception_data(title, line_errors, input_type='python', hide_input=False)#
json(*, indent=None, include_url=True, include_context=True, include_input=True)#
title#