AxStepContextImpl
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L14
Internal implementation of AxStepContext. Uses a pending mutations pattern: mutations are collected during a step and consumed/applied at the next step boundary.
Implements
Constructors
Constructor
new AxStepContextImpl(maxSteps: number): AxStepContextImpl;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L41
Parameters
| Parameter | Type |
|---|---|
maxSteps | number |
Returns
AxStepContextImpl
Properties
| Property | Modifier | Type |
|---|---|---|
maxSteps | readonly | number |
state | readonly | Map<string, unknown> |
Accessors
_isStopRequested
Get Signature
get _isStopRequested(): boolean;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L176
Check if stop was requested.
Returns
boolean
_stopValues
Get Signature
get _stopValues(): undefined | Record<string, unknown>;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L181
Get stop result values if any.
Returns
undefined | Record<string, unknown>
functionsExecuted
Get Signature
get functionsExecuted(): ReadonlySet<string>;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L55
Returns
ReadonlySet<string>
Implementation of
AxStepContext.functionsExecuted
isFirstStep
Get Signature
get isFirstStep(): boolean;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L51
Returns
boolean
Implementation of
lastFunctionCalls
Get Signature
get lastFunctionCalls(): readonly AxFunctionCallRecord[];
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L59
Returns
readonly AxFunctionCallRecord[]
Implementation of
AxStepContext.lastFunctionCalls
stepIndex
Get Signature
get stepIndex(): number;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L47
Returns
number
Implementation of
usage
Get Signature
get usage(): Readonly<AxStepUsage>;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L63
Returns
Readonly<AxStepUsage>
Implementation of
Methods
_addUsage()
_addUsage(
promptTokens: number,
completionTokens: number,
totalTokens: number): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L128
Accumulate token usage from a completed step.
Parameters
| Parameter | Type |
|---|---|
promptTokens | number |
completionTokens | number |
totalTokens | number |
Returns
void
_beginStep()
_beginStep(stepIndex: number): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L115
Reset per-step state at the beginning of a new step.
Parameters
| Parameter | Type |
|---|---|
stepIndex | number |
Returns
void
_consumeFunctionsToAdd()
_consumeFunctionsToAdd(): undefined | AxInputFunctionType;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L156
Consume and clear pending functions to add.
Returns
undefined | AxInputFunctionType
_consumeFunctionsToRemove()
_consumeFunctionsToRemove(): undefined | string[];
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L166
Consume and clear pending function names to remove.
Returns
undefined | string[]
_consumePendingOptions()
_consumePendingOptions():
| undefined
| Partial<AxAIServiceOptions & object>;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L139
Consume and clear pending options. Returns undefined if no pending options.
Returns
| undefined
| Partial<AxAIServiceOptions & object>
_recordFunctionCall()
_recordFunctionCall(
name: string,
args: unknown,
result: unknown): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L122
Record a function call that was executed during this step.
Parameters
| Parameter | Type |
|---|---|
name | string |
args | unknown |
result | unknown |
Returns
void
addFunctions()
addFunctions(functions: AxInputFunctionType): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L99
Parameters
| Parameter | Type |
|---|---|
functions | AxInputFunctionType |
Returns
void
Implementation of
removeFunctions()
removeFunctions(...names: string[]): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L103
Parameters
| Parameter | Type |
|---|---|
…names | string[] |
Returns
void
Implementation of
setMaxTokens()
setMaxTokens(maxTokens: number): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L84
Parameters
| Parameter | Type |
|---|---|
maxTokens | number |
Returns
void
Implementation of
setModel()
setModel(model: string): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L69
Parameters
| Parameter | Type |
|---|---|
model | string |
Returns
void
Implementation of
setOptions()
setOptions(options: Partial<AxAIServiceOptions & object>): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L91
Parameters
| Parameter | Type |
|---|---|
options | Partial<AxAIServiceOptions & object> |
Returns
void
Implementation of
setTemperature()
setTemperature(temperature: number): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L77
Parameters
| Parameter | Type |
|---|---|
temperature | number |
Returns
void
Implementation of
setThinkingBudget()
setThinkingBudget(budget: undefined | "high" | "low" | "minimal" | "medium" | "highest" | "none"): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L73
Parameters
| Parameter | Type |
|---|---|
budget | undefined | "high" | "low" | "minimal" | "medium" | "highest" | "none" |
Returns
void
Implementation of
AxStepContext.setThinkingBudget
stop()
stop(resultValues?: Record<string, unknown>): void;
Defined in: https://github.com/ax-llm/ax/blob/71ea5064d766efdc031d375243a8e525911833e7/src/ax/dsp/stepContext.ts#L107
Parameters
| Parameter | Type |
|---|---|
resultValues? | Record<string, unknown> |
Returns
void