@ax-llm/ax 10.0.47 → 10.0.48

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
@@ -1455,24 +1455,16 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
1455
1455
  interface AxAssertion {
1456
1456
  fn(values: Record<string, unknown>): boolean | undefined;
1457
1457
  message?: string;
1458
- optional?: boolean;
1459
1458
  }
1460
1459
  interface AxStreamingAssertion {
1461
1460
  fieldName: string;
1462
1461
  fn(content: string, done?: boolean): boolean | undefined;
1463
1462
  message?: string;
1464
- optional?: boolean;
1465
1463
  }
1466
1464
  declare class AxAssertionError extends Error {
1467
- private values;
1468
- private optional?;
1469
- constructor({ message, values, optional, }: Readonly<{
1465
+ constructor({ message, }: Readonly<{
1470
1466
  message: string;
1471
- values: Record<string, unknown>;
1472
- optional?: boolean;
1473
1467
  }>);
1474
- getValue: () => Record<string, unknown>;
1475
- getOptional: () => boolean | undefined;
1476
1468
  getFixingInstructions: () => {
1477
1469
  name: string;
1478
1470
  title: string;
@@ -1496,6 +1488,17 @@ declare class AxMemory implements AxAIMemory {
1496
1488
  reset(sessionId?: string): void;
1497
1489
  }
1498
1490
 
1491
+ declare class AxFunctionError extends Error {
1492
+ private fields;
1493
+ constructor(fields: {
1494
+ field: string;
1495
+ message: string;
1496
+ }[]);
1497
+ getFields: () => {
1498
+ field: string;
1499
+ message: string;
1500
+ }[];
1501
+ }
1499
1502
  type AxChatResponseFunctionCall = {
1500
1503
  id?: string;
1501
1504
  name: string;
@@ -1607,8 +1610,8 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1607
1610
  private functions?;
1608
1611
  private functionsExecuted;
1609
1612
  constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
1610
- addAssert: (fn: AxAssertion["fn"], message?: string, optional?: boolean) => void;
1611
- addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
1613
+ addAssert: (fn: AxAssertion["fn"], message?: string) => void;
1614
+ addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string) => void;
1612
1615
  private forwardSendRequest;
1613
1616
  private forwardCore;
1614
1617
  private processStreamingResponse;
@@ -2246,4 +2249,4 @@ declare class AxRAG extends AxChainOfThought<{
2246
2249
  }>;
2247
2250
  }
2248
2251
 
2249
- 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, 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, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, 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 };
2252
+ 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, 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, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, 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, AxFunctionError, 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
@@ -1455,24 +1455,16 @@ declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxT
1455
1455
  interface AxAssertion {
1456
1456
  fn(values: Record<string, unknown>): boolean | undefined;
1457
1457
  message?: string;
1458
- optional?: boolean;
1459
1458
  }
1460
1459
  interface AxStreamingAssertion {
1461
1460
  fieldName: string;
1462
1461
  fn(content: string, done?: boolean): boolean | undefined;
1463
1462
  message?: string;
1464
- optional?: boolean;
1465
1463
  }
1466
1464
  declare class AxAssertionError extends Error {
1467
- private values;
1468
- private optional?;
1469
- constructor({ message, values, optional, }: Readonly<{
1465
+ constructor({ message, }: Readonly<{
1470
1466
  message: string;
1471
- values: Record<string, unknown>;
1472
- optional?: boolean;
1473
1467
  }>);
1474
- getValue: () => Record<string, unknown>;
1475
- getOptional: () => boolean | undefined;
1476
1468
  getFixingInstructions: () => {
1477
1469
  name: string;
1478
1470
  title: string;
@@ -1496,6 +1488,17 @@ declare class AxMemory implements AxAIMemory {
1496
1488
  reset(sessionId?: string): void;
1497
1489
  }
1498
1490
 
1491
+ declare class AxFunctionError extends Error {
1492
+ private fields;
1493
+ constructor(fields: {
1494
+ field: string;
1495
+ message: string;
1496
+ }[]);
1497
+ getFields: () => {
1498
+ field: string;
1499
+ message: string;
1500
+ }[];
1501
+ }
1499
1502
  type AxChatResponseFunctionCall = {
1500
1503
  id?: string;
1501
1504
  name: string;
@@ -1607,8 +1610,8 @@ declare class AxGen<IN extends AxGenIn = AxGenIn, OUT extends AxGenerateResult<A
1607
1610
  private functions?;
1608
1611
  private functionsExecuted;
1609
1612
  constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxGenOptions>);
1610
- addAssert: (fn: AxAssertion["fn"], message?: string, optional?: boolean) => void;
1611
- addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string, optional?: boolean) => void;
1613
+ addAssert: (fn: AxAssertion["fn"], message?: string) => void;
1614
+ addStreamingAssert: (fieldName: string, fn: AxStreamingAssertion["fn"], message?: string) => void;
1612
1615
  private forwardSendRequest;
1613
1616
  private forwardCore;
1614
1617
  private processStreamingResponse;
@@ -2246,4 +2249,4 @@ declare class AxRAG extends AxChainOfThought<{
2246
2249
  }>;
2247
2250
  }
2248
2251
 
2249
- 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, 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, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, 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 };
2252
+ 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, 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, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, 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, AxFunctionError, 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.js CHANGED
@@ -217,7 +217,7 @@ var AxAIServiceError = class extends Error {
217
217
  super(message);
218
218
  this.url = url;
219
219
  this.requestBody = requestBody;
220
- this.name = "AxAIServiceError";
220
+ this.name = this.constructor.name;
221
221
  this.timestamp = (/* @__PURE__ */ new Date()).toISOString();
222
222
  this.errorId = crypto.randomUUID();
223
223
  this.context = context;
@@ -254,7 +254,7 @@ var AxAIServiceStatusError = class extends AxAIServiceError {
254
254
  });
255
255
  this.status = status;
256
256
  this.statusText = statusText;
257
- this.name = "AxAIServiceStatusError";
257
+ this.name = this.constructor.name;
258
258
  }
259
259
  };
260
260
  var AxAIServiceNetworkError = class extends AxAIServiceError {
@@ -265,14 +265,14 @@ var AxAIServiceNetworkError = class extends AxAIServiceError {
265
265
  ...context
266
266
  });
267
267
  this.originalError = originalError;
268
- this.name = "AxAIServiceNetworkError";
268
+ this.name = this.constructor.name;
269
269
  this.stack = originalError.stack;
270
270
  }
