Structured generation APIs for typed programs.
Most Used axCreates a type-safe AI generator from a signature string or AxSignature object.
Field Value Kind functionForm axReturns AxGen <ParseSignature<T>["inputs"], ParseSignature<T>["outputs"] & string extends ThoughtKey ? object : { [P in string]?: string }> An AxGen instance that can be executed with .forward(ai, inputs)Source source
Call Shape function ax < T , ThoughtKey >( signature : T , options? : Readonly < AxAIServiceOptions & object & object >) : AxGen < ParseSignature < T > [ "inputs" ] , ParseSignature < T > [ "outputs" ] & string extends ThoughtKey ? object : { [ P in string ]?: string }>; function ax < TInput , TOutput , ThoughtKey >( signature : AxSignature < TInput , TOutput >, options? : Readonly < AxAIServiceOptions & object & object >) : AxGen < TInput , TOutput & string extends ThoughtKey ? object : { [ P in string ]?: string }>; function ax ( signature : Readonly < AxSignatureConfig >, options? : Readonly < AxProgramForwardOptions < any >>) : AxGen < AxGenIn , AxGenOut >; Arguments And Options Name Type Description signatureTEither a signature string or a pre-built AxSignature object options?Readonly<AxAIServiceOptions & object & object>Optional configuration for the generator
Examples const qa = ax ( 'question: string -> answer: string' );
const result = await qa . forward ( ai , { question : 'What is TypeScript?' });
console . log ( result . answer ); const classifier = ax ( 'text: string -> sentiment: class(positive, negative, neutral)' );
const result = await classifier . forward ( ai , { text : 'I love this!' });
console . log ( result . sentiment ); // 'positive'
Full reference
AxFunctionProcessorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxFunctionProcessorSource source
Call Shape new AxFunctionProcessor ( funcList : readonly AxFunction []) : AxFunctionProcessor ; Full reference
AxGenTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxGenSource source
Call Shape new AxGen < IN , OUT >( signature :
| string
| Readonly < AxSignatureConfig >
| Readonly < AxSignature < IN & Record < string , any >, OUT >>, options? : Readonly < AxProgramForwardOptions < any >>) : AxGen < IN , OUT >; Full reference
AxGenerateErrorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxGenerateErrorSource source
Call Shape new AxGenerateError (
message : string ,
details : Readonly < AxGenerateErrorDetails >,
options? : ErrorOptions ) : AxGenerateError ; Full reference
AxProgramTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxProgramSource source
Call Shape new AxProgram < IN , OUT >( signature :
| undefined
| string
| Readonly < AxSignature < Record < string , any >, Record < string , any >>>
| Readonly < AxSignatureConfig >, options? : Readonly < AxProgramOptions >) : AxProgram < IN , OUT >; Full reference
fnCreates a fluent builder for defining callable functions/tools with typed
args, return schemas, namespaces, and optional AxAgent discovery examples.
Field Value Kind functionForm fnReturns AxFunctionBuilder<{ }, unknown, false>Source source
Call Shape function fn < TName >( name : TName ) : AxFunctionBuilder < {
}, unknown , false > ; Arguments And Options Name Type Description nameTName
Full reference
Advanced / internals / full reference AxAssertionTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxAssertionSource source
Call Shape fn ( values : T ) :
| undefined
| string
| boolean
| Promise < undefined | string | boolean >; Full reference
AxAssertionErrorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxAssertionErrorSource source
Call Shape new AxAssertionError ( __namedParameters : Readonly < {
message : string ;
} > ) : AxAssertionError ; Full reference
AxBestOfNTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxBestOfNSource source
Call Shape new AxBestOfN < IN , OUT >( program : Readonly < AxProgrammable < IN , OUT >>, options : Readonly < AxBestOfNOptions < IN , OUT >>) : AxBestOfN < IN , OUT >; Full reference
AxBestOfNOptionsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxBestOfNOptionsSource source
Call Shape type AxBestOfNOptions < IN , OUT > = object ; Full reference
AxFunctionErrorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxFunctionErrorSource source
Call Shape new AxFunctionError ( fields : object []) : AxFunctionError ; Full reference
AxGenDeltaOutTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenDeltaOutSource source
Call Shape type AxGenDeltaOut < OUT > = object ; Full reference
AxGenerateErrorDetailsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenerateErrorDetailsSource source
Call Shape type AxGenerateErrorDetails = object ; Full reference
AxGenerateResultTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenerateResultSource source
Call Shape type AxGenerateResult < OUT > = OUT & object ; Full reference
AxGenInTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenInSource source
Call Shape Full reference
AxGenMetricsInstrumentsTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxGenMetricsInstrumentsSource source
Full reference
AxGenOutTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenOutSource source
Call Shape Full reference
AxGenOutputTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenOutputSource source
Call Shape type AxGenOutput < T > = T extends AxGen < any , infer OUT > ? OUT : T extends AxSignature < any , infer OUT2 > ? OUT2 : T extends AxSignatureBuilder < any , infer OUT3 > ? OUT3 : T extends string ? ParseSignature < T > extends object ? OUT4 : never : never ; Full reference
AxGenStreamingOutTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxGenStreamingOutSource source
Call Shape type AxGenStreamingOut < OUT > = AsyncGenerator < AxGenDeltaOut < OUT >, void , unknown >; Full reference
AxProgramDemosTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramDemosSource source
Call Shape type AxProgramDemos < IN , OUT , ID > = object ; Full reference
AxProgramExamplesTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramExamplesSource source
Call Shape type AxProgramExamples < IN , OUT > =
| AxProgramDemos < IN , OUT >
| AxProgramDemos < IN , OUT >[ "traces" ]; Full reference
AxProgramForwardOptionsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramForwardOptionsSource source
Call Shape type AxProgramForwardOptions < MODEL > = AxAIServiceOptions & object ; Full reference
AxProgramForwardOptionsWithModelsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramForwardOptionsWithModelsSource source
Call Shape type AxProgramForwardOptionsWithModels < T > = AxProgramForwardOptions < AxAIServiceModelType < T >>; Full reference
AxProgrammableTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxProgrammableSource source
Call Shape applyOptimization ( optimizedProgram : AxOptimizedProgram < OUT >) : void ; Full reference
AxProgramOptionsTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxProgramOptionsSource source
Full reference
AxProgramStreamingForwardOptionsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramStreamingForwardOptionsSource source
Call Shape type AxProgramStreamingForwardOptions < MODEL > = Omit < AxProgramForwardOptions < MODEL >, "stream" >; Full reference
AxProgramStreamingForwardOptionsWithModelsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramStreamingForwardOptionsWithModelsSource source
Call Shape type AxProgramStreamingForwardOptionsWithModels < T > = AxProgramStreamingForwardOptions < AxAIServiceModelType < T >>; Full reference
AxProgramTraceTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramTraceSource source
Call Shape type AxProgramTrace < IN , OUT > = object ; Full reference
AxProgramUsageTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxProgramUsageSource source
Call Shape type AxProgramUsage = AxChatResponse [ "modelUsage" ] & object ; Full reference
AxPromptTemplateTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxPromptTemplateSource source
Call Shape new AxPromptTemplate (
sig : Readonly < AxSignature >,
options? : Readonly < AxPromptTemplateOptions >,
fieldTemplates? : Record < string , AxFieldTemplateFn >) : AxPromptTemplate ; Full reference
AxPromptTemplateOptionsTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxPromptTemplateOptionsSource source
Full reference
AxRefineTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxRefineSource source
Call Shape new AxRefine < IN , OUT >( program : Readonly < AxProgrammable < IN , OUT >>, options : Readonly < AxRefineOptions < IN , OUT >>) : AxRefine < IN , OUT >; Full reference
AxRefineErrorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxRefineErrorSource source
Call Shape new AxRefineError ( message : string , attempts : readonly AxAttempt < any , any >[]) : AxRefineError ; Full reference
AxRefineOptionsTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxRefineOptionsSource source
Call Shape type AxRefineOptions < IN , OUT > = object ; Full reference
AxRefineStrategyTypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.
Field Value Kind typealiasForm AxRefineStrategySource source
Call Shape type AxRefineStrategy = "auto" | "native-samples" | "serial" ; Full reference
AxStreamingAssertionTypeScript interface exported by @ax-llm/ax. See the fields and full reference below.
Field Value Kind interfaceForm AxStreamingAssertionSource source
Call Shape fn ( content : string , done? : boolean ) :
| undefined
| string
| boolean
| Promise < undefined | string | boolean >; Full reference
AxStreamingAssertionErrorTypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.
Field Value Kind classForm AxStreamingAssertionErrorSource source
Call Shape new AxStreamingAssertionError ( __namedParameters : Readonly < {
message : string ;
} > ) : AxStreamingAssertionError ; Full reference
bestOfNTypeScript function exported by @ax-llm/ax. See the call shape, arguments, and full reference below.
Call Shape function bestOfN < IN , OUT >( program : Readonly < AxProgrammable < IN , OUT >>, options : Readonly < AxBestOfNOptions < IN , OUT >>) : AxBestOfN < IN , OUT >; Arguments And Options Full reference
refineTypeScript function exported by @ax-llm/ax. See the call shape, arguments, and full reference below.
Call Shape function refine < IN , OUT >( program : Readonly < AxProgrammable < IN , OUT >>, options : Readonly < AxRefineOptions < IN , OUT >>) : AxRefine < IN , OUT >; Arguments And Options Full reference