@ax-llm/ax 10.0.38 → 10.0.40

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReadableStream } from 'stream/web';
1
+ import { ReadableStream as ReadableStream$1 } from 'stream/web';
2
2
  import { Tracer, Span } from '@opentelemetry/api';
3
3
 
4
4
  /**
@@ -176,10 +176,10 @@ type AxEmbedRequest = {
176
176
  embedModel?: string;
177
177
  };
178
178
  type AxInternalEmbedRequest = Omit<AxEmbedRequest, 'embedModel'> & Required<Pick<AxEmbedRequest, 'embedModel'>>;
179
- type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
179
+ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream$1<T>>, info: Readonly<{
180
180
  modelUsage?: AxTokenUsage;
181
181
  embedModelUsage?: AxTokenUsage;
182
- }>) => Promise<T | ReadableStream<T>>;
182
+ }>) => Promise<T | ReadableStream$1<T>>;
183
183
  type AxAIPromptConfig = {
184
184
  stream?: boolean;
185
185
  };
@@ -205,7 +205,7 @@ interface AxAIService {
205
205
  };
206
206
  getModelMap(): AxAIModelMap | undefined;
207
207
  getMetrics(): AxAIServiceMetrics;
208
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
208
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
209
209
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
210
210
  setOptions(options: Readonly<AxAIServiceOptions>): void;
211
211
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -226,7 +226,7 @@ interface AxBaseAIFeatures {
226
226
  interface AxBaseAIArgs {
227
227
  name: string;
228
228
  apiURL: string;
229
- headers: Record<string, string>;
229
+ headers: () => Promise<Record<string, string>>;
230
230
  modelInfo: Readonly<AxModelInfo[]>;
231
231
  models: Readonly<{
232
232
  model: string;
@@ -249,13 +249,13 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
249
249
  private models;
250
250
  protected apiURL: string;
251
251
  protected name: string;
252
- protected headers: Record<string, string>;
252
+ protected headers: () => Promise<Record<string, string>>;
253
253
  protected supportFor: AxBaseAIFeatures | ((model: string) => AxBaseAIFeatures);
254
254
  private metrics;
255
255
  constructor(aiImpl: Readonly<AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, { name, apiURL, headers, modelInfo, models, options, supportFor, modelMap, }: Readonly<AxBaseAIArgs>);
256
256
  setName(name: string): void;
257
257
  setAPIURL(apiURL: string): void;
258
- setHeaders(headers: Record<string, string>): void;
258
+ setHeaders(headers: () => Promise<Record<string, string>>): void;
259
259
  setOptions(options: Readonly<AxAIServiceOptions>): void;
260
260
  getOptions(): Readonly<AxAIServiceOptions>;
261
261
  getModelInfo(): Readonly<AxModelInfoWithProvider>;
@@ -267,7 +267,7 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
267
267
  private updateLatencyMetrics;
268
268
  private updateErrorMetrics;
269
269
  getMetrics(): AxAIServiceMetrics;
270
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
270
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
271
271
  private _chat1;
272
272
  private _chat2;
273
273
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
@@ -813,7 +813,8 @@ declare enum AxAIGoogleGeminiModel {
813
813
  AQA = "aqa"
814
814
  }
815
815
  declare enum AxAIGoogleGeminiEmbedModel {
816
- TextEmbedding004 = "text-embedding-004"
816
+ TextEmbedding004 = "text-embedding-004",
817
+ TextEmbedding005 = "text-embedding-005"
817
818
  }
818
819
  declare enum AxAIGoogleGeminiSafetyCategory {
819
820
  HarmCategoryHarassment = "HARM_CATEGORY_HARASSMENT",
@@ -959,6 +960,24 @@ type AxAIGoogleGeminiBatchEmbedResponse = {
959
960
  values: number[];
960
961
  }[];
961
962
  };
963
+ /**
964
+ * AxAIGoogleVertexBatchEmbedRequest: Structure for making an embedding request to the Google Vertex API.
965
+ */
966
+ type AxAIGoogleVertexBatchEmbedRequest = {
967
+ instances: {
968
+ content: string;
969
+ }[];
970
+ };
971
+ /**
972
+ * AxAIGoogleVertexBatchEmbedResponse: Structure for handling responses from the Google Vertex API embedding requests.
973
+ */
974
+ type AxAIGoogleVertexBatchEmbedResponse = {
975
+ predictions: {
976
+ embeddings: {
977
+ values: number[];
978
+ };
979
+ }[];
980
+ };
962
981
 
