@ax-llm/ax 11.0.44 → 11.0.45
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 +138 -22
- package/index.cjs.map +1 -1
- package/index.d.cts +33 -9
- package/index.d.ts +33 -9
- package/index.js +126 -16
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -65,7 +65,6 @@ interface AxAIFeatures {
|
|
|
65
65
|
functions: boolean;
|
|
66
66
|
streaming: boolean;
|
|
67
67
|
functionCot?: boolean;
|
|
68
|
-
thinkingTokenBudget?: boolean;
|
|
69
68
|
}
|
|
70
69
|
interface AxBaseAIArgs<TModel, TEmbedModel> {
|
|
71
70
|
name: string;
|
|
@@ -329,7 +328,7 @@ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableSt
|
|
|
329
328
|
}>) => Promise<T | ReadableStream$1<T>>;
|
|
330
329
|
type AxAIPromptConfig = {
|
|
331
330
|
stream?: boolean;
|
|
332
|
-
thinkingTokenBudget?:
|
|
331
|
+
thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high';
|
|
333
332
|
};
|
|
334
333
|
type AxAIServiceOptions = {
|
|
335
334
|
debug?: boolean;
|
|
@@ -768,11 +767,12 @@ declare const axAIOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, A
|
|
|
768
767
|
declare const axAIOpenAIBestConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
769
768
|
declare const axAIOpenAICreativeConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
770
769
|
declare const axAIOpenAIFastConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
771
|
-
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel>, 'config' | 'modelInfo'> {
|
|
770
|
+
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'config' | 'modelInfo'> {
|
|
772
771
|
name: TName;
|
|
773
|
-
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel>['config']>;
|
|
772
|
+
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>['config']>;
|
|
774
773
|
}
|
|
775
|
-
|
|
774
|
+
type ChatReqUpdater<TModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> = (req: Readonly<TChatReq>) => TChatReq;
|
|
775
|
+
interface AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> {
|
|
776
776
|
apiKey: string;
|
|
777
777
|
apiURL?: string;
|
|
778
778
|
config: Readonly<AxAIOpenAIConfig<TModel, TEmbedModel>>;
|
|
@@ -781,9 +781,10 @@ interface AxAIOpenAIBaseArgs<TModel, TEmbedModel> {
|
|
|
781
781
|
}>;
|
|
782
782
|
modelInfo: Readonly<AxModelInfo[]>;
|
|
783
783
|
models?: AxAIInputModelList<TModel, TEmbedModel>;
|
|
784
|
+
chatReqUpdater?: ChatReqUpdater<TModel, TChatReq>;
|
|
784
785
|
}
|
|
785
|
-
declare class AxAIOpenAIBase<TModel, TEmbedModel> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
786
|
-
constructor({ apiKey, config, options, apiURL, modelInfo, models, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel>, 'name'>>);
|
|
786
|
+
declare class AxAIOpenAIBase<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
787
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'name'>>);
|
|
787
788
|
}
|
|
788
789
|
declare class AxAIOpenAI extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel> {
|
|
789
790
|
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIOpenAIArgs, 'name' | 'modelInfo'>>);
|
|
@@ -1398,6 +1399,27 @@ declare class AxAI implements AxAIService {
|
|
|
1398
1399
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
1399
1400
|
}
|
|
1400
1401
|
|
|
1402
|
+
declare enum AxAIGrokModel {
|
|
1403
|
+
Grok3 = "grok-3",
|
|
1404
|
+
Grok3Mini = "grok-3-mini",
|
|
1405
|
+
Grok3Fast = "grok-3-fast",
|
|
1406
|
+
Grok3MiniFast = "grok-3-mini-fast"
|
|
1407
|
+
}
|
|
1408
|
+
declare enum AxAIGrokEmbedModels {
|
|
1409
|
+
GrokEmbedSmall = "grok-embed-small"
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
declare const axAIGrokDefaultConfig: () => AxAIOpenAIConfig<AxAIGrokModel, AxAIGrokEmbedModels>;
|
|
1413
|
+
declare const axAIGrokBestConfig: () => AxAIOpenAIConfig<AxAIGrokModel, AxAIGrokEmbedModels>;
|
|
1414
|
+
type AxAIGrokArgs = AxAIOpenAIArgs<'grok', AxAIGrokModel, AxAIGrokEmbedModels> & {
|
|
1415
|
+
options?: Readonly<AxAIServiceOptions> & {
|
|
1416
|
+
tokensPerMinute?: number;
|
|
1417
|
+
};
|
|
1418
|
+
};
|
|
1419
|
+
declare class AxAIGrok extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels> {
|
|
1420
|
+
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIGrokArgs, 'name'>>);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1401
1423
|
interface AxAIMemory {
|
|
1402
1424
|
add(result: Readonly<AxChatRequest['chatPrompt']> | Readonly<AxChatRequest['chatPrompt'][number]>, sessionId?: string): void;
|
|
1403
1425
|
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
@@ -1637,7 +1659,7 @@ type AxProgramForwardOptions = {
|
|
|
1637
1659
|
fastFail?: boolean;
|
|
1638
1660
|
debug?: boolean;
|
|
1639
1661
|
debugHideSystemPrompt?: boolean;
|
|
1640
|
-
thinkingTokenBudget?:
|
|
1662
|
+
thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high';
|
|
1641
1663
|
traceLabel?: string;
|
|
1642
1664
|
};
|
|
1643
1665
|
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
@@ -2992,6 +3014,8 @@ declare const axModelInfoDeepSeek: AxModelInfo[];
|
|
|
2992
3014
|
*/
|
|
2993
3015
|
declare const axModelInfoGoogleGemini: AxModelInfo[];
|
|
2994
3016
|
|
|
3017
|
+
declare const axModelInfoGrok: AxModelInfo[];
|
|
3018
|
+
|
|
2995
3019
|
/**
|
|
2996
3020
|
* AxAIGroq: Model information
|
|
2997
3021
|
*/
|
|
@@ -3016,4 +3040,4 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
3016
3040
|
|
|
3017
3041
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
3018
3042
|
|
|
3019
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMCPClient, AxMCPHTTPTransport, AxMCPStdioTransport, type AxMCPTransport, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROOptions, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, AxMultiServiceRouter, type AxOptimizationStats, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents };
|
|
3043
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, AxAIGrokEmbedModels, AxAIGrokModel, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMCPClient, AxMCPHTTPTransport, AxMCPStdioTransport, type AxMCPTransport, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROOptions, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, AxMultiServiceRouter, type AxOptimizationStats, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents };
|
package/index.d.ts
CHANGED
|
@@ -65,7 +65,6 @@ interface AxAIFeatures {
|
|
|
65
65
|
functions: boolean;
|
|
66
66
|
streaming: boolean;
|
|
67
67
|
functionCot?: boolean;
|
|
68
|
-
thinkingTokenBudget?: boolean;
|
|
69
68
|
}
|
|
70
69
|
interface AxBaseAIArgs<TModel, TEmbedModel> {
|
|
71
70
|
name: string;
|
|
@@ -329,7 +328,7 @@ type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableSt
|
|
|
329
328
|
}>) => Promise<T | ReadableStream$1<T>>;
|
|
330
329
|
type AxAIPromptConfig = {
|
|
331
330
|
stream?: boolean;
|
|
332
|
-
thinkingTokenBudget?:
|
|
331
|
+
thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high';
|
|
333
332
|
};
|
|
334
333
|
type AxAIServiceOptions = {
|
|
335
334
|
debug?: boolean;
|
|
@@ -768,11 +767,12 @@ declare const axAIOpenAIDefaultConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, A
|
|
|
768
767
|
declare const axAIOpenAIBestConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
769
768
|
declare const axAIOpenAICreativeConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
770
769
|
declare const axAIOpenAIFastConfig: () => AxAIOpenAIConfig<AxAIOpenAIModel, AxAIOpenAIEmbedModel>;
|
|
771
|
-
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel>, 'config' | 'modelInfo'> {
|
|
770
|
+
interface AxAIOpenAIArgs<TName = 'openai', TModel = AxAIOpenAIModel, TEmbedModel = AxAIOpenAIEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'config' | 'modelInfo'> {
|
|
772
771
|
name: TName;
|
|
773
|
-
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel>['config']>;
|
|
772
|
+
config?: Partial<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>['config']>;
|
|
774
773
|
}
|
|
775
|
-
|
|
774
|
+
type ChatReqUpdater<TModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> = (req: Readonly<TChatReq>) => TChatReq;
|
|
775
|
+
interface AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel>> {
|
|
776
776
|
apiKey: string;
|
|
777
777
|
apiURL?: string;
|
|
778
778
|
config: Readonly<AxAIOpenAIConfig<TModel, TEmbedModel>>;
|
|
@@ -781,9 +781,10 @@ interface AxAIOpenAIBaseArgs<TModel, TEmbedModel> {
|
|
|
781
781
|
}>;
|
|
782
782
|
modelInfo: Readonly<AxModelInfo[]>;
|
|
783
783
|
models?: AxAIInputModelList<TModel, TEmbedModel>;
|
|
784
|
+
chatReqUpdater?: ChatReqUpdater<TModel, TChatReq>;
|
|
784
785
|
}
|
|
785
|
-
declare class AxAIOpenAIBase<TModel, TEmbedModel> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
786
|
-
constructor({ apiKey, config, options, apiURL, modelInfo, models, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel>, 'name'>>);
|
|
786
|
+
declare class AxAIOpenAIBase<TModel, TEmbedModel, TChatReq extends AxAIOpenAIChatRequest<TModel> = AxAIOpenAIChatRequest<TModel>> extends AxBaseAI<TModel, TEmbedModel, AxAIOpenAIChatRequest<TModel>, AxAIOpenAIEmbedRequest<TEmbedModel>, AxAIOpenAIChatResponse, AxAIOpenAIChatResponseDelta, AxAIOpenAIEmbedResponse> {
|
|
787
|
+
constructor({ apiKey, config, options, apiURL, modelInfo, models, chatReqUpdater, }: Readonly<Omit<AxAIOpenAIBaseArgs<TModel, TEmbedModel, TChatReq>, 'name'>>);
|
|
787
788
|
}
|
|
788
789
|
declare class AxAIOpenAI extends AxAIOpenAIBase<AxAIOpenAIModel, AxAIOpenAIEmbedModel> {
|
|
789
790
|
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIOpenAIArgs, 'name' | 'modelInfo'>>);
|
|
@@ -1398,6 +1399,27 @@ declare class AxAI implements AxAIService {
|
|
|
1398
1399
|
getOptions(): Readonly<AxAIServiceOptions>;
|
|
1399
1400
|
}
|
|
1400
1401
|
|
|
1402
|
+
declare enum AxAIGrokModel {
|
|
1403
|
+
Grok3 = "grok-3",
|
|
1404
|
+
Grok3Mini = "grok-3-mini",
|
|
1405
|
+
Grok3Fast = "grok-3-fast",
|
|
1406
|
+
Grok3MiniFast = "grok-3-mini-fast"
|
|
1407
|
+
}
|
|
1408
|
+
declare enum AxAIGrokEmbedModels {
|
|
1409
|
+
GrokEmbedSmall = "grok-embed-small"
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
declare const axAIGrokDefaultConfig: () => AxAIOpenAIConfig<AxAIGrokModel, AxAIGrokEmbedModels>;
|
|
1413
|
+
declare const axAIGrokBestConfig: () => AxAIOpenAIConfig<AxAIGrokModel, AxAIGrokEmbedModels>;
|
|
1414
|
+
type AxAIGrokArgs = AxAIOpenAIArgs<'grok', AxAIGrokModel, AxAIGrokEmbedModels> & {
|
|
1415
|
+
options?: Readonly<AxAIServiceOptions> & {
|
|
1416
|
+
tokensPerMinute?: number;
|
|
1417
|
+
};
|
|
1418
|
+
};
|
|
1419
|
+
declare class AxAIGrok extends AxAIOpenAIBase<AxAIGrokModel, AxAIGrokEmbedModels> {
|
|
1420
|
+
constructor({ apiKey, config, options, models, }: Readonly<Omit<AxAIGrokArgs, 'name'>>);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1401
1423
|
interface AxAIMemory {
|
|
1402
1424
|
add(result: Readonly<AxChatRequest['chatPrompt']> | Readonly<AxChatRequest['chatPrompt'][number]>, sessionId?: string): void;
|
|
1403
1425
|
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
@@ -1637,7 +1659,7 @@ type AxProgramForwardOptions = {
|
|
|
1637
1659
|
fastFail?: boolean;
|
|
1638
1660
|
debug?: boolean;
|
|
1639
1661
|
debugHideSystemPrompt?: boolean;
|
|
1640
|
-
thinkingTokenBudget?:
|
|
1662
|
+
thinkingTokenBudget?: 'minimal' | 'low' | 'medium' | 'high';
|
|
1641
1663
|
traceLabel?: string;
|
|
1642
1664
|
};
|
|
1643
1665
|
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
@@ -2992,6 +3014,8 @@ declare const axModelInfoDeepSeek: AxModelInfo[];
|
|
|
2992
3014
|
*/
|
|
2993
3015
|
declare const axModelInfoGoogleGemini: AxModelInfo[];
|
|
2994
3016
|
|
|
3017
|
+
declare const axModelInfoGrok: AxModelInfo[];
|
|
3018
|
+
|
|
2995
3019
|
/**
|
|
2996
3020
|
* AxAIGroq: Model information
|
|
2997
3021
|
*/
|
|
@@ -3016,4 +3040,4 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
3016
3040
|
|
|
3017
3041
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
3018
3042
|
|
|
3019
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMCPClient, AxMCPHTTPTransport, AxMCPStdioTransport, type AxMCPTransport, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROOptions, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, AxMultiServiceRouter, type AxOptimizationStats, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents };
|
|
3043
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, AxAIGrokEmbedModels, AxAIGrokModel, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModelListBase, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOptions, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, AxMCPClient, AxMCPHTTPTransport, AxMCPStdioTransport, type AxMCPTransport, AxMemory, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROOptions, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, AxMultiServiceRouter, type AxOptimizationStats, type AxOptimizerArgs, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, AxSignature, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents };
|
package/index.js
CHANGED
|
@@ -921,10 +921,6 @@ var AxBaseAI = class {
|
|
|
921
921
|
if (!canStream) {
|
|
922
922
|
modelConfig.stream = false;
|
|
923
923
|
}
|
|
924
|
-
const canSetThinkingTokenBudget = this.getFeatures(model).thinkingTokenBudget;
|
|
925
|
-
if (!canSetThinkingTokenBudget && options?.thinkingTokenBudget) {
|
|
926
|
-
throw new Error("Thinking token budget is not supported for this model");
|
|
927
|
-
}
|
|
928
924
|
if (this.tracer) {
|
|
929
925
|
return await this.tracer?.startActiveSpan(
|
|
930
926
|
"AI Chat Request",
|
|
@@ -1954,9 +1950,10 @@ var axAIOpenAIFastConfig = () => ({
|
|
|
1954
1950
|
model: "gpt-4.1-mini" /* GPT41Mini */
|
|
1955
1951
|
});
|
|
1956
1952
|
var AxAIOpenAIImpl = class {
|
|
1957
|
-
constructor(config, streamingUsage) {
|
|
1953
|
+
constructor(config, streamingUsage, chatReqUpdater) {
|
|
1958
1954
|
this.config = config;
|
|
1959
1955
|
this.streamingUsage = streamingUsage;
|
|
1956
|
+
this.chatReqUpdater = chatReqUpdater;
|
|
1960
1957
|
}
|
|
1961
1958
|
tokensUsed;
|
|
1962
1959
|
getTokenUsage() {
|
|
@@ -1976,7 +1973,7 @@ var AxAIOpenAIImpl = class {
|
|
|
1976
1973
|
stream: config.stream
|
|
1977
1974
|
};
|
|
1978
1975
|
}
|
|
1979
|
-
createChatReq(req,
|
|
1976
|
+
createChatReq(req, config) {
|
|
1980
1977
|
const model = req.model;
|
|
1981
1978
|
if (!req.chatPrompt || req.chatPrompt.length === 0) {
|
|
1982
1979
|
throw new Error("Chat prompt is empty");
|
|
@@ -1996,12 +1993,11 @@ var AxAIOpenAIImpl = class {
|
|
|
1996
1993
|
const messages = createMessages2(req);
|
|
1997
1994
|
const frequencyPenalty = req.modelConfig?.frequencyPenalty ?? this.config.frequencyPenalty;
|
|
1998
1995
|
const stream = req.modelConfig?.stream ?? this.config.stream;
|
|
1999
|
-
const reasoningEffort = isReasoningModel(model) ? this.config.reasoningEffort : void 0;
|
|
2000
1996
|
const store = this.config.store;
|
|
2001
|
-
|
|
1997
|
+
let reqValue = {
|
|
2002
1998
|
model,
|
|
2003
1999
|
messages,
|
|
2004
|
-
response_format: this.config?.responseFormat ? { type: this.config
|
|
2000
|
+
response_format: this.config?.responseFormat ? { type: this.config.responseFormat } : void 0,
|
|
2005
2001
|
tools,
|
|
2006
2002
|
tool_choice: toolsChoice,
|
|
2007
2003
|
max_completion_tokens: req.modelConfig?.maxTokens ?? this.config.maxTokens ?? 500,
|
|
@@ -2013,9 +2009,29 @@ var AxAIOpenAIImpl = class {
|
|
|
2013
2009
|
logit_bias: this.config.logitBias,
|
|
2014
2010
|
...frequencyPenalty ? { frequency_penalty: frequencyPenalty } : {},
|
|
2015
2011
|
...stream && this.streamingUsage ? { stream: true, stream_options: { include_usage: true } } : {},
|
|
2016
|
-
...reasoningEffort ? { reasoning_effort: reasoningEffort } : {},
|
|
2017
2012
|
...store ? { store } : {}
|
|
2018
2013
|
};
|
|
2014
|
+
if (this.config.reasoningEffort) {
|
|
2015
|
+
reqValue.reasoning_effort = this.config.reasoningEffort;
|
|
2016
|
+
}
|
|
2017
|
+
if (config.thinkingTokenBudget) {
|
|
2018
|
+
switch (config.thinkingTokenBudget) {
|
|
2019
|
+
case "minimal":
|
|
2020
|
+
reqValue.reasoning_effort = "low";
|
|
2021
|
+
break;
|
|
2022
|
+
case "low":
|
|
2023
|
+
reqValue.reasoning_effort = "medium";
|
|
2024
|
+
break;
|
|
2025
|
+
case "medium":
|
|
2026
|
+
reqValue.reasoning_effort = "high";
|
|
2027
|
+
break;
|
|
2028
|
+
case "high":
|
|
2029
|
+
reqValue.reasoning_effort = "high";
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
if (this.chatReqUpdater) {
|
|
2033
|
+
reqValue = this.chatReqUpdater(reqValue);
|
|
2034
|
+
}
|
|
2019
2035
|
return [apiConfig, reqValue];
|
|
2020
2036
|
}
|
|
2021
2037
|
createEmbedReq(req) {
|
|
@@ -2198,14 +2214,16 @@ var AxAIOpenAIBase = class extends AxBaseAI {
|
|
|
2198
2214
|
options,
|
|
2199
2215
|
apiURL,
|
|
2200
2216
|
modelInfo,
|
|
2201
|
-
models
|
|
2217
|
+
models,
|
|
2218
|
+
chatReqUpdater
|
|
2202
2219
|
}) {
|
|
2203
2220
|
if (!apiKey || apiKey === "") {
|
|
2204
2221
|
throw new Error("OpenAI API key not set");
|
|
2205
2222
|
}
|
|
2206
2223
|
const aiImpl = new AxAIOpenAIImpl(
|
|
2207
2224
|
config,
|
|
2208
|
-
options?.streamingUsage ?? true
|
|
2225
|
+
options?.streamingUsage ?? true,
|
|
2226
|
+
chatReqUpdater
|
|
2209
2227
|
);
|
|
2210
2228
|
super(aiImpl, {
|
|
2211
2229
|
name: "OpenAI",
|
|
@@ -2224,9 +2242,6 @@ var AxAIOpenAIBase = class extends AxBaseAI {
|
|
|
2224
2242
|
});
|
|
2225
2243
|
}
|
|
2226
2244
|
};
|
|
2227
|
-
var isReasoningModel = (model) => ["o1-mini" /* O1Mini */, "o1" /* O1 */, "o3-mini" /* O3Mini */].includes(
|
|
2228
|
-
model
|
|
2229
|
-
);
|
|
2230
2245
|
var AxAIOpenAI = class extends AxAIOpenAIBase {
|
|
2231
2246
|
constructor({
|
|
2232
2247
|
apiKey,
|
|
@@ -3011,7 +3026,20 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3011
3026
|
thinkingConfig.thinkingBudget = this.config.thinking.thinkingTokenBudget;
|
|
3012
3027
|
}
|
|
3013
3028
|
if (config.thinkingTokenBudget) {
|
|
3014
|
-
|
|
3029
|
+
switch (config.thinkingTokenBudget) {
|
|
3030
|
+
case "minimal":
|
|
3031
|
+
thinkingConfig.thinkingBudget = 0;
|
|
3032
|
+
break;
|
|
3033
|
+
case "low":
|
|
3034
|
+
thinkingConfig.thinkingBudget = 1024;
|
|
3035
|
+
break;
|
|
3036
|
+
case "medium":
|
|
3037
|
+
thinkingConfig.thinkingBudget = 4096;
|
|
3038
|
+
break;
|
|
3039
|
+
case "high":
|
|
3040
|
+
thinkingConfig.thinkingBudget = 8192;
|
|
3041
|
+
break;
|
|
3042
|
+
}
|
|
3015
3043
|
}
|
|
3016
3044
|
const generationConfig = {
|
|
3017
3045
|
maxOutputTokens: req.modelConfig?.maxTokens ?? this.config.maxTokens,
|
|
@@ -3977,6 +4005,82 @@ var AxAI = class {
|
|
|
3977
4005
|
}
|
|
3978
4006
|
};
|
|
3979
4007
|
|
|
4008
|
+
// ai/x-grok/types.ts
|
|
4009
|
+
var AxAIGrokModel = /* @__PURE__ */ ((AxAIGrokModel2) => {
|
|
4010
|
+
AxAIGrokModel2["Grok3"] = "grok-3";
|
|
4011
|
+
AxAIGrokModel2["Grok3Mini"] = "grok-3-mini";
|
|
4012
|
+
AxAIGrokModel2["Grok3Fast"] = "grok-3-fast";
|
|
4013
|
+
AxAIGrokModel2["Grok3MiniFast"] = "grok-3-mini-fast";
|
|
4014
|
+
return AxAIGrokModel2;
|
|
4015
|
+
})(AxAIGrokModel || {});
|
|
4016
|
+
var AxAIGrokEmbedModels = /* @__PURE__ */ ((AxAIGrokEmbedModels3) => {
|
|
4017
|
+
AxAIGrokEmbedModels3["GrokEmbedSmall"] = "grok-embed-small";
|
|
4018
|
+
return AxAIGrokEmbedModels3;
|
|
4019
|
+
})(AxAIGrokEmbedModels || {});
|
|
4020
|
+
|
|
4021
|
+
// ai/x-grok/info.ts
|
|
4022
|
+
var axModelInfoGrok = [
|
|
4023
|
+
{
|
|
4024
|
+
name: "grok-3" /* Grok3 */,
|
|
4025
|
+
currency: "USD",
|
|
4026
|
+
promptTokenCostPer1M: 3,
|
|
4027
|
+
completionTokenCostPer1M: 15
|
|
4028
|
+
},
|
|
4029
|
+
{
|
|
4030
|
+
name: "grok-3-mini" /* Grok3Mini */,
|
|
4031
|
+
currency: "USD",
|
|
4032
|
+
promptTokenCostPer1M: 0.3,
|
|
4033
|
+
completionTokenCostPer1M: 0.5
|
|
4034
|
+
},
|
|
4035
|
+
{
|
|
4036
|
+
name: "grok-3-fast" /* Grok3Fast */,
|
|
4037
|
+
currency: "USD",
|
|
4038
|
+
promptTokenCostPer1M: 5,
|
|
4039
|
+
completionTokenCostPer1M: 25
|
|
4040
|
+
},
|
|
4041
|
+
{
|
|
4042
|
+
name: "grok-3-mini-fast" /* Grok3MiniFast */,
|
|
4043
|
+
currency: "USD",
|
|
4044
|
+
promptTokenCostPer1M: 0.6,
|
|
4045
|
+
completionTokenCostPer1M: 4
|
|
4046
|
+
}
|
|
4047
|
+
];
|
|
4048
|
+
|
|
4049
|
+
// ai/x-grok/api.ts
|
|
4050
|
+
var axAIGrokDefaultConfig = () => structuredClone({
|
|
4051
|
+
model: "grok-3-mini" /* Grok3Mini */,
|
|
4052
|
+
...axBaseAIDefaultConfig()
|
|
4053
|
+
});
|
|
4054
|
+
var axAIGrokBestConfig = () => structuredClone({
|
|
4055
|
+
...axAIGrokDefaultConfig(),
|
|
4056
|
+
model: "grok-3" /* Grok3 */
|
|
4057
|
+
});
|
|
4058
|
+
var AxAIGrok = class extends AxAIOpenAIBase {
|
|
4059
|
+
constructor({
|
|
4060
|
+
apiKey,
|
|
4061
|
+
config,
|
|
4062
|
+
options,
|
|
4063
|
+
models
|
|
4064
|
+
}) {
|
|
4065
|
+
if (!apiKey || apiKey === "") {
|
|
4066
|
+
throw new Error("Grok API key not set");
|
|
4067
|
+
}
|
|
4068
|
+
const _config = {
|
|
4069
|
+
...axAIGrokDefaultConfig(),
|
|
4070
|
+
...config
|
|
4071
|
+
};
|
|
4072
|
+
super({
|
|
4073
|
+
apiKey,
|
|
4074
|
+
config: _config,
|
|
4075
|
+
options,
|
|
4076
|
+
apiURL: "https://api.x.ai/v1",
|
|
4077
|
+
modelInfo: axModelInfoGrok,
|
|
4078
|
+
models
|
|
4079
|
+
});
|
|
4080
|
+
super.setName("Grok");
|
|
4081
|
+
}
|
|
4082
|
+
};
|
|
4083
|
+
|
|
3980
4084
|
// dsp/generate.ts
|
|
3981
4085
|
import { ReadableStream as ReadableStream3 } from "node:stream/web";
|
|
3982
4086
|
import { SpanKind as SpanKind2 } from "@opentelemetry/api";
|
|
@@ -11611,6 +11715,9 @@ export {
|
|
|
11611
11715
|
AxAIGoogleGeminiModel,
|
|
11612
11716
|
AxAIGoogleGeminiSafetyCategory,
|
|
11613
11717
|
AxAIGoogleGeminiSafetyThreshold,
|
|
11718
|
+
AxAIGrok,
|
|
11719
|
+
AxAIGrokEmbedModels,
|
|
11720
|
+
AxAIGrokModel,
|
|
11614
11721
|
AxAIGroq,
|
|
11615
11722
|
AxAIGroqModel,
|
|
11616
11723
|
AxAIHuggingFace,
|
|
@@ -11691,6 +11798,8 @@ export {
|
|
|
11691
11798
|
axAIDeepSeekDefaultConfig,
|
|
11692
11799
|
axAIGoogleGeminiDefaultConfig,
|
|
11693
11800
|
axAIGoogleGeminiDefaultCreativeConfig,
|
|
11801
|
+
axAIGrokBestConfig,
|
|
11802
|
+
axAIGrokDefaultConfig,
|
|
11694
11803
|
axAIHuggingFaceCreativeConfig,
|
|
11695
11804
|
axAIHuggingFaceDefaultConfig,
|
|
11696
11805
|
axAIMistralBestConfig,
|
|
@@ -11712,6 +11821,7 @@ export {
|
|
|
11712
11821
|
axModelInfoCohere,
|
|
11713
11822
|
axModelInfoDeepSeek,
|
|
11714
11823
|
axModelInfoGoogleGemini,
|
|
11824
|
+
axModelInfoGrok,
|
|
11715
11825
|
axModelInfoGroq,
|
|
11716
11826
|
axModelInfoHuggingFace,
|
|
11717
11827
|
axModelInfoMistral,
|