271
271
  };
272
272
  var AxAIServiceResponseError = class extends AxAIServiceError {
273
273
  constructor(message, url, requestBody, context) {
274
274
  super(message, url, requestBody, context);
275
- this.name = "AxAIServiceResponseError";
275
+ this.name = this.constructor.name;
276
276
  }
277
277
  };
278
278
  var AxAIServiceStreamTerminatedError = class extends AxAIServiceError {
@@ -282,7 +282,7 @@ var AxAIServiceStreamTerminatedError = class extends AxAIServiceError {
282
282
  ...context
283
283
  });
284
284
  this.lastChunk = lastChunk;
285
- this.name = "AxAIServiceStreamTerminatedError";
285
+ this.name = this.constructor.name;
286
286
  }
287
287
  };
288
288
  var AxAIServiceTimeoutError = class extends AxAIServiceError {
@@ -291,13 +291,13 @@ var AxAIServiceTimeoutError = class extends AxAIServiceError {
291
291
  timeoutMs,
292
292
  ...context
293
293
  });
294
- this.name = "AxAIServiceTimeoutError";
294
+ this.name = this.constructor.name;
295
295
  }
296
296
  };
297
297
  var AxAIServiceAuthenticationError = class extends AxAIServiceError {
298
298
  constructor(url, requestBody, context) {
299
299
  super("Authentication failed", url, requestBody, context);
300
- this.name = "AxAIServiceAuthenticationError";
300
+ this.name = this.constructor.name;
301
301
  }
302
302
  };