963
982
  interface AxAIGoogleGeminiOptionsTools {
964
983
  codeExecution?: boolean;
@@ -969,9 +988,10 @@ interface AxAIGoogleGeminiOptionsTools {
969
988
  }
970
989
  interface AxAIGoogleGeminiArgs {
971
990
  name: 'google-gemini';
972
- apiKey: string;
991
+ apiKey?: string;
973
992
  projectId?: string;
974
993
  region?: string;
994
+ keyFile?: string;
975
995
  config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
976
996
  options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
977
997
  modelMap?: Record<string, AxAIGoogleGeminiModel | AxAIGoogleGeminiEmbedModel | string>;
@@ -979,8 +999,8 @@ interface AxAIGoogleGeminiArgs {
979
999
  /**
980
1000
  * AxAIGoogleGemini: AI Service
981
1001
  */
982
- declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse> {
983
- constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
1002
+ declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse> {
1003
+ constructor({ apiKey, projectId, region, keyFile, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
984
1004
  }
985
1005
 
986
1006
  declare enum AxAIGroqModel {
@@ -1204,7 +1224,7 @@ declare class AxAI implements AxAIService {
1204
1224
  };
1205
1225
  getModelMap(): AxAIModelMap | undefined;
1206
1226
  getMetrics(): AxAIServiceMetrics;
1207
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
1227
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
1208
1228
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
1209
1229
  setOptions(options: Readonly<AxAIServiceOptions>): void;
1210
1230
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -1302,6 +1322,12 @@ type AxProgramForwardOptions = {
1302
1322
  functionCall?: AxChatRequest['functionCall'];
1303
1323
  stopFunction?: string;
1304
1324
  };
1325
+ type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
1326
+ type AxGenDeltaOut<OUT> = {
1327
+ version: number;
1328
+ delta: Partial<OUT>;
1329
+ };
1330
+ type AxGenStreamingOut<OUT> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
1305
1331
  interface AxTunable {
1306
1332
  setExamples: (examples: Readonly<AxProgramExamples>) => void;
1307
1333
  setId: (id: string) => void;
@@ -1333,6 +1359,7 @@ declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> i
1333
1359
  getSignature(): AxSignature;
1334
1360
  register(prog: Readonly<AxTunable & AxUsable>): void;
1335
1361
  forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1362
+ streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1336
1363
  setId(id: string): void;
1337
1364
  setParentId(parentId: string): void;
1338
1365
  setExamples(examples: Readonly<AxProgramExamples>): void;
@@ -1350,6 +1377,7 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
1350
1377
  constructor();
1351
1378
  register(prog: Readonly<AxTunable & AxUsable>): void;
1352
1379
  forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1380
+ streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1353
1381
  setId(id: string): void;
1354
1382
  setParentId(parentId: string): void;
1355
1383
  setExamples(examples: Readonly<AxProgramExamples>): void;
@@ -1440,7 +1468,7 @@ declare class AxPromptTemplate {
1440
1468
  examples?: Record<string, AxFieldValue>[];
1441
1469
  demos?: Record<string, AxFieldValue>[];
1442
1470
  }>) => AxChatRequest["chatPrompt"];
1443
- renderExtraFields: (extraFields: readonly AxIField[]) => string | ({
1471
+ renderExtraFields: (extraFields: readonly AxIField[]) => ({
1444
1472
  type: "text";
1445
1473
  text: string;
1446
1474
  cache?: boolean;
@@ -1497,6 +1525,15 @@ interface AxResponseHandlerArgs<T> {
1497
1525
  traceId?: string;
1498
1526
  functions?: Readonly<AxFunction[]>;
1499
1527
  }
1528
+ interface AxStreamingEvent<T> {
1529
+ event: 'delta' | 'done' | 'error';
1530
+ data: {
1531
+ contentDelta?: string;
1532
+ partialValues?: Partial<T>;
1533
+ error?: string;
1534
+ functions?: AxChatResponseFunctionCall[];
1535
+ };
1536
+ }
1500
1537
  declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<AxGenOut> = AxGenerateResult<AxGenOut>> extends AxProgramWithSignature<IN, OUT> {
1501
1538
  private promptTemplate;
1502
1539
  private asserts;
@@ -1509,10 +1546,19 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1509
1546
  addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
1510
1547
  private forwardSendRequest;
1511
1548
  private forwardCore;
1512
- private processSteamingResponse;
1549
+ private processStreamingResponse;
1513
1550
  private processResponse;
1514
- private _forward;
1551
+ private _forward2;
1552
+ private shouldContinueSteps;
1553
+ _forward1(ai: Readonly<AxAIService>, values: IN, options: Readonly<AxProgramForwardOptions>): AsyncGenerator<{
1554
+ version: number;
1555
+ delta: Partial<OUT>;
1556
+ }, void, unknown>;
1515
1557
  forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1558
+ streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AsyncGenerator<{
1559
+ version: number;
1560
+ delta: Partial<OUT>;
1561
+ }, void, unknown>;
1516
1562
  }
1517
1563
 
1518
1564
  interface AxAgentic extends AxTunable, AxUsable {
@@ -1547,7 +1593,9 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
1547
1593
  })[];
1548
1594
  resetUsage(): void;
1549
1595
  getFunction(): AxFunction;
1596
+ private init;
1550
1597
  forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1598
+ streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1551
1599
  }
1552
1600
 
1553
1601
  interface AxApacheTikaArgs {
@@ -1601,7 +1649,7 @@ declare class AxBalancer implements AxAIService {
1601
1649
  streaming: boolean;
1602
1650
  };
1603
1651
  getMetrics(): AxAIServiceMetrics;
1604
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
1652
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
1605
1653
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
1606
1654
  setOptions(options: Readonly<AxAIServiceOptions>): void;
1607
1655
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -2076,6 +2124,41 @@ declare class AxInstanceRegistry<T> {
2076
2124
  [Symbol.iterator](): Generator<T, void, unknown>;
2077
2125
  }
2078
2126
 
2127
+ declare class AxMockAIService implements AxAIService {
2128
+ private readonly config;
2129
+ private options;
2130
+ private metrics;
2131
+ constructor(config?: {
2132
+ name?: string;
2133
+ modelInfo?: Partial<AxModelInfoWithProvider>;
2134
+ embedModelInfo?: AxModelInfoWithProvider;
2135
+ features?: {
2136
+ functions?: boolean;
2137
+ streaming?: boolean;
2138
+ };
2139
+ modelMap?: AxAIModelMap;
2140
+ chatResponse?: AxChatResponse | ((req: Readonly<AxChatRequest>) => AxChatResponse | Promise<AxChatResponse>);
2141
+ embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
2142
+ shouldError?: boolean;
2143
+ errorMessage?: string;
2144
+ latencyMs?: number;
2145
+ });
2146
+ getName(): string;
2147
+ getModelInfo(): Readonly<AxModelInfoWithProvider>;
2148
+ getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
2149
+ getFeatures(_model?: string): {
2150
+ functions: boolean;
2151
+ streaming: boolean;
2152
+ };
2153
+ getModelMap(): AxAIModelMap | undefined;
2154
+ getMetrics(): AxAIServiceMetrics;
2155
+ chat(req: Readonly<AxChatRequest>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
2156
+ embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
2157
+ setOptions(options: Readonly<AxAIServiceOptions>): void;
2158
+ getOptions(): Readonly<AxAIServiceOptions>;
2159
+ private updateMetrics;
2160
+ }
2161
+
2079
2162
  declare class AxRAG extends AxChainOfThought<{
2080
2163
  context: string[];
2081
2164
  question: string;
@@ -2096,4 +2179,4 @@ declare class AxRAG extends AxChainOfThought<{
2096
2179
  }>;
2097
2180
  }
2098
2181
 
2099
- 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, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, 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, 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, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelMap, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, 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, type AxAIServiceImpl, type AxAIServiceMetrics, type AxAIServiceOptions, AxAITogether, type AxAITogetherArgs, type AxAPI, AxAgent, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, type AxBaseAIFeatures, 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 AxFieldTemplateFn, type AxFieldValue, type AxFunction, type AxFunctionExec, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxRoute, AxRouter, type AxRouterForwardOptions, AxSignature, AxSpanKindValues, type AxStreamingAssertion, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
2182
+ 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, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, 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, 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 AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelMap, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, 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, type AxAIServiceImpl, type AxAIServiceMetrics, type AxAIServiceOptions, AxAITogether, type AxAITogetherArgs, type AxAPI, AxAgent, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, type AxBaseAIFeatures, 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 AxFieldTemplateFn, type AxFieldValue, type AxFunction, type AxFunctionExec, 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 AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, 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, AxRoute, AxRouter, type AxRouterForwardOptions, AxSignature, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReadableStream } from 'stream/web';
1
+ import { ReadableStream as ReadableStream$1 } from 'stream/web';
2
2
  import { Tracer, Span } from '@opentelemetry/api';
3
3
 
4
4
  /**
@@ -176,10 +176,10 @@ type AxEmbedRequest = {
176
176
  embedModel?: string;
177
177
  };
178
178
  type AxInternalEmbedRequest = Omit<AxEmbedRequest, 'embedModel'> & Required<Pick<AxEmbedRequest, 'embedModel'>>;
179
- type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
179
+ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream$1<T>>, info: Readonly<{
180
180
  modelUsage?: AxTokenUsage;
181
181
  embedModelUsage?: AxTokenUsage;
182
- }>) => Promise<T | ReadableStream<T>>;
182
+ }>) => Promise<T | ReadableStream$1<T>>;
183
183
  type AxAIPromptConfig = {
184
184
  stream?: boolean;
185
185
  };
@@ -205,7 +205,7 @@ interface AxAIService {
205
205
  };
206
206
  getModelMap(): AxAIModelMap | undefined;
207
207
  getMetrics(): AxAIServiceMetrics;
208
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
208
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
209
209
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
210
210
  setOptions(options: Readonly<AxAIServiceOptions>): void;
211
211
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -226,7 +226,7 @@ interface AxBaseAIFeatures {
226
226
  interface AxBaseAIArgs {
227
227
  name: string;
228
228
  apiURL: string;
229
- headers: Record<string, string>;
229
+ headers: () => Promise<Record<string, string>>;
230
230
  modelInfo: Readonly<AxModelInfo[]>;
231
231
  models: Readonly<{
232
232
  model: string;
@@ -249,13 +249,13 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
249
249
  private models;
250
250
  protected apiURL: string;
251
251
  protected name: string;
252
- protected headers: Record<string, string>;
252
+ protected headers: () => Promise<Record<string, string>>;
253
253
  protected supportFor: AxBaseAIFeatures | ((model: string) => AxBaseAIFeatures);
254
254
  private metrics;
255
255
  constructor(aiImpl: Readonly<AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, { name, apiURL, headers, modelInfo, models, options, supportFor, modelMap, }: Readonly<AxBaseAIArgs>);
256
256
  setName(name: string): void;
257
257
  setAPIURL(apiURL: string): void;
258
- setHeaders(headers: Record<string, string>): void;
258
+ setHeaders(headers: () => Promise<Record<string, string>>): void;
259
259
  setOptions(options: Readonly<AxAIServiceOptions>): void;
260
260
  getOptions(): Readonly<AxAIServiceOptions>;
261
261
  getModelInfo(): Readonly<AxModelInfoWithProvider>;
@@ -267,7 +267,7 @@ declare class AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponse
267
267
  private updateLatencyMetrics;
268
268
  private updateErrorMetrics;
269
269
  getMetrics(): AxAIServiceMetrics;
270
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
270
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
271
271
  private _chat1;
272
272
  private _chat2;
273
273
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
@@ -813,7 +813,8 @@ declare enum AxAIGoogleGeminiModel {
813
813
  AQA = "aqa"
814
814
  }
815
815
  declare enum AxAIGoogleGeminiEmbedModel {
816
- TextEmbedding004 = "text-embedding-004"
816
+ TextEmbedding004 = "text-embedding-004",
817
+ TextEmbedding005 = "text-embedding-005"
817
818
  }
818
819
  declare enum AxAIGoogleGeminiSafetyCategory {
819
820
  HarmCategoryHarassment = "HARM_CATEGORY_HARASSMENT",
@@ -959,6 +960,24 @@ type AxAIGoogleGeminiBatchEmbedResponse = {
959
960
  values: number[];
960
961
  }[];
961
962
  };
963
+ /**
964
+ * AxAIGoogleVertexBatchEmbedRequest: Structure for making an embedding request to the Google Vertex API.
965
+ */
966
+ type AxAIGoogleVertexBatchEmbedRequest = {
967
+ instances: {
968
+ content: string;
969
+ }[];
970
+ };
971
+ /**
972
+ * AxAIGoogleVertexBatchEmbedResponse: Structure for handling responses from the Google Vertex API embedding requests.
973
+ */
974
+ type AxAIGoogleVertexBatchEmbedResponse = {
975
+ predictions: {
976
+ embeddings: {
977
+ values: number[];
978
+ };
979
+ }[];
980
+ };
962
981
 
963
982
  interface AxAIGoogleGeminiOptionsTools {
964
983
  codeExecution?: boolean;
@@ -969,9 +988,10 @@ interface AxAIGoogleGeminiOptionsTools {
969
988
  }
970
989
  interface AxAIGoogleGeminiArgs {
971
990
  name: 'google-gemini';
972
- apiKey: string;
991
+ apiKey?: string;
973
992
  projectId?: string;
974
993
  region?: string;
994
+ keyFile?: string;
975
995
  config?: Readonly<Partial<AxAIGoogleGeminiConfig>>;
976
996
  options?: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>;
977
997
  modelMap?: Record<string, AxAIGoogleGeminiModel | AxAIGoogleGeminiEmbedModel | string>;
@@ -979,8 +999,8 @@ interface AxAIGoogleGeminiArgs {
979
999
  /**
980
1000
  * AxAIGoogleGemini: AI Service
981
1001
  */
982
- declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse> {
983
- constructor({ apiKey, projectId, region, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
1002
+ declare class AxAIGoogleGemini extends AxBaseAI<AxAIGoogleGeminiChatRequest, AxAIGoogleGeminiBatchEmbedRequest | AxAIGoogleVertexBatchEmbedRequest, AxAIGoogleGeminiChatResponse, AxAIGoogleGeminiChatResponseDelta, AxAIGoogleGeminiBatchEmbedResponse | AxAIGoogleVertexBatchEmbedResponse> {
1003
+ constructor({ apiKey, projectId, region, keyFile, config, options, modelMap, }: Readonly<Omit<AxAIGoogleGeminiArgs, 'name'>>);
984
1004
  }
985
1005
 
986
1006
  declare enum AxAIGroqModel {
@@ -1204,7 +1224,7 @@ declare class AxAI implements AxAIService {
1204
1224
  };
1205
1225
  getModelMap(): AxAIModelMap | undefined;
1206
1226
  getMetrics(): AxAIServiceMetrics;
1207
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
1227
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
1208
1228
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
1209
1229
  setOptions(options: Readonly<AxAIServiceOptions>): void;
1210
1230
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -1302,6 +1322,12 @@ type AxProgramForwardOptions = {
1302
1322
  functionCall?: AxChatRequest['functionCall'];
1303
1323
  stopFunction?: string;
1304
1324
  };
1325
+ type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
1326
+ type AxGenDeltaOut<OUT> = {
1327
+ version: number;
1328
+ delta: Partial<OUT>;
1329
+ };
1330
+ type AxGenStreamingOut<OUT> = AsyncGenerator<AxGenDeltaOut<OUT>, void | OUT, unknown>;
1305
1331
  interface AxTunable {
1306
1332
  setExamples: (examples: Readonly<AxProgramExamples>) => void;
1307
1333
  setId: (id: string) => void;
@@ -1333,6 +1359,7 @@ declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> i
1333
1359
  getSignature(): AxSignature;
1334
1360
  register(prog: Readonly<AxTunable & AxUsable>): void;
1335
1361
  forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1362
+ streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1336
1363
  setId(id: string): void;
1337
1364
  setParentId(parentId: string): void;
1338
1365
  setExamples(examples: Readonly<AxProgramExamples>): void;
@@ -1350,6 +1377,7 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
1350
1377
  constructor();
1351
1378
  register(prog: Readonly<AxTunable & AxUsable>): void;
1352
1379
  forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1380
+ streamingForward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1353
1381
  setId(id: string): void;
1354
1382
  setParentId(parentId: string): void;
1355
1383
  setExamples(examples: Readonly<AxProgramExamples>): void;
@@ -1440,7 +1468,7 @@ declare class AxPromptTemplate {
1440
1468
  examples?: Record<string, AxFieldValue>[];
1441
1469
  demos?: Record<string, AxFieldValue>[];
1442
1470
  }>) => AxChatRequest["chatPrompt"];
1443
- renderExtraFields: (extraFields: readonly AxIField[]) => string | ({
1471
+ renderExtraFields: (extraFields: readonly AxIField[]) => ({
1444
1472
  type: "text";
1445
1473
  text: string;
1446
1474
  cache?: boolean;
@@ -1497,6 +1525,15 @@ interface AxResponseHandlerArgs<T> {
1497
1525
  traceId?: string;
1498
1526
  functions?: Readonly<AxFunction[]>;
1499
1527
  }
1528
+ interface AxStreamingEvent<T> {
1529
+ event: 'delta' | 'done' | 'error';
1530
+ data: {
1531
+ contentDelta?: string;
1532
+ partialValues?: Partial<T>;
1533
+ error?: string;
1534
+ functions?: AxChatResponseFunctionCall[];
1535
+ };
1536
+ }
1500
1537
  declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<AxGenOut> = AxGenerateResult<AxGenOut>> extends AxProgramWithSignature<IN, OUT> {
1501
1538
  private promptTemplate;
1502
1539
  private asserts;
@@ -1509,10 +1546,19 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1509
1546
  addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
1510
1547
  private forwardSendRequest;
1511
1548
  private forwardCore;
1512
- private processSteamingResponse;
1549
+ private processStreamingResponse;
1513
1550
  private processResponse;
1514
- private _forward;
1551
+ private _forward2;
1552
+ private shouldContinueSteps;
1553
+ _forward1(ai: Readonly<AxAIService>, values: IN, options: Readonly<AxProgramForwardOptions>): AsyncGenerator<{
1554
+ version: number;
1555
+ delta: Partial<OUT>;
1556
+ }, void, unknown>;
1515
1557
  forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1558
+ streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AsyncGenerator<{
1559
+ version: number;
1560
+ delta: Partial<OUT>;
1561
+ }, void, unknown>;
1516
1562
  }
1517
1563
 
1518
1564
  interface AxAgentic extends AxTunable, AxUsable {
@@ -1547,7 +1593,9 @@ declare class AxAgent<IN extends AxGenIn, OUT extends AxGenOut> implements AxAge
1547
1593
  })[];
1548
1594
  resetUsage(): void;
1549
1595
  getFunction(): AxFunction;
1596
+ private init;
1550
1597
  forward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
1598
+ streamingForward(ai: Readonly<AxAIService>, values: IN, options?: Readonly<AxProgramStreamingForwardOptions>): AxGenStreamingOut<OUT>;
1551
1599
  }
1552
1600
 
1553
1601
  interface AxApacheTikaArgs {
@@ -1601,7 +1649,7 @@ declare class AxBalancer implements AxAIService {
1601
1649
  streaming: boolean;
1602
1650
  };
1603
1651
  getMetrics(): AxAIServiceMetrics;
1604
- chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
1652
+ chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions> | undefined): Promise<AxChatResponse | ReadableStream$1<AxChatResponse>>;
1605
1653
  embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions> | undefined): Promise<AxEmbedResponse>;
1606
1654
  setOptions(options: Readonly<AxAIServiceOptions>): void;
1607
1655
  getOptions(): Readonly<AxAIServiceOptions>;
@@ -2076,6 +2124,41 @@ declare class AxInstanceRegistry<T> {
2076
2124
  [Symbol.iterator](): Generator<T, void, unknown>;
2077
2125
  }
2078
2126
 
2127
+ declare class AxMockAIService implements AxAIService {
2128
+ private readonly config;
2129
+ private options;
2130
+ private metrics;
2131
+ constructor(config?: {
2132
+ name?: string;
2133
+ modelInfo?: Partial<AxModelInfoWithProvider>;
2134
+ embedModelInfo?: AxModelInfoWithProvider;
2135
+ features?: {
2136
+ functions?: boolean;
2137
+ streaming?: boolean;
2138
+ };
2139
+ modelMap?: AxAIModelMap;
2140
+ chatResponse?: AxChatResponse | ((req: Readonly<AxChatRequest>) => AxChatResponse | Promise<AxChatResponse>);
2141
+ embedResponse?: AxEmbedResponse | ((req: Readonly<AxEmbedRequest>) => AxEmbedResponse | Promise<AxEmbedResponse>);
2142
+ shouldError?: boolean;
2143
+ errorMessage?: string;
2144
+ latencyMs?: number;
2145
+ });
2146
+ getName(): string;
2147
+ getModelInfo(): Readonly<AxModelInfoWithProvider>;
2148
+ getEmbedModelInfo(): Readonly<AxModelInfoWithProvider> | undefined;
2149
+ getFeatures(_model?: string): {
2150
+ functions: boolean;
2151
+ streaming: boolean;
2152
+ };
2153
+ getModelMap(): AxAIModelMap | undefined;
2154
+ getMetrics(): AxAIServiceMetrics;
2155
+ chat(req: Readonly<AxChatRequest>, _options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
2156
+ embed(req: Readonly<AxEmbedRequest>, _options?: Readonly<AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
2157
+ setOptions(options: Readonly<AxAIServiceOptions>): void;
2158
+ getOptions(): Readonly<AxAIServiceOptions>;
2159
+ private updateMetrics;
2160
+ }
2161
+
2079
2162
  declare class AxRAG extends AxChainOfThought<{
2080
2163
  context: string[];
2081
2164
  question: string;
@@ -2096,4 +2179,4 @@ declare class AxRAG extends AxChainOfThought<{
2096
2179
  }>;
2097
2180
  }
2098
2181
 
2099
- 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, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, 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, 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, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelMap, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, 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, type AxAIServiceImpl, type AxAIServiceMetrics, type AxAIServiceOptions, AxAITogether, type AxAITogetherArgs, type AxAPI, AxAgent, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, type AxBaseAIFeatures, 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 AxFieldTemplateFn, type AxFieldValue, type AxFunction, type AxFunctionExec, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMemory, type AxMetricFn, type AxMetricFnArgs, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxRoute, AxRouter, type AxRouterForwardOptions, AxSignature, AxSpanKindValues, type AxStreamingAssertion, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };
2182
+ 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, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, 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, 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 AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelMap, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, 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, type AxAIServiceImpl, type AxAIServiceMetrics, type AxAIServiceOptions, AxAITogether, type AxAITogetherArgs, type AxAPI, AxAgent, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, type AxBaseAIFeatures, 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 AxFieldTemplateFn, type AxFieldValue, type AxFunction, type AxFunctionExec, 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 AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, 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, AxRoute, AxRouter, type AxRouterForwardOptions, AxSignature, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable };