Skip to content

Latest commit

 

History

History
547 lines (304 loc) · 12.9 KB

History.Iteration.md

File metadata and controls

547 lines (304 loc) · 12.9 KB

@guardrails-ai/core / Exports / History / Iteration

Class: Iteration<T>

History.Iteration

Type parameters

Name
T

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Iteration<T>(inputs?, outputs?, logs?, tokensConsumed?, promptTokensConsumed?, completionTokensConsumed?, rawOutput?, parsedOutput?, validationOutput?, validatedOutput?, reasks?, validatorLogs?, error?, exception?, failedValidations?, status?): Iteration<T>

Type parameters

Name
T

Parameters

Name Type
inputs? Inputs
outputs? Outputs<T>
logs? Stack<string>
tokensConsumed? number
promptTokensConsumed? number
completionTokensConsumed? number
rawOutput? string
parsedOutput? T
validationOutput? ReAsk | T
validatedOutput? T
reasks? ReAsk[]
validatorLogs? ValidatorLogs[]
error? string
exception? Error
failedValidations? ValidatorLogs[]
status? string

Returns

Iteration<T>

Defined in

src/history/iteration.ts:98

Properties

_completionTokensConsumed

Private Optional _completionTokensConsumed: number

Returns the number of completion/output tokens consumed during this iteration.

Defined in

src/history/iteration.ts:38


_error

Private Optional _error: string

The error message from any exception that raised and interrupted this iteration.

Defined in

src/history/iteration.ts:78


_exception

Private Optional _exception: Error

The exception that interrupted this iteration.

Defined in

src/history/iteration.ts:84


_failedValidations

Private Optional _failedValidations: ValidatorLogs[]

The validator logs for any validations that failed during this iteration.

Defined in

src/history/iteration.ts:90


_inputs

Private _inputs: Inputs

The inputs for the iteration/step.

Defined in

src/history/iteration.ts:13


_logs

Private _logs: Stack<string>

Returns the logs from this iteration as a stack.

Defined in

src/history/iteration.ts:23


_outputs

Private _outputs: Outputs<T>

The outputs from the iteration/step.

Defined in

src/history/iteration.ts:18


_parsedOutput

Private Optional _parsedOutput: T

The output from the LLM after undergoing parsing but before validation.

Defined in

src/history/iteration.ts:48


_promptTokensConsumed

Private Optional _promptTokensConsumed: number

Returns the number of prompt/input tokens consumed during this iteration.

Defined in

src/history/iteration.ts:33


_rawOutput

Private Optional _rawOutput: string

The exact output from the LLM.

Defined in

src/history/iteration.ts:43


_reasks

Private Optional _reasks: ReAsk[]

Reasks generated during validation. These would be incorporated into the prompt or the next LLM call.

Defined in

src/history/iteration.ts:68


_status

Private Optional _status: string

Representation of the end state of this iteration. OneOf: pass, fail, error, not run

Defined in

src/history/iteration.ts:96


_tokensConsumed

Private Optional _tokensConsumed: number

Returns the total number of tokens consumed during this iteration.

Defined in

src/history/iteration.ts:28


_validatedOutput

Private Optional _validatedOutput: T

The valid output from the LLM after undergoing validation. Could be only a partial structure if field level reasks occur. Could contain fixed values.

Defined in

src/history/iteration.ts:62


_validationOutput

Private Optional _validationOutput: ReAsk | T

The output from the validation process. Could be a combination of valid output and ReAsks

Defined in

src/history/iteration.ts:54


_validatorLogs

Private Optional _validatorLogs: ValidatorLogs[]

The results of each individual validation performed on the LLM response during this iteration.

Defined in

src/history/iteration.ts:73

Accessors

completionTokensConsumed

get completionTokensConsumed(): undefined | number

Returns

undefined | number

Defined in

src/history/iteration.ts:222


error

get error(): undefined | string

Returns

undefined | string

Defined in

src/history/iteration.ts:243


exception

get exception(): undefined | Error

Returns

undefined | Error

Defined in

src/history/iteration.ts:246


failedValidations

get failedValidations(): undefined | ValidatorLogs[]

Returns

undefined | ValidatorLogs[]

Defined in

src/history/iteration.ts:249


inputs

get inputs(): undefined | Inputs

Returns

undefined | Inputs

Defined in

src/history/iteration.ts:207


logs

get logs(): undefined | Stack<string>

Returns

undefined | Stack<string>

Defined in

src/history/iteration.ts:213


outputs

get outputs(): undefined | Outputs<T>

Returns

undefined | Outputs<T>

Defined in

src/history/iteration.ts:210


parsedOutput

get parsedOutput(): undefined | T

Returns

undefined | T

Defined in

src/history/iteration.ts:228


promptTokensConsumed

get promptTokensConsumed(): undefined | number

Returns

undefined | number

Defined in

src/history/iteration.ts:219


rawOutput

get rawOutput(): undefined | string

Returns

undefined | string

Defined in

src/history/iteration.ts:225


reasks

get reasks(): undefined | ReAsk[]

Returns

undefined | ReAsk[]

Defined in

src/history/iteration.ts:237


status

get status(): undefined | string

Returns

undefined | string

Defined in

src/history/iteration.ts:252


tokensConsumed

get tokensConsumed(): undefined | number

Returns

undefined | number

Defined in

src/history/iteration.ts:216


validatedOutput

get validatedOutput(): undefined | T

Returns

undefined | T

Defined in

src/history/iteration.ts:234


validationOutput

get validationOutput(): undefined | ReAsk | T

Returns

undefined | ReAsk | T

Defined in

src/history/iteration.ts:231


validatorLogs

get validatorLogs(): undefined | ValidatorLogs[]

Returns

undefined | ValidatorLogs[]

Defined in

src/history/iteration.ts:240

Methods

fromPyIteration

fromPyIteration<U>(pyIteration): Promise<Iteration<U>>

Type parameters

Name
U

Parameters

Name Type
pyIteration any

Returns

Promise<Iteration<U>>

Defined in

src/history/iteration.ts:134