303
303
  function calculateRetryDelay(attempt, config) {
@@ -3717,21 +3717,13 @@ var AxMemory = class {
3717
3717
 
3718
3718
  // dsp/asserts.ts
3719
3719
  var AxAssertionError = class extends Error {
3720
- values;
3721
- optional;
3722
3720
  constructor({
3723
- message,
3724
- values,
3725
- optional
3721
+ message
3726
3722
  }) {
3727
3723
  super(message);
3728
- this.values = values;
3729
- this.optional = optional;
3730
3724
  this.name = this.constructor.name;
3731
3725
  this.stack = new Error().stack;
3732
3726
  }
3733
- getValue = () => this.values;
3734
- getOptional = () => this.optional;
3735
3727
  getFixingInstructions = () => {
3736
3728
  const extraFields = [];
3737
3729
  extraFields.push({
@@ -3744,13 +3736,16 @@ var AxAssertionError = class extends Error {
3744
3736
  };
3745
3737
  var assertAssertions = (asserts, values) => {
3746
3738
  for (const assert of asserts) {
3747
- const { fn, message, optional } = assert;
3739
+ const { fn, message } = assert;
3748
3740
  const res = fn(values);
3749
3741
  if (res === void 0) {
3750
3742
  continue;
3751
3743
  }
3752
- if (!res && message) {
3753
- throw new AxAssertionError({ message, values, optional });
3744
+ if (!res) {
3745
+ if (!message) {
3746
+ throw new Error(`Assertion Failed: No message provided for assertion`);
3747
+ }
3748
+ throw new AxAssertionError({ message });
3754
3749
  }
3755
3750
  }
3756
3751
  };
@@ -3766,13 +3761,13 @@ var assertStreamingAssertions = (asserts, values, xstate, content, final) => {
3766
3761
  }
3767
3762
  const currValue = content.substring(xstate.s);
3768
3763
  for (const assert of fieldAsserts) {
3769
- const { message, optional, fn } = assert;
3764
+ const { message, fn } = assert;
3770
3765
  const res = fn(currValue, final);
3771
3766
  if (res === void 0) {
3772
3767
  continue;
3773
3768
  }
3774
3769
  if (!res && message) {
3775
- throw new AxAssertionError({ message, values, optional });
3770
+ throw new AxAssertionError({ message });
3776
3771
  }
3777
3772
  }
3778
3773
  };
@@ -5026,13 +5021,11 @@ var ValidationError = class extends Error {
5026
5021
  super(message);
5027
5022
  this.fields = fields;
5028
5023
  this.name = this.constructor.name;
5029
- Error.captureStackTrace(this, this.constructor);
5030
5024
  }
5031
- getFields = () => this.fields;
5032
5025
  getFixingInstructions = () => {
5033
5026
  return this.fields.map((field) => ({
5034
5027
  name: "outputError",
5035
- title: "Error In Output",
5028
+ title: "Errors In Output Fields",
5036
5029
  description: `Please fix and return the field \`${field.title}\` of type \`${toFieldType(field.type)}\`, ${this.message}.`
5037
5030
  }));
5038
5031
  };
@@ -5390,6 +5383,49 @@ var validateJSONSchema = (schema) => {
5390
5383
  };
5391
5384
 
5392
5385
  // dsp/functions.ts
5386
+ var AxFunctionError = class extends Error {
5387
+ constructor(fields) {
5388
+ super();
5389
+ this.fields = fields;
5390
+ this.name = this.constructor.name;
5391
+ }
5392
+ getFields = () => this.fields;
5393
+ };
5394
+ var FunctionError = class extends Error {
5395
+ fields;
5396
+ func;
5397
+ constructor({
5398
+ fields,
5399
+ func
5400
+ }) {
5401
+ super();
5402
+ this.fields = fields;
5403
+ this.func = func;
5404
+ this.name = this.constructor.name;
5405
+ }
5406
+ getFieldDescription(fieldName) {
5407
+ if (!this.func.parameters?.properties?.[fieldName]) {
5408
+ return "";
5409
+ }
5410
+ const fieldSchema = this.func.parameters.properties[fieldName];
5411
+ let description = fieldSchema.description;
5412
+ if (fieldSchema.enum?.length) {
5413
+ description += ` Allowed values are: ${fieldSchema.enum.join(", ")}`;
5414
+ }
5415
+ return description;
5416
+ }
5417
+ getFixingInstructions = () => {
5418
+ return this.fields.map((fieldError) => {
5419
+ const schemaDescription = this.getFieldDescription(fieldError.field);
5420
+ const fullDescription = schemaDescription ? `${fieldError.message}. ${schemaDescription}` : fieldError.message;
5421
+ return {
5422
+ name: "functionArgumentError",
5423
+ title: `Errors in Function '${this.func.name}' Arguments`,
5424
+ description: `Please fix the argument '${fieldError.field}' in function '${this.func.name}': ${fullDescription}`
5425
+ };
5426
+ });
5427
+ };
5428
+ };
5393
5429
  var AxFunctionProcessor = class {
5394
5430
  funcList = [];
5395
5431
  constructor(funcList) {
@@ -5430,7 +5466,17 @@ var AxFunctionProcessor = class {
5430
5466
  if (!fnSpec.func) {
5431
5467
  throw new Error("No handler for function: " + func.name);
5432
5468
  }
5433
- return await this.executeFunction(fnSpec, func, options);
5469
+ try {
5470
+ return await this.executeFunction(fnSpec, func, options);
5471
+ } catch (e) {
5472
+ if (e instanceof AxFunctionError) {
5473
+ throw new FunctionError({
5474
+ fields: e.getFields(),
5475
+ func: fnSpec
5476
+ });
5477
+ }
5478
+ throw e;
5479
+ }
5434
5480
  };
5435
5481
  };
5436
5482
  var parseFunctions = (newFuncs, existingFuncs) => {
@@ -5509,11 +5555,11 @@ var AxGen = class extends AxProgramWithSignature {
5509
5555
  this.functions = parseFunctions(options.functions);
5510
5556
  }
5511
5557
  }
5512
- addAssert = (fn, message, optional) => {
5513
- this.asserts.push({ fn, message, optional });
5558
+ addAssert = (fn, message) => {
5559
+ this.asserts.push({ fn, message });
5514
5560
  };
5515
- addStreamingAssert = (fieldName, fn, message, optional) => {
5516
- this.streamingAsserts.push({ fieldName, fn, message, optional });
5561
+ addStreamingAssert = (fieldName, fn, message) => {
5562
+ this.streamingAsserts.push({ fieldName, fn, message });
5517
5563
  };
5518
5564
  async forwardSendRequest({
5519
5565
  ai,
@@ -5763,6 +5809,9 @@ var AxGen = class extends AxProgramWithSignature {
5763
5809
  const e1 = e;
5764
5810
  errorFields = e1.getFixingInstructions();
5765
5811
  err = e;
5812
+ } else if (e instanceof FunctionError) {
5813
+ errorFields = e.getFixingInstructions();
5814
+ err = e;
5766
5815
  } else if (e instanceof AxAIServiceStreamTerminatedError) {
5767
5816
  } else {
5768
5817
  throw e;
@@ -5778,9 +5827,6 @@ var AxGen = class extends AxProgramWithSignature {
5778
5827
  }
5779
5828
  }
5780
5829
  }
5781
- if (err instanceof AxAssertionError && err.getOptional()) {
5782
- return err.getValue();
5783
- }
5784
5830
  throw new Error(`Unable to fix validation error: ${err?.message}`);
5785
5831
  }
5786
5832
  throw new Error(`Max steps reached: ${maxSteps}`);
@@ -7839,6 +7885,7 @@ export {
7839
7885
  AxDefaultResultReranker,
7840
7886
  AxDockerSession,
7841
7887
  AxEmbeddingAdapter,
7888
+ AxFunctionError,
7842
7889
  AxFunctionProcessor,
7843
7890
  AxGen,
7844
7891
  AxHFDataLoader,