Skip to content

Overview / RateLimitHandler

RateLimitHandler

Extends

  • BaseCallbackHandler

Implements

  • RateLimitHandlerParams

Constructors

new RateLimitHandler()

new RateLimitHandler(input?): RateLimitHandler

Parameters

ParameterType
input?BaseCallbackHandlerInput

Returns

RateLimitHandler

Overrides

BaseCallbackHandler.constructor

Properties

PropertyTypeDefault valueOverrides
availableTokensnumber0-
checkIntervalnumberundefined-
enabledbooleanfalse-
lastRequestnumber0-
maxBucketSizenumberundefined-
namestring'RateLimit'BaseCallbackHandler.name
tokensPerSecondnumberundefined-

Methods

acquire()

acquire(blocking): Promise<boolean>

Parameters

ParameterTypeDefault value
blockingbooleantrue

Returns

Promise<boolean>


consume()

consume(): boolean

Returns

boolean


handleChainStart()

handleChainStart(): Promise<void>

Called at the start of a Chain run, with the chain name and inputs and the run ID.

Returns

Promise<void>

Overrides

BaseCallbackHandler.handleChainStart


handleLLMStart()

handleLLMStart(): Promise<void>

Called at the start of an LLM or Chat Model run, with the prompt(s) and the run ID.

Returns

Promise<void>

Overrides

BaseCallbackHandler.handleLLMStart

Released under the GPL-3.0 License.