nip.utils.api

nip.utils.api#

Utilities for dealing with APIs.

Exceptions

ConnectionError(message[, metadata, num_retries])

Base class for exceptions regarding connection errors.

ContentFilterError([num_retries])

Raised when the agent's response is blocked by a content filter.

ContentIsNoneError([num_retries])

Raised when the content of the generated message is None.

GenerationError([num_retries])

Base class for exceptions raised during generation of the next message.

GenericConnectionError(message[, code, ...])

A generic connection error, which doesn't have its own specific class.

InsufficientCreditsError(message[, ...])

Raised when the user does not have enough credits to make a request.

InvalidDecisionError(response_text[, ...])

Raised when the agent's decision is invalid (i.e. not accept or reject).

NotAllActiveChannelsInResponseError(...[, ...])

Raised when the response does not contain messages for all active channels.

NotGuessedError([num_retries])

Raised when the agent has not made a decision within the max number of turns.

RateLimitError(message[, metadata, num_retries])

Raised when the rate limit is exceeded.

ResponseError([num_retries])

Raised when the response has been correctly received but is malformed.

TimeoutError(message[, metadata, num_retries])

Raised when the request times out.

UnknownFinishReasonError(reason[, num_retries])

Raised when the agent's finishes generating for an unknown reason.

UnparsableResponseError(response_text[, ...])

Raised when the agent's response text is not able to be parsed.