s() API Signature and field APIs. typescript api api/s build/apidocs api s() API

s() API

Signature, field, schema, and validation APIs.

Most Used

AxField

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxField
Sourcesource

Full reference

AxFieldType

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFieldType
Sourcesource

Full reference

AxSignature

TypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.

FieldValue
Kindclass
FormAxSignature
Sourcesource

Call Shape

TypeScript
addInputField(field: Readonly<AxField>): void;

Full reference

AxSignatureConfig

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxSignatureConfig
Sourcesource

Full reference

f

Fluent field builder for creating type-safe signature fields.

FieldValue
Kindvariable
Formf
Sourcesource

Call Shape

TypeScript
const f: () => AxSignatureBuilder & object;

Examples

TypeScript
const sig = f()
  .input('name', f.string('User name'))
  .input('age', f.number('Age in years'))
  .output('greeting', f.string('Personalized greeting'))
  .build();
TypeScript
const sig = f()
  .input('email', f.string().email())
  .input('score', f.number('Score between 0-100').min(0).max(100))
  .input('tags', f.string('Tag').array('List of tags'))
  .output('isValid', f.boolean())
  .build();

Full reference

s

Creates a type-safe signature from a string template.

FieldValue
Kindfunction
Forms
ReturnsAxSignature<ParseSignature<T>["inputs"], ParseSignature<T>["outputs"]> A typed AxSignature instance
Sourcesource

Call Shape

TypeScript
function s<T>(signature: T): AxSignature<ParseSignature<T>["inputs"], ParseSignature<T>["outputs"]>;

Arguments And Options

NameTypeDescription
signatureTThe signature string in the format "inputFields -> outputFields"

Full reference

Advanced / internals / full reference

AxContextFieldInput

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxContextFieldInput
Sourcesource

Call Shape

TypeScript
type AxContextFieldInput = 
  | string
  | {
  field: string;
  keepInPromptChars?: number;
  promptMaxChars?: number;
  reverseTruncate?: boolean;
};

Full reference

AxContextFieldPromptConfig

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxContextFieldPromptConfig
Sourcesource

Call Shape

TypeScript
type AxContextFieldPromptConfig = 
  | {
  kind: "threshold";
  promptMaxChars: number;
}
  | {
  keepInPromptChars: number;
  kind: "truncate";
  reverseTruncate: boolean;
};

Full reference

AxFieldOptions

Per-field companion options for Standard Schema (zod/valibot/arktype) inputs and outputs. These encode ax-specific hints that schema libraries don’t represent natively.

FieldValue
Kindinterface
FormAxFieldOptions
Sourcesource

Full reference

AxFieldProcessor

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFieldProcessor
Sourcesource

Full reference

AxFieldProcessorProcess

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFieldProcessorProcess
Returnsunknown \| Promise<unknown>
Sourcesource

Call Shape

TypeScript
type AxFieldProcessorProcess = (value: AxFieldValue, context?: Readonly<{
  done?: boolean;
  sessionId?: string;
  values?: AxGenOut;
}>) => unknown | Promise<unknown>;

Arguments And Options

NameTypeDescription
valueAxFieldValue
context?Readonly<{ done?: boolean; sessionId?: string; values?: AxGenOut; }>

Full reference

AxFieldTemplateFn

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFieldTemplateFn
Returnsany[]
Sourcesource

Call Shape

TypeScript
type AxFieldTemplateFn = (field: Readonly<AxField>, value: Readonly<AxFieldValue>) => any[];

Arguments And Options

NameTypeDescription
fieldReadonly<AxField>
valueReadonly<AxFieldValue>

Full reference

AxFieldValue

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFieldValue
Sourcesource

Call Shape

TypeScript
type AxFieldValue = 
  | string
  | string[]
  | number
  | boolean
  | object
  | null
  | undefined
  | {
  data: string;
  mimeType: string;
}
  | object[]
  | {
  channels?: number;
  data?: string;
  format?: string;
  id?: string;
  mimeType?: string;
  sampleRate?: number;
  transcript?: string;
}
  | object[];

