@ax-llm/ax 14.0.1 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +207 -207
- package/index.cjs.map +1 -1
- package/index.d.cts +37 -3
- package/index.d.ts +37 -3
- package/index.global.js +54 -54
- package/index.global.js.map +1 -1
- package/index.js +209 -209
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -1237,7 +1237,7 @@ declare class AxAIOpenAIBase<TModel, TEmbedModel, TModelKey, TChatReq extends Ax
|
|
|
1237
1237
|
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, supportFor, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>, 'name'>>);
|
|
1238
1238
|
}
|
|
1239
1239
|
declare class AxAIOpenAI<TModelKey = string> extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> {
|
|
1240
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
1240
|
+
constructor({ apiKey, apiURL, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
declare const axAIAzureOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
@@ -4113,6 +4113,7 @@ type AxProgramForwardOptions<MODEL> = AxAIServiceOptions & {
|
|
|
4113
4113
|
functionResultFormatter?: (result: unknown) => string;
|
|
4114
4114
|
fastFail?: boolean;
|
|
4115
4115
|
showThoughts?: boolean;
|
|
4116
|
+
functionCallMode?: 'auto' | 'native' | 'prompt';
|
|
4116
4117
|
traceLabel?: string;
|
|
4117
4118
|
description?: string;
|
|
4118
4119
|
thoughtFieldName?: string;
|
|
@@ -4369,6 +4370,26 @@ declare class AxSignature<_TInput extends Record<string, any> = Record<string, a
|
|
|
4369
4370
|
validate: () => boolean;
|
|
4370
4371
|
hash: () => string;
|
|
4371
4372
|
toString: () => string;
|
|
4373
|
+
/**
|
|
4374
|
+
* Inject tool schemas as optional output fields for signature tool calling
|
|
4375
|
+
* Uses dot notation for nested parameters (jq-like syntax)
|
|
4376
|
+
*/
|
|
4377
|
+
injectToolFields(tools: readonly AxFunction[]): AxSignature<_TInput, _TOutput>;
|
|
4378
|
+
/**
|
|
4379
|
+
* Generate signature fields for tool parameters using dot notation
|
|
4380
|
+
*/
|
|
4381
|
+
private generateToolParameterFields;
|
|
4382
|
+
/**
|
|
4383
|
+
* Infer signature field type from JSON Schema parameter
|
|
4384
|
+
*/
|
|
4385
|
+
private inferParameterType;
|
|
4386
|
+
/**
|
|
4387
|
+
* Format parameter title for display
|
|
4388
|
+
*/
|
|
4389
|
+
private formatParameterTitle;
|
|
4390
|
+
private sanitizeFieldName;
|
|
4391
|
+
private formatTitle;
|
|
4392
|
+
private inferToolFieldType;
|
|
4372
4393
|
toJSON: () => {
|
|
4373
4394
|
id: string;
|
|
4374
4395
|
description: string | undefined;
|
|
@@ -4480,6 +4501,7 @@ declare class AxGen<IN = any, OUT extends AxGenOut = any> extends AxProgram<IN,
|
|
|
4480
4501
|
private streamingFieldProcessors;
|
|
4481
4502
|
private excludeContentFromTrace;
|
|
4482
4503
|
private thoughtFieldName;
|
|
4504
|
+
private signatureToolCallingManager?;
|
|
4483
4505
|
constructor(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]> | AxSignature<any, any>, options?: Readonly<AxProgramForwardOptions<any>>);
|
|
4484
4506
|
private getSignatureName;
|
|
4485
4507
|
private getMetricsInstruments;
|
|
@@ -5566,6 +5588,7 @@ declare const AxStringUtil: {
|
|
|
5566
5588
|
|
|
5567
5589
|
declare function s<const T extends string>(signature: T): AxSignature<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
5568
5590
|
declare function ax<const T extends string>(signature: T, options?: Readonly<AxProgramForwardOptions<any>>): AxGen<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
5591
|
+
declare function ax<TInput extends Record<string, any>, TOutput extends Record<string, any>>(signature: AxSignature<TInput, TOutput>, options?: Readonly<AxProgramForwardOptions<any>>): AxGen<TInput, TOutput>;
|
|
5569
5592
|
|
|
5570
5593
|
/**
|
|
5571
5594
|
* Analyzes mapping functions to extract state dependencies.
|
|
@@ -7163,6 +7186,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
7163
7186
|
private disableSmartModelRouting?;
|
|
7164
7187
|
private excludeFieldsFromPassthrough;
|
|
7165
7188
|
private debug?;
|
|
7189
|
+
private options?;
|
|
7166
7190
|
private name;
|
|
7167
7191
|
private func;
|
|
7168
7192
|
constructor({ ai, name, description, definition, signature, agents, functions, }: Readonly<{
|
|
@@ -7239,21 +7263,30 @@ interface AxAgentConfig<IN extends AxGenIn, OUT extends AxGenOut> extends AxAgen
|
|
|
7239
7263
|
functions?: AxInputFunctionType;
|
|
7240
7264
|
}
|
|
7241
7265
|
/**
|
|
7242
|
-
* Creates a strongly-typed AI agent from a
|
|
7266
|
+
* Creates a strongly-typed AI agent from a signature.
|
|
7243
7267
|
* This is the recommended way to create agents, providing better type inference and cleaner syntax.
|
|
7268
|
+
* Supports both string signatures and AxSignature objects.
|
|
7244
7269
|
*
|
|
7245
|
-
* @param signature - The input/output signature as a string
|
|
7270
|
+
* @param signature - The input/output signature as a string or AxSignature object
|
|
7246
7271
|
* @param config - Configuration options for the agent
|
|
7247
7272
|
* @returns A typed agent instance
|
|
7248
7273
|
*
|
|
7249
7274
|
* @example
|
|
7250
7275
|
* ```typescript
|
|
7276
|
+
* // Using string signature
|
|
7251
7277
|
* const myAgent = agent('userInput:string -> responseText:string', {
|
|
7252
7278
|
* name: 'myAgent',
|
|
7253
7279
|
* description: 'An agent that processes user input and returns a response',
|
|
7254
7280
|
* definition: 'You are a helpful assistant that responds to user queries...'
|
|
7255
7281
|
* });
|
|
7256
7282
|
*
|
|
7283
|
+
* // Using AxSignature object
|
|
7284
|
+
* const sig = s('userInput:string -> responseText:string');
|
|
7285
|
+
* const myAgent2 = agent(sig, {
|
|
7286
|
+
* name: 'myAgent2',
|
|
7287
|
+
* description: 'Same agent but using AxSignature object'
|
|
7288
|
+
* });
|
|
7289
|
+
*
|
|
7257
7290
|
* // With child agents
|
|
7258
7291
|
* const parentAgent = agent('taskDescription:string -> completedTask:string', {
|
|
7259
7292
|
* name: 'parentAgent',
|
|
@@ -7267,6 +7300,7 @@ interface AxAgentConfig<IN extends AxGenIn, OUT extends AxGenOut> extends AxAgen
|
|
|
7267
7300
|
* ```
|
|
7268
7301
|
*/
|
|
7269
7302
|
declare function agent<const T extends string>(signature: T, config: AxAgentConfig<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>): AxAgent<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
7303
|
+
declare function agent<TInput extends Record<string, any>, TOutput extends Record<string, any>>(signature: AxSignature<TInput, TOutput>, config: AxAgentConfig<TInput, TOutput>): AxAgent<TInput, TOutput>;
|
|
7270
7304
|
|
|
7271
7305
|
/**
|
|
7272
7306
|
* Advanced Multi-hop RAG with iterative query refinement, context accumulation,
|
package/index.d.ts
CHANGED
|
@@ -1237,7 +1237,7 @@ declare class AxAIOpenAIBase<TModel, TEmbedModel, TModelKey, TChatReq extends Ax
|
|
|
1237
1237
|
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, supportFor, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TModelKey, TChatReq>, 'name'>>);
|
|
1238
1238
|
}
|
|
1239
1239
|
declare class AxAIOpenAI<TModelKey = string> extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey> {
|
|
1240
|
-
constructor({ apiKey, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
1240
|
+
constructor({ apiKey, apiURL, config, options, models, modelInfo, }: Readonly<Omit<AxAIOpenAIArgs<'openai', AxAIOpenAIModel, AxAIOpenAIEmbedModel, TModelKey>, 'name'>>);
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
1243
|
declare const axAIAzureOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
@@ -4113,6 +4113,7 @@ type AxProgramForwardOptions<MODEL> = AxAIServiceOptions & {
|
|
|
4113
4113
|
functionResultFormatter?: (result: unknown) => string;
|
|
4114
4114
|
fastFail?: boolean;
|
|
4115
4115
|
showThoughts?: boolean;
|
|
4116
|
+
functionCallMode?: 'auto' | 'native' | 'prompt';
|
|
4116
4117
|
traceLabel?: string;
|
|
4117
4118
|
description?: string;
|
|
4118
4119
|
thoughtFieldName?: string;
|
|
@@ -4369,6 +4370,26 @@ declare class AxSignature<_TInput extends Record<string, any> = Record<string, a
|
|
|
4369
4370
|
validate: () => boolean;
|
|
4370
4371
|
hash: () => string;
|
|
4371
4372
|
toString: () => string;
|
|
4373
|
+
/**
|
|
4374
|
+
* Inject tool schemas as optional output fields for signature tool calling
|
|
4375
|
+
* Uses dot notation for nested parameters (jq-like syntax)
|
|
4376
|
+
*/
|
|
4377
|
+
injectToolFields(tools: readonly AxFunction[]): AxSignature<_TInput, _TOutput>;
|
|
4378
|
+
/**
|
|
4379
|
+
* Generate signature fields for tool parameters using dot notation
|
|
4380
|
+
*/
|
|
4381
|
+
private generateToolParameterFields;
|
|
4382
|
+
/**
|
|
4383
|
+
* Infer signature field type from JSON Schema parameter
|
|
4384
|
+
*/
|
|
4385
|
+
private inferParameterType;
|
|
4386
|
+
/**
|
|
4387
|
+
* Format parameter title for display
|
|
4388
|
+
*/
|
|
4389
|
+
private formatParameterTitle;
|
|
4390
|
+
private sanitizeFieldName;
|
|
4391
|
+
private formatTitle;
|
|
4392
|
+
private inferToolFieldType;
|
|
4372
4393
|
toJSON: () => {
|
|
4373
4394
|
id: string;
|
|
4374
4395
|
description: string | undefined;
|
|
@@ -4480,6 +4501,7 @@ declare class AxGen<IN = any, OUT extends AxGenOut = any> extends AxProgram<IN,
|
|
|
4480
4501
|
private streamingFieldProcessors;
|
|
4481
4502
|
private excludeContentFromTrace;
|
|
4482
4503
|
private thoughtFieldName;
|
|
4504
|
+
private signatureToolCallingManager?;
|
|
4483
4505
|
constructor(signature: NonNullable<ConstructorParameters<typeof AxSignature>[0]> | AxSignature<any, any>, options?: Readonly<AxProgramForwardOptions<any>>);
|
|
4484
4506
|
private getSignatureName;
|
|
4485
4507
|
private getMetricsInstruments;
|
|
@@ -5566,6 +5588,7 @@ declare const AxStringUtil: {
|
|
|
5566
5588
|
|
|
5567
5589
|
declare function s<const T extends string>(signature: T): AxSignature<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
5568
5590
|
declare function ax<const T extends string>(signature: T, options?: Readonly<AxProgramForwardOptions<any>>): AxGen<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
5591
|
+
declare function ax<TInput extends Record<string, any>, TOutput extends Record<string, any>>(signature: AxSignature<TInput, TOutput>, options?: Readonly<AxProgramForwardOptions<any>>): AxGen<TInput, TOutput>;
|
|
5569
5592
|
|
|
5570
5593
|
/**
|
|
5571
5594
|
* Analyzes mapping functions to extract state dependencies.
|
|
@@ -7163,6 +7186,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
|
|
|
7163
7186
|
private disableSmartModelRouting?;
|
|
7164
7187
|
private excludeFieldsFromPassthrough;
|
|
7165
7188
|
private debug?;
|
|
7189
|
+
private options?;
|
|
7166
7190
|
private name;
|
|
7167
7191
|
private func;
|
|
7168
7192
|
constructor({ ai, name, description, definition, signature, agents, functions, }: Readonly<{
|
|
@@ -7239,21 +7263,30 @@ interface AxAgentConfig<IN extends AxGenIn, OUT extends AxGenOut> extends AxAgen
|
|
|
7239
7263
|
functions?: AxInputFunctionType;
|
|
7240
7264
|
}
|
|
7241
7265
|
/**
|
|
7242
|
-
* Creates a strongly-typed AI agent from a
|
|
7266
|
+
* Creates a strongly-typed AI agent from a signature.
|
|
7243
7267
|
* This is the recommended way to create agents, providing better type inference and cleaner syntax.
|
|
7268
|
+
* Supports both string signatures and AxSignature objects.
|
|
7244
7269
|
*
|
|
7245
|
-
* @param signature - The input/output signature as a string
|
|
7270
|
+
* @param signature - The input/output signature as a string or AxSignature object
|
|
7246
7271
|
* @param config - Configuration options for the agent
|
|
7247
7272
|
* @returns A typed agent instance
|
|
7248
7273
|
*
|
|
7249
7274
|
* @example
|
|
7250
7275
|
* ```typescript
|
|
7276
|
+
* // Using string signature
|
|
7251
7277
|
* const myAgent = agent('userInput:string -> responseText:string', {
|
|
7252
7278
|
* name: 'myAgent',
|
|
7253
7279
|
* description: 'An agent that processes user input and returns a response',
|
|
7254
7280
|
* definition: 'You are a helpful assistant that responds to user queries...'
|
|
7255
7281
|
* });
|
|
7256
7282
|
*
|
|
7283
|
+
* // Using AxSignature object
|
|
7284
|
+
* const sig = s('userInput:string -> responseText:string');
|
|
7285
|
+
* const myAgent2 = agent(sig, {
|
|
7286
|
+
* name: 'myAgent2',
|
|
7287
|
+
* description: 'Same agent but using AxSignature object'
|
|
7288
|
+
* });
|
|
7289
|
+
*
|
|
7257
7290
|
* // With child agents
|
|
7258
7291
|
* const parentAgent = agent('taskDescription:string -> completedTask:string', {
|
|
7259
7292
|
* name: 'parentAgent',
|
|
@@ -7267,6 +7300,7 @@ interface AxAgentConfig<IN extends AxGenIn, OUT extends AxGenOut> extends AxAgen
|
|
|
7267
7300
|
* ```
|
|
7268
7301
|
*/
|
|
7269
7302
|
declare function agent<const T extends string>(signature: T, config: AxAgentConfig<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>): AxAgent<ParseSignature<T>['inputs'], ParseSignature<T>['outputs']>;
|
|
7303
|
+
declare function agent<TInput extends Record<string, any>, TOutput extends Record<string, any>>(signature: AxSignature<TInput, TOutput>, config: AxAgentConfig<TInput, TOutput>): AxAgent<TInput, TOutput>;
|
|
7270
7304
|
|
|
7271
7305
|
/**
|
|
7272
7306
|
* Advanced Multi-hop RAG with iterative query refinement, context accumulation,
|