@ax-llm/ax 11.0.22 → 11.0.25
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 +276 -43
- package/index.cjs.map +1 -1
- package/index.d.cts +234 -141
- package/index.d.ts +234 -141
- package/index.js +271 -41
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ReadableStream } from 'stream/web';
|
|
1
|
+
import { ReadableStream as ReadableStream$1 } from 'stream/web';
|
|
2
|
+
import { ReadableStream } from 'node:stream/web';
|
|
2
3
|
import { Span, Tracer } from '@opentelemetry/api';
|
|
3
4
|
|
|
4
5
|
interface RetryConfig {
|
|
@@ -334,7 +335,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
|
|
|
334
335
|
private updateLatencyMetrics;
|
|
335
336
|
private updateErrorMetrics;
|
|
336
337
|
getMetrics(): AxAIServiceMetrics;
|
|
337
|
-
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
338
|
+
chat(req: Readonly<AxChatRequest<TModel>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<TModel, TEmbedModel>>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
338
339
|
private _chat1;
|
|
339
340
|
private cleanupFunctionSchema;
|
|
340
341
|
private _chat2;
|
|
@@ -345,6 +346,7 @@ declare class AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatRe
|
|
|
345
346
|
}
|
|
346
347
|
|
|
347
348
|
declare enum AxAIAnthropicModel {
|
|
349
|
+
Claude37Sonnet = "claude-3-7-sonnet-latest",
|
|
348
350
|
Claude35Sonnet = "claude-3-5-sonnet-latest",
|
|
349
351
|
Claude35Haiku = "claude-3-5-haiku-latest",
|
|
350
352
|
Claude3Opus = "claude-3-opus-latest",
|
|
@@ -354,6 +356,7 @@ declare enum AxAIAnthropicModel {
|
|
|
354
356
|
ClaudeInstant12 = "claude-instant-1.2"
|
|
355
357
|
}
|
|
356
358
|
declare enum AxAIAnthropicVertexModel {
|
|
359
|
+
Claude37Sonnet = "claude-3-7-sonnet",
|
|
357
360
|
Claude35Haiku = "claude-3-5-haiku",
|
|
358
361
|
Claude35Sonnet = "claude-3-5-sonnet",
|
|
359
362
|
Claude35SonnetV2 = "claude-3-5-sonnet-v2",
|
|
@@ -551,6 +554,7 @@ declare enum AxAIOpenAIModel {
|
|
|
551
554
|
O1Mini = "o1-mini",
|
|
552
555
|
O3Mini = "o3-mini",
|
|
553
556
|
GPT4 = "gpt-4",
|
|
557
|
+
GPT45 = "gpt-4.5-preview",
|
|
554
558
|
GPT4O = "gpt-4o",
|
|
555
559
|
GPT4OMini = "gpt-4o-mini",
|
|
556
560
|
GPT4ChatGPT4O = "chatgpt-4o-latest",
|
|
@@ -1291,7 +1295,7 @@ declare class AxAI implements AxAIService {
|
|
|
1291
1295
|
embedModel?: string;
|
|
1292
1296
|
}>;
|
|
1293
1297
|
getMetrics(): AxAIServiceMetrics;
|
|
1294
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1298
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1295
1299
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
1296
1300
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1297
1301
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -1313,6 +1317,136 @@ interface AxAIMemory {
|
|
|
1313
1317
|
rewindToTag(name: string, sessionId?: string): AxChatRequest['chatPrompt'];
|
|
1314
1318
|
}
|
|
1315
1319
|
|
|
1320
|
+
declare class AxMemory implements AxAIMemory {
|
|
1321
|
+
private limit;
|
|
1322
|
+
private debug;
|
|
1323
|
+
private memories;
|
|
1324
|
+
private defaultMemory;
|
|
1325
|
+
constructor(limit?: number, debug?: boolean);
|
|
1326
|
+
private getMemory;
|
|
1327
|
+
add(value: AxChatRequest['chatPrompt'][number] | AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
1328
|
+
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1329
|
+
updateResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1330
|
+
addTag(name: string, sessionId?: string): void;
|
|
1331
|
+
rewindToTag(name: string, sessionId?: string): ({
|
|
1332
|
+
role: "system";
|
|
1333
|
+
content: string;
|
|
1334
|
+
cache?: boolean;
|
|
1335
|
+
} | {
|
|
1336
|
+
role: "user";
|
|
1337
|
+
name?: string;
|
|
1338
|
+
content: string | ({
|
|
1339
|
+
type: "text";
|
|
1340
|
+
text: string;
|
|
1341
|
+
cache?: boolean;
|
|
1342
|
+
} | {
|
|
1343
|
+
type: "image";
|
|
1344
|
+
mimeType: string;
|
|
1345
|
+
image: string;
|
|
1346
|
+
details?: "high" | "low" | "auto";
|
|
1347
|
+
cache?: boolean;
|
|
1348
|
+
} | {
|
|
1349
|
+
type: "audio";
|
|
1350
|
+
data: string;
|
|
1351
|
+
format?: "wav";
|
|
1352
|
+
cache?: boolean;
|
|
1353
|
+
})[];
|
|
1354
|
+
} | {
|
|
1355
|
+
role: "assistant";
|
|
1356
|
+
content?: string;
|
|
1357
|
+
name?: string;
|
|
1358
|
+
functionCalls?: {
|
|
1359
|
+
id: string;
|
|
1360
|
+
type: "function";
|
|
1361
|
+
function: {
|
|
1362
|
+
name: string;
|
|
1363
|
+
params?: string | object;
|
|
1364
|
+
};
|
|
1365
|
+
}[];
|
|
1366
|
+
cache?: boolean;
|
|
1367
|
+
} | {
|
|
1368
|
+
role: "function";
|
|
1369
|
+
result: string;
|
|
1370
|
+
isError?: boolean;
|
|
1371
|
+
functionId: string;
|
|
1372
|
+
cache?: boolean;
|
|
1373
|
+
})[];
|
|
1374
|
+
history(sessionId?: string): ({
|
|
1375
|
+
role: "system";
|
|
1376
|
+
content: string;
|
|
1377
|
+
cache?: boolean;
|
|
1378
|
+
} | {
|
|
1379
|
+
role: "user";
|
|
1380
|
+
name?: string;
|
|
1381
|
+
content: string | ({
|
|
1382
|
+
type: "text";
|
|
1383
|
+
text: string;
|
|
1384
|
+
cache?: boolean;
|
|
1385
|
+
} | {
|
|
1386
|
+
type: "image";
|
|
1387
|
+
mimeType: string;
|
|
1388
|
+
image: string;
|
|
1389
|
+
details?: "high" | "low" | "auto";
|
|
1390
|
+
cache?: boolean;
|
|
1391
|
+
} | {
|
|
1392
|
+
type: "audio";
|
|
1393
|
+
data: string;
|
|
1394
|
+
format?: "wav";
|
|
1395
|
+
cache?: boolean;
|
|
1396
|
+
})[];
|
|
1397
|
+
} | {
|
|
1398
|
+
role: "assistant";
|
|
1399
|
+
content?: string;
|
|
1400
|
+
name?: string;
|
|
1401
|
+
functionCalls?: {
|
|
1402
|
+
id: string;
|
|
1403
|
+
type: "function";
|
|
1404
|
+
function: {
|
|
1405
|
+
name: string;
|
|
1406
|
+
params?: string | object;
|
|
1407
|
+
};
|
|
1408
|
+
}[];
|
|
1409
|
+
cache?: boolean;
|
|
1410
|
+
} | {
|
|
1411
|
+
role: "function";
|
|
1412
|
+
result: string;
|
|
1413
|
+
isError?: boolean;
|
|
1414
|
+
functionId: string;
|
|
1415
|
+
cache?: boolean;
|
|
1416
|
+
})[];
|
|
1417
|
+
getLast(sessionId?: string): {
|
|
1418
|
+
chat: AxChatRequest["chatPrompt"][number];
|
|
1419
|
+
tags?: string[];
|
|
1420
|
+
} | undefined;
|
|
1421
|
+
reset(sessionId?: string): void;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
declare class AxFunctionError extends Error {
|
|
1425
|
+
private fields;
|
|
1426
|
+
constructor(fields: {
|
|
1427
|
+
field: string;
|
|
1428
|
+
message: string;
|
|
1429
|
+
}[]);
|
|
1430
|
+
getFields: () => {
|
|
1431
|
+
field: string;
|
|
1432
|
+
message: string;
|
|
1433
|
+
}[];
|
|
1434
|
+
}
|
|
1435
|
+
type AxChatResponseFunctionCall = {
|
|
1436
|
+
id: string;
|
|
1437
|
+
name: string;
|
|
1438
|
+
args: string;
|
|
1439
|
+
};
|
|
1440
|
+
declare class AxFunctionProcessor {
|
|
1441
|
+
private funcList;
|
|
1442
|
+
constructor(funcList: Readonly<AxFunction[]>);
|
|
1443
|
+
private executeFunction;
|
|
1444
|
+
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<string>;
|
|
1445
|
+
}
|
|
1446
|
+
type AxInputFunctionType = (AxFunction | {
|
|
1447
|
+
toFunction: () => AxFunction | AxFunction[];
|
|
1448
|
+
})[];
|
|
1449
|
+
|
|
1316
1450
|
interface AxField {
|
|
1317
1451
|
name: string;
|
|
1318
1452
|
title?: string;
|
|
@@ -1390,7 +1524,7 @@ type AxProgramForwardOptions = {
|
|
|
1390
1524
|
tracer?: Tracer;
|
|
1391
1525
|
rateLimiter?: AxRateLimiterFunction;
|
|
1392
1526
|
stream?: boolean;
|
|
1393
|
-
functions?:
|
|
1527
|
+
functions?: AxInputFunctionType;
|
|
1394
1528
|
functionCall?: AxChatRequest['functionCall'];
|
|
1395
1529
|
stopFunction?: string;
|
|
1396
1530
|
fastFail?: boolean;
|
|
@@ -1462,7 +1596,7 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
|
|
|
1462
1596
|
}
|
|
1463
1597
|
|
|
1464
1598
|
interface AxAssertion {
|
|
1465
|
-
fn(values: Record<string, unknown>): boolean | undefined;
|
|
1599
|
+
fn(values: Record<string, unknown>): Promise<boolean | undefined> | boolean | undefined;
|
|
1466
1600
|
message?: string;
|
|
1467
1601
|
}
|
|
1468
1602
|
interface AxStreamingAssertion {
|
|
@@ -1502,136 +1636,6 @@ interface AxFieldProcessor {
|
|
|
1502
1636
|
process: AxFieldProcessorProcess | AxStreamingFieldProcessorProcess;
|
|
1503
1637
|
}
|
|
1504
1638
|
|
|
1505
|
-
declare class AxMemory implements AxAIMemory {
|
|
1506
|
-
private limit;
|
|
1507
|
-
private debug;
|
|
1508
|
-
private memories;
|
|
1509
|
-
private defaultMemory;
|
|
1510
|
-
constructor(limit?: number, debug?: boolean);
|
|
1511
|
-
private getMemory;
|
|
1512
|
-
add(value: AxChatRequest['chatPrompt'][number] | AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
1513
|
-
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1514
|
-
updateResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
1515
|
-
addTag(name: string, sessionId?: string): void;
|
|
1516
|
-
rewindToTag(name: string, sessionId?: string): ({
|
|
1517
|
-
role: "system";
|
|
1518
|
-
content: string;
|
|
1519
|
-
cache?: boolean;
|
|
1520
|
-
} | {
|
|
1521
|
-
role: "user";
|
|
1522
|
-
name?: string;
|
|
1523
|
-
content: string | ({
|
|
1524
|
-
type: "text";
|
|
1525
|
-
text: string;
|
|
1526
|
-
cache?: boolean;
|
|
1527
|
-
} | {
|
|
1528
|
-
type: "image";
|
|
1529
|
-
mimeType: string;
|
|
1530
|
-
image: string;
|
|
1531
|
-
details?: "high" | "low" | "auto";
|
|
1532
|
-
cache?: boolean;
|
|
1533
|
-
} | {
|
|
1534
|
-
type: "audio";
|
|
1535
|
-
data: string;
|
|
1536
|
-
format?: "wav";
|
|
1537
|
-
cache?: boolean;
|
|
1538
|
-
})[];
|
|
1539
|
-
} | {
|
|
1540
|
-
role: "assistant";
|
|
1541
|
-
content?: string;
|
|
1542
|
-
name?: string;
|
|
1543
|
-
functionCalls?: {
|
|
1544
|
-
id: string;
|
|
1545
|
-
type: "function";
|
|
1546
|
-
function: {
|
|
1547
|
-
name: string;
|
|
1548
|
-
params?: string | object;
|
|
1549
|
-
};
|
|
1550
|
-
}[];
|
|
1551
|
-
cache?: boolean;
|
|
1552
|
-
} | {
|
|
1553
|
-
role: "function";
|
|
1554
|
-
result: string;
|
|
1555
|
-
isError?: boolean;
|
|
1556
|
-
functionId: string;
|
|
1557
|
-
cache?: boolean;
|
|
1558
|
-
})[];
|
|
1559
|
-
history(sessionId?: string): ({
|
|
1560
|
-
role: "system";
|
|
1561
|
-
content: string;
|
|
1562
|
-
cache?: boolean;
|
|
1563
|
-
} | {
|
|
1564
|
-
role: "user";
|
|
1565
|
-
name?: string;
|
|
1566
|
-
content: string | ({
|
|
1567
|
-
type: "text";
|
|
1568
|
-
text: string;
|
|
1569
|
-
cache?: boolean;
|
|
1570
|
-
} | {
|
|
1571
|
-
type: "image";
|
|
1572
|
-
mimeType: string;
|
|
1573
|
-
image: string;
|
|
1574
|
-
details?: "high" | "low" | "auto";
|
|
1575
|
-
cache?: boolean;
|
|
1576
|
-
} | {
|
|
1577
|
-
type: "audio";
|
|
1578
|
-
data: string;
|
|
1579
|
-
format?: "wav";
|
|
1580
|
-
cache?: boolean;
|
|
1581
|
-
})[];
|
|
1582
|
-
} | {
|
|
1583
|
-
role: "assistant";
|
|
1584
|
-
content?: string;
|
|
1585
|
-
name?: string;
|
|
1586
|
-
functionCalls?: {
|
|
1587
|
-
id: string;
|
|
1588
|
-
type: "function";
|
|
1589
|
-
function: {
|
|
1590
|
-
name: string;
|
|
1591
|
-
params?: string | object;
|
|
1592
|
-
};
|
|
1593
|
-
}[];
|
|
1594
|
-
cache?: boolean;
|
|
1595
|
-
} | {
|
|
1596
|
-
role: "function";
|
|
1597
|
-
result: string;
|
|
1598
|
-
isError?: boolean;
|
|
1599
|
-
functionId: string;
|
|
1600
|
-
cache?: boolean;
|
|
1601
|
-
})[];
|
|
1602
|
-
getLast(sessionId?: string): {
|
|
1603
|
-
chat: AxChatRequest["chatPrompt"][number];
|
|
1604
|
-
tags?: string[];
|
|
1605
|
-
} | undefined;
|
|
1606
|
-
reset(sessionId?: string): void;
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
declare class AxFunctionError extends Error {
|
|
1610
|
-
private fields;
|
|
1611
|
-
constructor(fields: {
|
|
1612
|
-
field: string;
|
|
1613
|
-
message: string;
|
|
1614
|
-
}[]);
|
|
1615
|
-
getFields: () => {
|
|
1616
|
-
field: string;
|
|
1617
|
-
message: string;
|
|
1618
|
-
}[];
|
|
1619
|
-
}
|
|
1620
|
-
type AxChatResponseFunctionCall = {
|
|
1621
|
-
id: string;
|
|
1622
|
-
name: string;
|
|
1623
|
-
args: string;
|
|
1624
|
-
};
|
|
1625
|
-
declare class AxFunctionProcessor {
|
|
1626
|
-
private funcList;
|
|
1627
|
-
constructor(funcList: Readonly<AxFunction[]>);
|
|
1628
|
-
private executeFunction;
|
|
1629
|
-
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<string>;
|
|
1630
|
-
}
|
|
1631
|
-
type AxInputFunctionType = AxFunction[] | {
|
|
1632
|
-
toFunction: () => AxFunction;
|
|
1633
|
-
}[];
|
|
1634
|
-
|
|
1635
1639
|
type Writeable<T> = {
|
|
1636
1640
|
-readonly [P in keyof T]: T[P];
|
|
1637
1641
|
};
|
|
@@ -1788,7 +1792,7 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut = AxGenOut> imple
|
|
|
1788
1792
|
definition?: string;
|
|
1789
1793
|
signature: AxSignature | string;
|
|
1790
1794
|
agents?: AxAgentic[];
|
|
1791
|
-
functions?:
|
|
1795
|
+
functions?: AxInputFunctionType;
|
|
1792
1796
|
}>, options?: Readonly<AxAgentOptions>);
|
|
1793
1797
|
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
1794
1798
|
setId(id: string): void;
|
|
@@ -1883,7 +1887,7 @@ declare class AxBalancer implements AxAIService<unknown, unknown> {
|
|
|
1883
1887
|
private canRetryService;
|
|
1884
1888
|
private handleFailure;
|
|
1885
1889
|
private handleSuccess;
|
|
1886
|
-
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
1890
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
1887
1891
|
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
|
|
1888
1892
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
1889
1893
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -2278,7 +2282,7 @@ type AxMockAIServiceConfig = {
|
|
|
2278
2282
|
};
|
|
2279
2283
|
models?: AxAIModelList;
|
|
2280
2284
|
options?: AxAIServiceOptions;
|
|
2281
|
-
chatResponse?: AxChatResponse | ReadableStream<AxChatResponse> | (() => Promise<AxChatResponse | ReadableStream<AxChatResponse>>) | ((req: Readonly<AxChatRequest<unknown>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>) => Promise<AxChatResponse | ReadableStream<AxChatResponse>>);
|
|
2285
|
+
chatResponse?: AxChatResponse | ReadableStream$1<AxChatResponse> | (() => Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>) | ((req: Readonly<AxChatRequest<unknown>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>) => Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>);
|
|
2282
2286
|
embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
|
|
2283
2287
|
shouldError?: boolean;
|
|
2284
2288
|
errorMessage?: string;
|
|
@@ -2300,7 +2304,7 @@ declare class AxMockAIService implements AxAIService {
|
|
|
2300
2304
|
embedModel?: string;
|
|
2301
2305
|
}>;
|
|
2302
2306
|
getMetrics(): AxAIServiceMetrics;
|
|
2303
|
-
chat(req: Readonly<AxChatRequest<unknown>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2307
|
+
chat(req: Readonly<AxChatRequest<unknown>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<unknown, unknown>>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
2304
2308
|
embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
2305
2309
|
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
2306
2310
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
@@ -2398,6 +2402,95 @@ declare class AxInstanceRegistry<T> {
|
|
|
2398
2402
|
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
2399
2403
|
}
|
|
2400
2404
|
|
|
2405
|
+
interface JSONRPCRequest<T> {
|
|
2406
|
+
jsonrpc: '2.0';
|
|
2407
|
+
id: string | number;
|
|
2408
|
+
method: string;
|
|
2409
|
+
params?: T;
|
|
2410
|
+
}
|
|
2411
|
+
interface JSONRPCSuccessResponse<T = unknown> {
|
|
2412
|
+
jsonrpc: '2.0';
|
|
2413
|
+
id: string | number;
|
|
2414
|
+
result: T;
|
|
2415
|
+
}
|
|
2416
|
+
interface JSONRPCErrorResponse {
|
|
2417
|
+
jsonrpc: '2.0';
|
|
2418
|
+
id: string | number;
|
|
2419
|
+
error: {
|
|
2420
|
+
code: number;
|
|
2421
|
+
message: string;
|
|
2422
|
+
data?: unknown;
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
type JSONRPCResponse<T = unknown> = JSONRPCSuccessResponse<T> | JSONRPCErrorResponse;
|
|
2426
|
+
interface JSONRPCNotification {
|
|
2427
|
+
jsonrpc: '2.0';
|
|
2428
|
+
method: string;
|
|
2429
|
+
params?: Record<string, unknown>;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
interface AxMCPTransport {
|
|
2433
|
+
/**
|
|
2434
|
+
* Sends a JSON-RPC request or notification and returns the response
|
|
2435
|
+
* @param message The JSON-RPC request or notification to send
|
|
2436
|
+
* @returns A Promise that resolves to the JSON-RPC response
|
|
2437
|
+
*/
|
|
2438
|
+
send(message: Readonly<JSONRPCRequest<unknown>>): Promise<JSONRPCResponse<unknown>>;
|
|
2439
|
+
/**
|
|
2440
|
+
* Sends a JSON-RPC notification
|
|
2441
|
+
* @param message The JSON-RPC notification to send
|
|
2442
|
+
*/
|
|
2443
|
+
sendNotification(message: Readonly<JSONRPCNotification>): Promise<void>;
|
|
2444
|
+
/**
|
|
2445
|
+
* Connects to the transport if needed
|
|
2446
|
+
* This method is optional and only required for transports that need connection setup
|
|
2447
|
+
*/
|
|
2448
|
+
connect?(): Promise<void>;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
interface AxMCPClientOptions {
|
|
2452
|
+
debug?: boolean;
|
|
2453
|
+
}
|
|
2454
|
+
declare class AxMCPClient {
|
|
2455
|
+
private readonly transport;
|
|
2456
|
+
private readonly options;
|
|
2457
|
+
private functions;
|
|
2458
|
+
private requestId;
|
|
2459
|
+
private capabilities;
|
|
2460
|
+
constructor(transport: AxMCPTransport, options?: Readonly<AxMCPClientOptions>);
|
|
2461
|
+
init(): Promise<void>;
|
|
2462
|
+
private discoverFunctions;
|
|
2463
|
+
ping(): Promise<void>;
|
|
2464
|
+
toFunction(): AxFunction[];
|
|
2465
|
+
private sendRequest;
|
|
2466
|
+
private sendNotification;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
declare class AxMCPHTTPTransport implements AxMCPTransport {
|
|
2470
|
+
private endpoint;
|
|
2471
|
+
private sseUrl;
|
|
2472
|
+
private eventSource?;
|
|
2473
|
+
constructor(sseUrl: string);
|
|
2474
|
+
connect(): Promise<void>;
|
|
2475
|
+
send(message: JSONRPCRequest<unknown> | JSONRPCNotification): Promise<JSONRPCResponse<unknown>>;
|
|
2476
|
+
sendNotification(message: Readonly<JSONRPCNotification>): Promise<void>;
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
interface StdioTransportConfig {
|
|
2480
|
+
command: string;
|
|
2481
|
+
args?: string[];
|
|
2482
|
+
env?: NodeJS.ProcessEnv;
|
|
2483
|
+
}
|
|
2484
|
+
declare class AxMCPStdioTransport implements AxMCPTransport {
|
|
2485
|
+
private process;
|
|
2486
|
+
private rl;
|
|
2487
|
+
private pendingResponses;
|
|
2488
|
+
constructor(config: Readonly<StdioTransportConfig>);
|
|
2489
|
+
send(message: Readonly<JSONRPCRequest<unknown>>): Promise<JSONRPCResponse<unknown>>;
|
|
2490
|
+
sendNotification(message: Readonly<JSONRPCNotification>): Promise<void>;
|
|
2491
|
+
connect(): Promise<void>;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2401
2494
|
type AxAIServiceListItem = {
|
|
2402
2495
|
key: string;
|
|
2403
2496
|
service: AxAIService;
|
|
@@ -2415,7 +2508,7 @@ declare class AxMultiServiceRouter implements AxAIService<string, string> {
|
|
|
2415
2508
|
/**
|
|
2416
2509
|
* Delegates the chat call to the service matching the provided model key.
|
|
2417
2510
|
*/
|
|
2418
|
-
chat(req: Readonly<AxChatRequest<string>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<string, string>>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
2511
|
+
chat(req: Readonly<AxChatRequest<string>>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions<string, string>>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
|
|
2419
2512
|
/**
|
|
2420
2513
|
* Delegates the embed call to the service matching the provided embed model key.
|
|
2421
2514
|
*/
|
|
@@ -2482,4 +2575,4 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
2482
2575
|
}>;
|
|
2483
2576
|
}
|
|
2484
2577
|
|
|
2485
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, AxMultiServiceRouter, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
|
|
2578
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMCPClient, AxMCPHTTPTransport, AxMCPStdioTransport, type AxMCPTransport, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, AxMultiServiceRouter, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
|