Full reference

AxFluentFieldInfo

TypeScript interface exported by @ax-llm/ax. See the fields and full reference below.

FieldValue
Kindinterface
FormAxFluentFieldInfo
Sourcesource

Full reference

AxFluentFieldType

TypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.

FieldValue
Kindclass
FormAxFluentFieldType
Sourcesource

Call Shape

TypeScript
new AxFluentFieldType<TType, TIsArray, TOptions, TIsOptional, TIsInternal, TFields, TIsCached>(fieldType: object): AxFluentFieldType<TType, TIsArray, TOptions, TIsOptional, TIsInternal, TFields, TIsCached>;

Full reference

AxFunctionJSONSchema

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxFunctionJSONSchema
Sourcesource

Call Shape

TypeScript
type AxFunctionJSONSchema = object;

Full reference

AxIField

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxIField
Sourcesource

Call Shape

TypeScript
type AxIField = Omit<AxField, "title"> & object;

Full reference

AxMCPJSONSchema

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxMCPJSONSchema
Sourcesource

Call Shape

TypeScript
type AxMCPJSONSchema = Record<string, unknown>;

Full reference

axMCPToolInputSchemaToFunctionSchema

TypeScript function exported by @ax-llm/ax. See the call shape, arguments, and full reference below.

FieldValue
Kindfunction
FormaxMCPToolInputSchemaToFunctionSchema
ReturnsAxFunctionJSONSchema
Sourcesource

Call Shape

TypeScript
function axMCPToolInputSchemaToFunctionSchema(schema: undefined | AxMCPJSONSchema): AxFunctionJSONSchema;

Arguments And Options

NameTypeDescription
schemaundefined \| AxMCPJSONSchema

Full reference

AxResultPickerFunctionFieldResults

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxResultPickerFunctionFieldResults
Sourcesource

Call Shape

TypeScript
type AxResultPickerFunctionFieldResults<OUT> = object;

Full reference

AxRuntimePrimitiveSignature

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxRuntimePrimitiveSignature
Sourcesource

Call Shape

TypeScript
type AxRuntimePrimitiveSignature = object;

Full reference

AxSignatureBuilder

TypeScript class exported by @ax-llm/ax. See the constructor, methods, and full reference below.

FieldValue
Kindclass
FormAxSignatureBuilder
Sourcesource

Call Shape

TypeScript
input<K, T>(
   name: K, 
   fieldInfo: T, 
prepend?: boolean): AxSignatureBuilder<AddFieldToShape<_TInput, K, T, "input">, _TOutput>;
TypeScript
input<K, T>(
   name: K, 
   schema: T, 
opts?: AxFieldOptions): AxSignatureBuilder<_TInput & { [P in string]: InferOutput<T> }, _TOutput>;
TypeScript
input<T>(schema: T, opts?: object): AxSignatureBuilder<AsRecord<InferOutput<T>>, _TOutput>;

Full reference

AxSignatureInput

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxSignatureInput
Sourcesource

Call Shape

TypeScript
type AxSignatureInput = Readonly<
  | AxSignature
  | string
| AxSignatureConfig>;

Full reference

AxStreamingFieldProcessorProcess

TypeScript typealias exported by @ax-llm/ax. See the full reference for complete details.

FieldValue
Kindtypealias
FormAxStreamingFieldProcessorProcess
Returnsunknown \| Promise<unknown>
Sourcesource

Call Shape

TypeScript
type AxStreamingFieldProcessorProcess = (value: string, context?: Readonly<{
  done?: boolean;
  sessionId?: string;
  values?: AxGenOut;
}>) => unknown | Promise<unknown>;

Arguments And Options

NameTypeDescription
valuestring
context?Readonly<{ done?: boolean; sessionId?: string; values?: AxGenOut; }>

Full reference

Full Reference

Open the full TypeScript reference. This page highlights the s symbols most relevant to everyday use.

Docs