@ax-llm/ax 10.0.48 → 10.0.49
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 +68 -60
- package/index.cjs.map +1 -1
- package/index.d.cts +4 -7
- package/index.d.ts +4 -7
- package/index.js +68 -60
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -176,6 +176,7 @@ type AxChatRequest = {
|
|
|
176
176
|
} | {
|
|
177
177
|
role: 'function';
|
|
178
178
|
result: string;
|
|
179
|
+
isError?: boolean;
|
|
179
180
|
functionId: string;
|
|
180
181
|
cache?: boolean;
|
|
181
182
|
}>[];
|
|
@@ -1500,19 +1501,15 @@ declare class AxFunctionError extends Error {
|
|
|
1500
1501
|
}[];
|
|
1501
1502
|
}
|
|
1502
1503
|
type AxChatResponseFunctionCall = {
|
|
1503
|
-
id
|
|
1504
|
+
id: string;
|
|
1504
1505
|
name: string;
|
|
1505
1506
|
args: string;
|
|
1506
1507
|
};
|
|
1507
|
-
type AxFunctionExec = {
|
|
1508
|
-
id?: string;
|
|
1509
|
-
result?: string;
|
|
1510
|
-
};
|
|
1511
1508
|
declare class AxFunctionProcessor {
|
|
1512
1509
|
private funcList;
|
|
1513
1510
|
constructor(funcList: Readonly<AxFunction[]>);
|
|
1514
1511
|
private executeFunction;
|
|
1515
|
-
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<
|
|
1512
|
+
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<string>;
|
|
1516
1513
|
}
|
|
1517
1514
|
type AxInputFunctionType = AxFunction[] | {
|
|
1518
1515
|
toFunction: () => AxFunction;
|
|
@@ -2249,4 +2246,4 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
2249
2246
|
}>;
|
|
2250
2247
|
}
|
|
2251
2248
|
|
|
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
|
|
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, 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 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
|
@@ -176,6 +176,7 @@ type AxChatRequest = {
|
|
|
176
176
|
} | {
|
|
177
177
|
role: 'function';
|
|
178
178
|
result: string;
|
|
179
|
+
isError?: boolean;
|
|
179
180
|
functionId: string;
|
|
180
181
|
cache?: boolean;
|
|
181
182
|
}>[];
|
|
@@ -1500,19 +1501,15 @@ declare class AxFunctionError extends Error {
|
|
|
1500
1501
|
}[];
|
|
1501
1502
|
}
|
|
1502
1503
|
type AxChatResponseFunctionCall = {
|
|
1503
|
-
id
|
|
1504
|
+
id: string;
|
|
1504
1505
|
name: string;
|
|
1505
1506
|
args: string;
|
|
1506
1507
|
};
|
|
1507
|
-
type AxFunctionExec = {
|
|
1508
|
-
id?: string;
|
|
1509
|
-
result?: string;
|
|
1510
|
-
};
|
|
1511
1508
|
declare class AxFunctionProcessor {
|
|
1512
1509
|
private funcList;
|
|
1513
1510
|
constructor(funcList: Readonly<AxFunction[]>);
|
|
1514
1511
|
private executeFunction;
|
|
1515
|
-
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<
|
|
1512
|
+
execute: (func: Readonly<AxChatResponseFunctionCall>, options?: Readonly<AxAIServiceActionOptions>) => Promise<string>;
|
|
1516
1513
|
}
|
|
1517
1514
|
type AxInputFunctionType = AxFunction[] | {
|
|
1518
1515
|
toFunction: () => AxFunction;
|
|
@@ -2249,4 +2246,4 @@ declare class AxRAG extends AxChainOfThought<{
|
|
|
2249
2246
|
}>;
|
|
2250
2247
|
}
|
|
2251
2248
|
|
|
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
|
|
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, 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 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
|
@@ -1486,16 +1486,18 @@ function createMessages(chatPrompt) {
|
|
|
1486
1486
|
const items = chatPrompt.map((msg) => {
|
|
1487
1487
|
switch (msg.role) {
|
|
1488
1488
|
case "function":
|
|
1489
|
+
const content = [
|
|
1490
|
+
{
|
|
1491
|
+
type: "tool_result",
|
|
1492
|
+
content: msg.result,
|
|
1493
|
+
tool_use_id: msg.functionId,
|
|
1494
|
+
...msg.isError ? { is_error: true } : {},
|
|
1495
|
+
...msg.cache ? { cache: { type: "ephemeral" } } : {}
|
|
1496
|
+
}
|
|
1497
|
+
];
|
|
1489
1498
|
return {
|
|
1490
1499
|
role: "user",
|
|
1491
|
-
content
|
|
1492
|
-
{
|
|
1493
|
-
type: "tool_result",
|
|
1494
|
-
content: msg.result,
|
|
1495
|
-
tool_use_id: msg.functionId,
|
|
1496
|
-
...msg.cache ? { cache: { type: "ephemeral" } } : {}
|
|
1497
|
-
}
|
|
1498
|
-
]
|
|
1500
|
+
content
|
|
1499
1501
|
};
|
|
1500
1502
|
case "user": {
|
|
1501
1503
|
if (typeof msg.content === "string") {
|
|
@@ -1504,7 +1506,7 @@ function createMessages(chatPrompt) {
|
|
|
1504
1506
|
content: msg.content
|
|
1505
1507
|
};
|
|
1506
1508
|
}
|
|
1507
|
-
const
|
|
1509
|
+
const content2 = msg.content.map((v) => {
|
|
1508
1510
|
switch (v.type) {
|
|
1509
1511
|
case "text":
|
|
1510
1512
|
return {
|
|
@@ -1528,16 +1530,16 @@ function createMessages(chatPrompt) {
|
|
|
1528
1530
|
});
|
|
1529
1531
|
return {
|
|
1530
1532
|
role: "user",
|
|
1531
|
-
content
|
|
1533
|
+
content: content2
|
|
1532
1534
|
};
|
|
1533
1535
|
}
|
|
1534
1536
|
case "assistant": {
|
|
1535
|
-
let
|
|
1537
|
+
let content2 = "";
|
|
1536
1538
|
if (typeof msg.content === "string") {
|
|
1537
|
-
|
|
1539
|
+
content2 = msg.content;
|
|
1538
1540
|
}
|
|
1539
1541
|
if (typeof msg.functionCalls !== "undefined") {
|
|
1540
|
-
|
|
1542
|
+
content2 = msg.functionCalls.map((v) => {
|
|
1541
1543
|
let input;
|
|
1542
1544
|
if (typeof v.function.params === "string") {
|
|
1543
1545
|
input = JSON.parse(v.function.params);
|
|
@@ -1555,7 +1557,7 @@ function createMessages(chatPrompt) {
|
|
|
1555
1557
|
}
|
|
1556
1558
|
return {
|
|
1557
1559
|
role: "assistant",
|
|
1558
|
-
content
|
|
1560
|
+
content: content2
|
|
1559
1561
|
};
|
|
1560
1562
|
}
|
|
1561
1563
|
default:
|
|
@@ -3722,7 +3724,6 @@ var AxAssertionError = class extends Error {
|
|
|
3722
3724
|
}) {
|
|
3723
3725
|
super(message);
|
|
3724
3726
|
this.name = this.constructor.name;
|
|
3725
|
-
this.stack = new Error().stack;
|
|
3726
3727
|
}
|
|
3727
3728
|
getFixingInstructions = () => {
|
|
3728
3729
|
const extraFields = [];
|
|
@@ -4638,9 +4639,9 @@ var functionCallInstructions = `
|
|
|
4638
4639
|
- Use the function results to generate the output fields.`;
|
|
4639
4640
|
var formattingRules = `
|
|
4640
4641
|
## Output Formatting Rules
|
|
4642
|
+
- Output must strictly follow the defined plaintext \`key: value\` field format.
|
|
4641
4643
|
- Each output key, value must strictly adhere to the specified output field formatting rules.
|
|
4642
4644
|
- No preamble, postscript, or supplementary information.
|
|
4643
|
-
- Output must be in plain text, with each \`key: value\` pair on a new line.
|
|
4644
4645
|
- Do not repeat output fields.`;
|
|
4645
4646
|
var AxPromptTemplate = class {
|
|
4646
4647
|
sig;
|
|
@@ -5042,7 +5043,7 @@ function handleValidationError(mem, errorFields, ai, promptTemplate, sessionId)
|
|
|
5042
5043
|
if (ai.getOptions().debug) {
|
|
5043
5044
|
const errors = errorFields.map((field) => `- ${field.title}: ${field.description}`).join("\n");
|
|
5044
5045
|
process.stdout.write(colorLog4.red(`
|
|
5045
|
-
Error Correction:
|
|
5046
|
+
\u274C Error Correction:
|
|
5046
5047
|
${errors}
|
|
5047
5048
|
`));
|
|
5048
5049
|
}
|
|
@@ -5383,6 +5384,7 @@ var validateJSONSchema = (schema) => {
|
|
|
5383
5384
|
};
|
|
5384
5385
|
|
|
5385
5386
|
// dsp/functions.ts
|
|
5387
|
+
var colorLog5 = new ColorLog();
|
|
5386
5388
|
var AxFunctionError = class extends Error {
|
|
5387
5389
|
constructor(fields) {
|
|
5388
5390
|
super();
|
|
@@ -5392,17 +5394,13 @@ var AxFunctionError = class extends Error {
|
|
|
5392
5394
|
getFields = () => this.fields;
|
|
5393
5395
|
};
|
|
5394
5396
|
var FunctionError = class extends Error {
|
|
5395
|
-
fields
|
|
5396
|
-
func;
|
|
5397
|
-
constructor({
|
|
5398
|
-
fields,
|
|
5399
|
-
func
|
|
5400
|
-
}) {
|
|
5397
|
+
constructor(fields, func, funcId) {
|
|
5401
5398
|
super();
|
|
5402
5399
|
this.fields = fields;
|
|
5403
5400
|
this.func = func;
|
|
5404
|
-
this.
|
|
5401
|
+
this.funcId = funcId;
|
|
5405
5402
|
}
|
|
5403
|
+
getFunctionId = () => this.funcId;
|
|
5406
5404
|
getFieldDescription(fieldName) {
|
|
5407
5405
|
if (!this.func.parameters?.properties?.[fieldName]) {
|
|
5408
5406
|
return "";
|
|
@@ -5415,15 +5413,12 @@ var FunctionError = class extends Error {
|
|
|
5415
5413
|
return description;
|
|
5416
5414
|
}
|
|
5417
5415
|
getFixingInstructions = () => {
|
|
5418
|
-
|
|
5419
|
-
const schemaDescription = this.getFieldDescription(fieldError.field);
|
|
5420
|
-
|
|
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
|
-
};
|
|
5416
|
+
const bulletPoints = this.fields.map((fieldError) => {
|
|
5417
|
+
const schemaDescription = this.getFieldDescription(fieldError.field) || "";
|
|
5418
|
+
return `- \`${fieldError.field}\` - ${fieldError.message} (${schemaDescription}).`;
|
|
5426
5419
|
});
|
|
5420
|
+
return `Errors In Function Arguments: Fix the following invalid arguments to '${this.func.name}'
|
|
5421
|
+
${bulletPoints.join("\n")}`;
|
|
5427
5422
|
};
|
|
5428
5423
|
};
|
|
5429
5424
|
var AxFunctionProcessor = class {
|
|
@@ -5445,16 +5440,10 @@ var AxFunctionProcessor = class {
|
|
|
5445
5440
|
} : void 0;
|
|
5446
5441
|
if (!fnSpec.parameters) {
|
|
5447
5442
|
const res2 = fnSpec.func.length === 1 ? await fnSpec.func(opt) : await fnSpec.func();
|
|
5448
|
-
return
|
|
5449
|
-
id: func.id,
|
|
5450
|
-
result: JSON.stringify(res2, null, 2)
|
|
5451
|
-
};
|
|
5443
|
+
return typeof res2 === "string" ? res2 : JSON.stringify(res2, null, 2);
|
|
5452
5444
|
}
|
|
5453
5445
|
const res = fnSpec.func.length === 2 ? await fnSpec.func(args, opt) : await fnSpec.func(args);
|
|
5454
|
-
return
|
|
5455
|
-
id: func.id,
|
|
5456
|
-
result: JSON.stringify(res, null, 2)
|
|
5457
|
-
};
|
|
5446
|
+
return typeof res === "string" ? res : JSON.stringify(res, null, 2);
|
|
5458
5447
|
};
|
|
5459
5448
|
execute = async (func, options) => {
|
|
5460
5449
|
const fnSpec = this.funcList.find(
|
|
@@ -5470,10 +5459,7 @@ var AxFunctionProcessor = class {
|
|
|
5470
5459
|
return await this.executeFunction(fnSpec, func, options);
|
|
5471
5460
|
} catch (e) {
|
|
5472
5461
|
if (e instanceof AxFunctionError) {
|
|
5473
|
-
throw new FunctionError(
|
|
5474
|
-
fields: e.getFields(),
|
|
5475
|
-
func: fnSpec
|
|
5476
|
-
});
|
|
5462
|
+
throw new FunctionError(e.getFields(), fnSpec, func.id);
|
|
5477
5463
|
}
|
|
5478
5464
|
throw e;
|
|
5479
5465
|
}
|
|
@@ -5497,19 +5483,44 @@ var parseFunctions = (newFuncs, existingFuncs) => {
|
|
|
5497
5483
|
var processFunctions = async (ai, functionList, functionCalls, mem, sessionId, traceId) => {
|
|
5498
5484
|
const funcProc = new AxFunctionProcessor(functionList);
|
|
5499
5485
|
const functionsExecuted = /* @__PURE__ */ new Set();
|
|
5500
|
-
const promises = functionCalls.map(
|
|
5501
|
-
|
|
5486
|
+
const promises = functionCalls.map((func) => {
|
|
5487
|
+
if (!func.id) {
|
|
5488
|
+
throw new Error(`Function ${func.name} did not return an ID`);
|
|
5489
|
+
}
|
|
5490
|
+
const promise = funcProc.execute(func, { sessionId, traceId, ai }).then((functionResult) => {
|
|
5502
5491
|
functionsExecuted.add(func.name.toLowerCase());
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5492
|
+
return {
|
|
5493
|
+
role: "function",
|
|
5494
|
+
result: functionResult ?? "",
|
|
5495
|
+
functionId: func.id
|
|
5496
|
+
};
|
|
5497
|
+
}).catch((e) => {
|
|
5498
|
+
if (e instanceof FunctionError) {
|
|
5499
|
+
const result = e.getFixingInstructions();
|
|
5500
|
+
mem.add(
|
|
5501
|
+
{
|
|
5502
|
+
role: "function",
|
|
5503
|
+
functionId: func.id,
|
|
5504
|
+
isError: true,
|
|
5505
|
+
result
|
|
5506
|
+
},
|
|
5507
|
+
sessionId
|
|
5508
|
+
);
|
|
5509
|
+
mem.addTag("error");
|
|
5510
|
+
if (ai.getOptions().debug) {
|
|
5511
|
+
process.stdout.write(
|
|
5512
|
+
colorLog5.red(`
|
|
5513
|
+
\u274C Function Error Correction:
|
|
5514
|
+
${result}
|
|
5515
|
+
`)
|
|
5516
|
+
);
|
|
5517
|
+
}
|
|
5518
|
+
} else {
|
|
5519
|
+
throw e;
|
|
5509
5520
|
}
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
);
|
|
5521
|
+
});
|
|
5522
|
+
return promise;
|
|
5523
|
+
});
|
|
5513
5524
|
const results = await Promise.all(promises);
|
|
5514
5525
|
results.forEach((result) => {
|
|
5515
5526
|
if (result) {
|
|
@@ -5809,9 +5820,6 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
5809
5820
|
const e1 = e;
|
|
5810
5821
|
errorFields = e1.getFixingInstructions();
|
|
5811
5822
|
err = e;
|
|
5812
|
-
} else if (e instanceof FunctionError) {
|
|
5813
|
-
errorFields = e.getFixingInstructions();
|
|
5814
|
-
err = e;
|
|
5815
5823
|
} else if (e instanceof AxAIServiceStreamTerminatedError) {
|
|
5816
5824
|
} else {
|
|
5817
5825
|
throw e;
|
|
@@ -7413,7 +7421,7 @@ var AxJSInterpreter = class {
|
|
|
7413
7421
|
};
|
|
7414
7422
|
|
|
7415
7423
|
// dsp/router.ts
|
|
7416
|
-
var
|
|
7424
|
+
var colorLog6 = new ColorLog();
|
|
7417
7425
|
var AxRoute = class {
|
|
7418
7426
|
name;
|
|
7419
7427
|
context;
|
|
@@ -7465,7 +7473,7 @@ var AxRouter = class {
|
|
|
7465
7473
|
}
|
|
7466
7474
|
if (this.debug) {
|
|
7467
7475
|
console.log(
|
|
7468
|
-
|
|
7476
|
+
colorLog6.whiteBright(`query: ${text}`) + "\n" + colorLog6.greenBright(
|
|
7469
7477
|
JSON.stringify(m.map((m2) => `${m2.id}, ${m2.score}`))
|
|
7470
7478
|
)
|
|
7471
7479
|
);
|