@ax-llm/ax 11.0.29 → 11.0.31
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 +82 -39
- package/index.cjs.map +1 -1
- package/index.d.cts +21 -3
- package/index.d.ts +21 -3
- package/index.js +81 -39
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -257,6 +257,7 @@ type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
|
|
|
257
257
|
traceId?: string;
|
|
258
258
|
rateLimiter?: AxRateLimiterFunction;
|
|
259
259
|
debug?: boolean;
|
|
260
|
+
debugHideSystemPrompt?: boolean;
|
|
260
261
|
};
|
|
261
262
|
interface AxAIService<TModel = unknown, TEmbedModel = unknown> {
|
|
262
263
|
getId(): string;
|
|
@@ -916,6 +917,7 @@ declare enum AxAIGoogleGeminiModel {
|
|
|
916
917
|
AQA = "aqa"
|
|
917
918
|
}
|
|
918
919
|
declare enum AxAIGoogleGeminiEmbedModel {
|
|
920
|
+
GeminiEmbedding = "gemini-embedding-exp-03-07",
|
|
919
921
|
TextEmbedding004 = "text-embedding-004",
|
|
920
922
|
TextEmbedding005 = "text-embedding-005"
|
|
921
923
|
}
|
|
@@ -932,6 +934,16 @@ declare enum AxAIGoogleGeminiSafetyThreshold {
|
|
|
932
934
|
BlockLowAndAbove = "BLOCK_LOW_AND_ABOVE",
|
|
933
935
|
BlockDefault = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
|
|
934
936
|
}
|
|
937
|
+
declare enum AxAIGoogleGeminiEmbedTypes {
|
|
938
|
+
SemanticSimilarity = "SEMANTIC_SIMILARITY",
|
|
939
|
+
Classification = "CLASSIFICATION",
|
|
940
|
+
Clustering = "CLUSTERING",
|
|
941
|
+
RetrievalDocument = "RETRIEVAL_DOCUMENT",
|
|
942
|
+
RetrievalQuery = "RETRIEVAL_QUERY",
|
|
943
|
+
QuestionAnswering = "QUESTION_ANSWERING",
|
|
944
|
+
FactVerification = "FACT_VERIFICATION",
|
|
945
|
+
CodeRetrievalQuery = "CODE_RETRIEVAL_QUERY"
|
|
946
|
+
}
|
|
935
947
|
type AxAIGoogleGeminiContent = {
|
|
936
948
|
role: 'user';
|
|
937
949
|
parts: ({
|
|
@@ -1041,6 +1053,8 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
|
|
|
1041
1053
|
model: AxAIGoogleGeminiModel;
|
|
1042
1054
|
embedModel?: AxAIGoogleGeminiEmbedModel;
|
|
1043
1055
|
safetySettings?: AxAIGoogleGeminiSafetySettings;
|
|
1056
|
+
embedType?: AxAIGoogleGeminiEmbedTypes;
|
|
1057
|
+
dimensions?: number;
|
|
1044
1058
|
};
|
|
1045
1059
|
/**
|
|
1046
1060
|
* AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
|
|
@@ -1353,10 +1367,13 @@ interface AxAIMemory {
|
|
|
1353
1367
|
|
|
1354
1368
|
declare class AxMemory implements AxAIMemory {
|
|
1355
1369
|
private limit;
|
|
1356
|
-
private
|
|
1370
|
+
private options?;
|
|
1357
1371
|
private memories;
|
|
1358
1372
|
private defaultMemory;
|
|
1359
|
-
constructor(limit?: number,
|
|
1373
|
+
constructor(limit?: number, options?: {
|
|
1374
|
+
debug?: boolean;
|
|
1375
|
+
debugHideSystemPrompt?: boolean;
|
|
1376
|
+
} | undefined);
|
|
1360
1377
|
private getMemory;
|
|
1361
1378
|
add(value: AxChatRequest['chatPrompt'][number] | AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
1362
1379
|
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
@@ -1563,6 +1580,7 @@ type AxProgramForwardOptions = {
|
|
|
1563
1580
|
stopFunction?: string;
|
|
1564
1581
|
fastFail?: boolean;
|
|
1565
1582
|
debug?: boolean;
|
|
1583
|
+
debugHideSystemPrompt?: boolean;
|
|
1566
1584
|
};
|
|
1567
1585
|
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
1568
1586
|
type AxGenDeltaOut<OUT> = {
|
|
@@ -2917,4 +2935,4 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
2917
2935
|
|
|
2918
2936
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
2919
2937
|
|
|
2920
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, 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, 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, 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, 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 };
|
|
2938
|
+
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 AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, 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, 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, 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, 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 };
|
package/index.d.ts
CHANGED
|
@@ -257,6 +257,7 @@ type AxAIServiceActionOptions<TModel = unknown, TEmbedModel = unknown> = {
|
|
|
257
257
|
traceId?: string;
|
|
258
258
|
rateLimiter?: AxRateLimiterFunction;
|
|
259
259
|
debug?: boolean;
|
|
260
|
+
debugHideSystemPrompt?: boolean;
|
|
260
261
|
};
|
|
261
262
|
interface AxAIService<TModel = unknown, TEmbedModel = unknown> {
|
|
262
263
|
getId(): string;
|
|
@@ -916,6 +917,7 @@ declare enum AxAIGoogleGeminiModel {
|
|
|
916
917
|
AQA = "aqa"
|
|
917
918
|
}
|
|
918
919
|
declare enum AxAIGoogleGeminiEmbedModel {
|
|
920
|
+
GeminiEmbedding = "gemini-embedding-exp-03-07",
|
|
919
921
|
TextEmbedding004 = "text-embedding-004",
|
|
920
922
|
TextEmbedding005 = "text-embedding-005"
|
|
921
923
|
}
|
|
@@ -932,6 +934,16 @@ declare enum AxAIGoogleGeminiSafetyThreshold {
|
|
|
932
934
|
BlockLowAndAbove = "BLOCK_LOW_AND_ABOVE",
|
|
933
935
|
BlockDefault = "HARM_BLOCK_THRESHOLD_UNSPECIFIED"
|
|
934
936
|
}
|
|
937
|
+
declare enum AxAIGoogleGeminiEmbedTypes {
|
|
938
|
+
SemanticSimilarity = "SEMANTIC_SIMILARITY",
|
|
939
|
+
Classification = "CLASSIFICATION",
|
|
940
|
+
Clustering = "CLUSTERING",
|
|
941
|
+
RetrievalDocument = "RETRIEVAL_DOCUMENT",
|
|
942
|
+
RetrievalQuery = "RETRIEVAL_QUERY",
|
|
943
|
+
QuestionAnswering = "QUESTION_ANSWERING",
|
|
944
|
+
FactVerification = "FACT_VERIFICATION",
|
|
945
|
+
CodeRetrievalQuery = "CODE_RETRIEVAL_QUERY"
|
|
946
|
+
}
|
|
935
947
|
type AxAIGoogleGeminiContent = {
|
|
936
948
|
role: 'user';
|
|
937
949
|
parts: ({
|
|
@@ -1041,6 +1053,8 @@ type AxAIGoogleGeminiConfig = AxModelConfig & {
|
|
|
1041
1053
|
model: AxAIGoogleGeminiModel;
|
|
1042
1054
|
embedModel?: AxAIGoogleGeminiEmbedModel;
|
|
1043
1055
|
safetySettings?: AxAIGoogleGeminiSafetySettings;
|
|
1056
|
+
embedType?: AxAIGoogleGeminiEmbedTypes;
|
|
1057
|
+
dimensions?: number;
|
|
1044
1058
|
};
|
|
1045
1059
|
/**
|
|
1046
1060
|
* AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.
|
|
@@ -1353,10 +1367,13 @@ interface AxAIMemory {
|
|
|
1353
1367
|
|
|
1354
1368
|
declare class AxMemory implements AxAIMemory {
|
|
1355
1369
|
private limit;
|
|
1356
|
-
private
|
|
1370
|
+
private options?;
|
|
1357
1371
|
private memories;
|
|
1358
1372
|
private defaultMemory;
|
|
1359
|
-
constructor(limit?: number,
|
|
1373
|
+
constructor(limit?: number, options?: {
|
|
1374
|
+
debug?: boolean;
|
|
1375
|
+
debugHideSystemPrompt?: boolean;
|
|
1376
|
+
} | undefined);
|
|
1360
1377
|
private getMemory;
|
|
1361
1378
|
add(value: AxChatRequest['chatPrompt'][number] | AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
1362
1379
|
addResult(result: Readonly<AxChatResponseResult>, sessionId?: string): void;
|
|
@@ -1563,6 +1580,7 @@ type AxProgramForwardOptions = {
|
|
|
1563
1580
|
stopFunction?: string;
|
|
1564
1581
|
fastFail?: boolean;
|
|
1565
1582
|
debug?: boolean;
|
|
1583
|
+
debugHideSystemPrompt?: boolean;
|
|
1566
1584
|
};
|
|
1567
1585
|
type AxProgramStreamingForwardOptions = Omit<AxProgramForwardOptions, 'stream'>;
|
|
1568
1586
|
type AxGenDeltaOut<OUT> = {
|
|
@@ -2917,4 +2935,4 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
2917
2935
|
|
|
2918
2936
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
2919
2937
|
|
|
2920
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, AxAIAnthropicVertexModel, type AxAIArgs, AxAIAzureOpenAI, type AxAIAzureOpenAIArgs, type AxAIAzureOpenAIConfig, AxAICohere, type AxAICohereArgs, type AxAICohereChatRequest, type AxAICohereChatRequestToolResults, type AxAICohereChatResponse, type AxAICohereChatResponseDelta, type AxAICohereChatResponseToolCalls, type AxAICohereConfig, AxAICohereEmbedModel, type AxAICohereEmbedRequest, type AxAICohereEmbedResponse, AxAICohereModel, AxAIDeepSeek, type AxAIDeepSeekArgs, AxAIDeepSeekModel, type AxAIEmbedModels, type AxAIFeatures, AxAIGoogleGemini, type AxAIGoogleGeminiArgs, type AxAIGoogleGeminiBatchEmbedRequest, type AxAIGoogleGeminiBatchEmbedResponse, type AxAIGoogleGeminiChatRequest, type AxAIGoogleGeminiChatResponse, type AxAIGoogleGeminiChatResponseDelta, type AxAIGoogleGeminiConfig, type AxAIGoogleGeminiContent, AxAIGoogleGeminiEmbedModel, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, 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, 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, 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, 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 };
|
|
2938
|
+
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 AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, AxAIMistralEmbedModels, AxAIMistralModel, type AxAIModelList, type AxAIModels, AxAIOllama, type AxAIOllamaAIConfig, type AxAIOllamaArgs, AxAIOpenAI, type AxAIOpenAIArgs, AxAIOpenAIBase, type AxAIOpenAIBaseArgs, type AxAIOpenAIChatRequest, type AxAIOpenAIChatResponse, type AxAIOpenAIChatResponseDelta, type AxAIOpenAIConfig, AxAIOpenAIEmbedModel, type AxAIOpenAIEmbedRequest, type AxAIOpenAIEmbedResponse, type AxAIOpenAILogprob, AxAIOpenAIModel, type AxAIOpenAIResponseDelta, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, type AxAIServiceActionOptions, AxAIServiceAuthenticationError, AxAIServiceError, type AxAIServiceImpl, type AxAIServiceMetrics, AxAIServiceNetworkError, type AxAIServiceOptions, AxAIServiceResponseError, AxAIServiceStatusError, AxAIServiceStreamTerminatedError, AxAIServiceTimeoutError, AxAITogether, type AxAITogetherArgs, type AxAPI, type AxAPIConfig, AxAgent, type AxAgentFeatures, type AxAgentOptions, type AxAgentic, AxApacheTika, type AxApacheTikaArgs, type AxApacheTikaConvertOptions, type AxAssertion, AxAssertionError, AxBalancer, type AxBalancerOptions, AxBaseAI, type AxBaseAIArgs, AxBootstrapFewShot, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, AxDB, type AxDBArgs, AxDBBase, type AxDBBaseArgs, type AxDBBaseOpOptions, AxDBCloudflare, type AxDBCloudflareArgs, type AxDBCloudflareOpOptions, type AxDBLoaderOptions, AxDBManager, type AxDBManagerArgs, type AxDBMatch, AxDBMemory, type AxDBMemoryArgs, type AxDBMemoryOpOptions, AxDBPinecone, type AxDBPineconeArgs, type AxDBPineconeOpOptions, type AxDBQueryRequest, type AxDBQueryResponse, type AxDBQueryService, type AxDBService, type AxDBState, type AxDBUpsertRequest, type AxDBUpsertResponse, AxDBWeaviate, type AxDBWeaviateArgs, type AxDBWeaviateOpOptions, type AxDataRow, AxDefaultQueryRewriter, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, 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, 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, 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, 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 };
|
package/index.js
CHANGED
|
@@ -603,9 +603,12 @@ var ColorLog = class {
|
|
|
603
603
|
|
|
604
604
|
// ai/debug.ts
|
|
605
605
|
var colorLog = new ColorLog();
|
|
606
|
-
var formatChatMessage = (msg, hideContent) => {
|
|
606
|
+
var formatChatMessage = (msg, hideContent, hideSystemPrompt) => {
|
|
607
607
|
switch (msg.role) {
|
|
608
608
|
case "system":
|
|
609
|
+
if (hideSystemPrompt) {
|
|
610
|
+
return "";
|
|
611
|
+
}
|
|
609
612
|
return `
|
|
610
613
|
${colorLog.blueBright("System:")}
|
|
611
614
|
${colorLog.whiteBright(msg.content)}`;
|
|
@@ -651,13 +654,15 @@ ${hideContent ? "" : colorLog.whiteBright(msg.content ?? "<empty>")}`;
|
|
|
651
654
|
throw new Error("Invalid role");
|
|
652
655
|
}
|
|
653
656
|
};
|
|
654
|
-
var logChatRequestMessage = (msg) => {
|
|
655
|
-
process.stdout.write(`${formatChatMessage(msg)}
|
|
657
|
+
var logChatRequestMessage = (msg, hideSystemPrompt) => {
|
|
658
|
+
process.stdout.write(`${formatChatMessage(msg, hideSystemPrompt)}
|
|
656
659
|
`);
|
|
657
660
|
process.stdout.write(colorLog.blueBright("\nAssistant:\n"));
|
|
658
661
|
};
|
|
659
|
-
var logChatRequest = (chatPrompt) => {
|
|
660
|
-
const items = chatPrompt?.map(
|
|
662
|
+
var logChatRequest = (chatPrompt, hideSystemPrompt) => {
|
|
663
|
+
const items = chatPrompt?.map(
|
|
664
|
+
(msg) => formatChatMessage(msg, hideSystemPrompt)
|
|
665
|
+
);
|
|
661
666
|
if (items) {
|
|
662
667
|
process.stdout.write(items.join("\n"));
|
|
663
668
|
process.stdout.write(colorLog.blueBright("\nAssistant:\n"));
|
|
@@ -977,7 +982,7 @@ var AxBaseAI = class {
|
|
|
977
982
|
return res2;
|
|
978
983
|
};
|
|
979
984
|
if (options?.debug ?? this.debug) {
|
|
980
|
-
logChatRequest(req.chatPrompt);
|
|
985
|
+
logChatRequest(req.chatPrompt, options?.debugHideSystemPrompt);
|
|
981
986
|
}
|
|
982
987
|
const rt = options?.rateLimiter ?? this.rt;
|
|
983
988
|
const rv = rt ? await rt(fn, { modelUsage: this.modelUsage }) : await fn();
|
|
@@ -1764,10 +1769,9 @@ var axAIOpenAIFastConfig = () => ({
|
|
|
1764
1769
|
model: "gpt-4o-mini" /* GPT4OMini */
|
|
1765
1770
|
});
|
|
1766
1771
|
var AxAIOpenAIImpl = class {
|
|
1767
|
-
constructor(config, streamingUsage
|
|
1772
|
+
constructor(config, streamingUsage) {
|
|
1768
1773
|
this.config = config;
|
|
1769
1774
|
this.streamingUsage = streamingUsage;
|
|
1770
|
-
this.dimensions = dimensions;
|
|
1771
1775
|
}
|
|
1772
1776
|
getModelConfig() {
|
|
1773
1777
|
const { config } = this;
|
|
@@ -1839,7 +1843,7 @@ var AxAIOpenAIImpl = class {
|
|
|
1839
1843
|
const reqValue = {
|
|
1840
1844
|
model,
|
|
1841
1845
|
input: req.texts,
|
|
1842
|
-
dimensions: this.dimensions
|
|
1846
|
+
dimensions: this.config.dimensions
|
|
1843
1847
|
};
|
|
1844
1848
|
return [apiConfig, reqValue];
|
|
1845
1849
|
}
|
|
@@ -2019,8 +2023,7 @@ var AxAIOpenAIBase = class extends AxBaseAI {
|
|
|
2019
2023
|
}
|
|
2020
2024
|
const aiImpl = new AxAIOpenAIImpl(
|
|
2021
2025
|
config,
|
|
2022
|
-
options?.streamingUsage ?? true
|
|
2023
|
-
config.dimensions
|
|
2026
|
+
options?.streamingUsage ?? true
|
|
2024
2027
|
);
|
|
2025
2028
|
super(aiImpl, {
|
|
2026
2029
|
name: "OpenAI",
|
|
@@ -2514,6 +2517,7 @@ var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
|
|
|
2514
2517
|
return AxAIGoogleGeminiModel2;
|
|
2515
2518
|
})(AxAIGoogleGeminiModel || {});
|
|
2516
2519
|
var AxAIGoogleGeminiEmbedModel = /* @__PURE__ */ ((AxAIGoogleGeminiEmbedModel2) => {
|
|
2520
|
+
AxAIGoogleGeminiEmbedModel2["GeminiEmbedding"] = "gemini-embedding-exp-03-07";
|
|
2517
2521
|
AxAIGoogleGeminiEmbedModel2["TextEmbedding004"] = "text-embedding-004";
|
|
2518
2522
|
AxAIGoogleGeminiEmbedModel2["TextEmbedding005"] = "text-embedding-005";
|
|
2519
2523
|
return AxAIGoogleGeminiEmbedModel2;
|
|
@@ -2533,6 +2537,17 @@ var AxAIGoogleGeminiSafetyThreshold = /* @__PURE__ */ ((AxAIGoogleGeminiSafetyTh
|
|
|
2533
2537
|
AxAIGoogleGeminiSafetyThreshold2["BlockDefault"] = "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
|
|
2534
2538
|
return AxAIGoogleGeminiSafetyThreshold2;
|
|
2535
2539
|
})(AxAIGoogleGeminiSafetyThreshold || {});
|
|
2540
|
+
var AxAIGoogleGeminiEmbedTypes = /* @__PURE__ */ ((AxAIGoogleGeminiEmbedTypes2) => {
|
|
2541
|
+
AxAIGoogleGeminiEmbedTypes2["SemanticSimilarity"] = "SEMANTIC_SIMILARITY";
|
|
2542
|
+
AxAIGoogleGeminiEmbedTypes2["Classification"] = "CLASSIFICATION";
|
|
2543
|
+
AxAIGoogleGeminiEmbedTypes2["Clustering"] = "CLUSTERING";
|
|
2544
|
+
AxAIGoogleGeminiEmbedTypes2["RetrievalDocument"] = "RETRIEVAL_DOCUMENT";
|
|
2545
|
+
AxAIGoogleGeminiEmbedTypes2["RetrievalQuery"] = "RETRIEVAL_QUERY";
|
|
2546
|
+
AxAIGoogleGeminiEmbedTypes2["QuestionAnswering"] = "QUESTION_ANSWERING";
|
|
2547
|
+
AxAIGoogleGeminiEmbedTypes2["FactVerification"] = "FACT_VERIFICATION";
|
|
2548
|
+
AxAIGoogleGeminiEmbedTypes2["CodeRetrievalQuery"] = "CODE_RETRIEVAL_QUERY";
|
|
2549
|
+
return AxAIGoogleGeminiEmbedTypes2;
|
|
2550
|
+
})(AxAIGoogleGeminiEmbedTypes || {});
|
|
2536
2551
|
|
|
2537
2552
|
// ai/google-gemini/info.ts
|
|
2538
2553
|
var axModelInfoGoogleGemini = [
|
|
@@ -2837,7 +2852,9 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
2837
2852
|
reqValue = {
|
|
2838
2853
|
requests: req.texts.map((text) => ({
|
|
2839
2854
|
model: "models/" + model,
|
|
2840
|
-
content: { parts: [{ text }] }
|
|
2855
|
+
content: { parts: [{ text }] },
|
|
2856
|
+
outputDimensionality: this.config.dimensions,
|
|
2857
|
+
taskType: this.config.embedType
|
|
2841
2858
|
}))
|
|
2842
2859
|
};
|
|
2843
2860
|
}
|
|
@@ -3759,9 +3776,9 @@ function mergeFunctionCalls(functionCalls, functionCallDeltas) {
|
|
|
3759
3776
|
// mem/memory.ts
|
|
3760
3777
|
var defaultLimit = 1e4;
|
|
3761
3778
|
var MemoryImpl = class {
|
|
3762
|
-
constructor(limit = defaultLimit,
|
|
3779
|
+
constructor(limit = defaultLimit, options) {
|
|
3763
3780
|
this.limit = limit;
|
|
3764
|
-
this.
|
|
3781
|
+
this.options = options;
|
|
3765
3782
|
if (limit <= 0) {
|
|
3766
3783
|
throw Error("argument 'limit' must be greater than 0");
|
|
3767
3784
|
}
|
|
@@ -3782,8 +3799,8 @@ var MemoryImpl = class {
|
|
|
3782
3799
|
}
|
|
3783
3800
|
add(value) {
|
|
3784
3801
|
this.addMemory(value);
|
|
3785
|
-
if (this.debug) {
|
|
3786
|
-
debugRequest(value);
|
|
3802
|
+
if (this.options?.debug) {
|
|
3803
|
+
debugRequest(value, this.options?.debugHideSystemPrompt);
|
|
3787
3804
|
}
|
|
3788
3805
|
}
|
|
3789
3806
|
addResultMessage({
|
|
@@ -3802,7 +3819,7 @@ var MemoryImpl = class {
|
|
|
3802
3819
|
functionCalls
|
|
3803
3820
|
}) {
|
|
3804
3821
|
this.addResultMessage({ content, name, functionCalls });
|
|
3805
|
-
if (this.debug) {
|
|
3822
|
+
if (this.options?.debug) {
|
|
3806
3823
|
debugResponse({ content, name, functionCalls });
|
|
3807
3824
|
}
|
|
3808
3825
|
}
|
|
@@ -3826,7 +3843,7 @@ var MemoryImpl = class {
|
|
|
3826
3843
|
lastItem.chat.functionCalls = functionCalls;
|
|
3827
3844
|
}
|
|
3828
3845
|
}
|
|
3829
|
-
if (this.debug) {
|
|
3846
|
+
if (this.options?.debug) {
|
|
3830
3847
|
if (delta && typeof delta === "string") {
|
|
3831
3848
|
debugResponseDelta(delta);
|
|
3832
3849
|
} else if (lastItem) {
|
|
@@ -3882,10 +3899,10 @@ var MemoryImpl = class {
|
|
|
3882
3899
|
}
|
|
3883
3900
|
};
|
|
3884
3901
|
var AxMemory = class {
|
|
3885
|
-
constructor(limit = defaultLimit,
|
|
3902
|
+
constructor(limit = defaultLimit, options) {
|
|
3886
3903
|
this.limit = limit;
|
|
3887
|
-
this.
|
|
3888
|
-
this.defaultMemory = new MemoryImpl(limit,
|
|
3904
|
+
this.options = options;
|
|
3905
|
+
this.defaultMemory = new MemoryImpl(limit, options);
|
|
3889
3906
|
}
|
|
3890
3907
|
memories = /* @__PURE__ */ new Map();
|
|
3891
3908
|
defaultMemory;
|
|
@@ -3894,7 +3911,7 @@ var AxMemory = class {
|
|
|
3894
3911
|
return this.defaultMemory;
|
|
3895
3912
|
}
|
|
3896
3913
|
if (!this.memories.has(sessionId)) {
|
|
3897
|
-
this.memories.set(sessionId, new MemoryImpl(this.limit));
|
|
3914
|
+
this.memories.set(sessionId, new MemoryImpl(this.limit, this.options));
|
|
3898
3915
|
}
|
|
3899
3916
|
return this.memories.get(sessionId);
|
|
3900
3917
|
}
|
|
@@ -3923,15 +3940,15 @@ var AxMemory = class {
|
|
|
3923
3940
|
if (!sessionId) {
|
|
3924
3941
|
this.defaultMemory.reset();
|
|
3925
3942
|
} else {
|
|
3926
|
-
this.memories.set(sessionId, new MemoryImpl(this.limit));
|
|
3943
|
+
this.memories.set(sessionId, new MemoryImpl(this.limit, this.options));
|
|
3927
3944
|
}
|
|
3928
3945
|
}
|
|
3929
3946
|
};
|
|
3930
|
-
function debugRequest(value) {
|
|
3947
|
+
function debugRequest(value, hideSystemPrompt) {
|
|
3931
3948
|
if (Array.isArray(value)) {
|
|
3932
|
-
logChatRequest(value);
|
|
3949
|
+
logChatRequest(value, hideSystemPrompt);
|
|
3933
3950
|
} else {
|
|
3934
|
-
logChatRequestMessage(value);
|
|
3951
|
+
logChatRequestMessage(value, hideSystemPrompt);
|
|
3935
3952
|
}
|
|
3936
3953
|
}
|
|
3937
3954
|
function debugResponse(value) {
|
|
@@ -5416,10 +5433,13 @@ ${errors}
|
|
|
5416
5433
|
}
|
|
5417
5434
|
|
|
5418
5435
|
// dsp/datetime.ts
|
|
5419
|
-
function parseLLMFriendlyDate(field, dateStr) {
|
|
5436
|
+
function parseLLMFriendlyDate(field, dateStr, required = false) {
|
|
5420
5437
|
try {
|
|
5421
5438
|
return _parseLLMFriendlyDate(dateStr);
|
|
5422
5439
|
} catch (err) {
|
|
5440
|
+
if (field.isOptional && !required) {
|
|
5441
|
+
return;
|
|
5442
|
+
}
|
|
5423
5443
|
const message = err.message;
|
|
5424
5444
|
throw new ValidationError({ fields: [field], message, value: dateStr });
|
|
5425
5445
|
}
|
|
@@ -5433,10 +5453,13 @@ function _parseLLMFriendlyDate(dateStr) {
|
|
|
5433
5453
|
const date = moment.utc(dateStr, "YYYY-MM-DD").startOf("day");
|
|
5434
5454
|
return date.toDate();
|
|
5435
5455
|
}
|
|
5436
|
-
function parseLLMFriendlyDateTime(field, dateStr) {
|
|
5456
|
+
function parseLLMFriendlyDateTime(field, dateStr, required = false) {
|
|
5437
5457
|
try {
|
|
5438
5458
|
return _parseLLMFriendlyDateTime(dateStr);
|
|
5439
5459
|
} catch (err) {
|
|
5460
|
+
if (field.isOptional && !required) {
|
|
5461
|
+
return;
|
|
5462
|
+
}
|
|
5440
5463
|
const message = err.message;
|
|
5441
5464
|
throw new ValidationError({ fields: [field], message, value: dateStr });
|
|
5442
5465
|
}
|
|
@@ -5505,8 +5528,9 @@ var streamingExtractValues = (sig, values, xstate, content, streamingValidation
|
|
|
5505
5528
|
if (field.name in values) {
|
|
5506
5529
|
continue;
|
|
5507
5530
|
}
|
|
5508
|
-
const
|
|
5509
|
-
|
|
5531
|
+
const isFirst = xstate.extractedFields.length === 0;
|
|
5532
|
+
const prefix = (isFirst ? "" : "\n") + field.title + ":";
|
|
5533
|
+
let e = matchesContent(content, prefix, xstate.s === 0 ? 0 : xstate.s + 1);
|
|
5510
5534
|
switch (e) {
|
|
5511
5535
|
case -1:
|
|
5512
5536
|
if (streamingValidation && values.length == 0 && !field.isOptional) {
|
|
@@ -5534,7 +5558,11 @@ var streamingExtractValues = (sig, values, xstate, content, streamingValidation
|
|
|
5534
5558
|
if (parsedValue !== void 0) {
|
|
5535
5559
|
values[xstate.currField.name] = parsedValue;
|
|
5536
5560
|
}
|
|
5537
|
-
xstate.
|
|
5561
|
+
if (xstate.prevFields) {
|
|
5562
|
+
xstate.prevFields?.push({ field: xstate.currField, s: xstate.s, e });
|
|
5563
|
+
} else {
|
|
5564
|
+
xstate.prevFields = [{ field: xstate.currField, s: xstate.s, e }];
|
|
5565
|
+
}
|
|
5538
5566
|
}
|
|
5539
5567
|
checkMissingRequiredFields(xstate, values, index);
|
|
5540
5568
|
xstate.s = e + prefixLen;
|
|
@@ -5559,7 +5587,7 @@ var streamingExtractFinalValue = (sig, values, xstate, content) => {
|
|
|
5559
5587
|
const sigFields = sig.getOutputFields();
|
|
5560
5588
|
checkMissingRequiredFields(xstate, values, sigFields.length);
|
|
5561
5589
|
};
|
|
5562
|
-
var convertValueToType = (field, val) => {
|
|
5590
|
+
var convertValueToType = (field, val, required = false) => {
|
|
5563
5591
|
switch (field.type?.name) {
|
|
5564
5592
|
case "code":
|
|
5565
5593
|
return extractBlock(val);
|
|
@@ -5568,6 +5596,9 @@ var convertValueToType = (field, val) => {
|
|
|
5568
5596
|
case "number": {
|
|
5569
5597
|
const v = Number(val);
|
|
5570
5598
|
if (Number.isNaN(v)) {
|
|
5599
|
+
if (field.isOptional && !required) {
|
|
5600
|
+
return;
|
|
5601
|
+
}
|
|
5571
5602
|
throw new Error("Invalid number");
|
|
5572
5603
|
}
|
|
5573
5604
|
return v;
|
|
@@ -5582,16 +5613,22 @@ var convertValueToType = (field, val) => {
|
|
|
5582
5613
|
} else if (v === "false") {
|
|
5583
5614
|
return false;
|
|
5584
5615
|
} else {
|
|
5616
|
+
if (field.isOptional && !required) {
|
|
5617
|
+
return;
|
|
5618
|
+
}
|
|
5585
5619
|
throw new Error("Invalid boolean");
|
|
5586
5620
|
}
|
|
5587
5621
|
}
|
|
5588
5622
|
case "date":
|
|
5589
|
-
return parseLLMFriendlyDate(field, val);
|
|
5623
|
+
return parseLLMFriendlyDate(field, val, required);
|
|
5590
5624
|
case "datetime":
|
|
5591
|
-
return parseLLMFriendlyDateTime(field, val);
|
|
5625
|
+
return parseLLMFriendlyDateTime(field, val, required);
|
|
5592
5626
|
case "class":
|
|
5593
5627
|
const className = val;
|
|
5594
5628
|
if (field.type.classes && !field.type.classes.includes(className)) {
|
|
5629
|
+
if (field.isOptional) {
|
|
5630
|
+
return;
|
|
5631
|
+
}
|
|
5595
5632
|
throw new Error(
|
|
5596
5633
|
`Invalid class '${val}', expected one of the following: ${field.type.classes.join(", ")}`
|
|
5597
5634
|
);
|
|
@@ -5627,11 +5664,11 @@ function* yieldDelta(content, field, s, e, xstate) {
|
|
|
5627
5664
|
}
|
|
5628
5665
|
}
|
|
5629
5666
|
function* streamValues(sig, content, values, xstate) {
|
|
5630
|
-
|
|
5631
|
-
const { field, s, e } =
|
|
5667
|
+
for (const prevField of xstate.prevFields ?? []) {
|
|
5668
|
+
const { field, s, e } = prevField;
|
|
5632
5669
|
yield* yieldDelta(content, field, s, e, xstate);
|
|
5633
|
-
xstate.prevField = void 0;
|
|
5634
5670
|
}
|
|
5671
|
+
xstate.prevFields = void 0;
|
|
5635
5672
|
if (!xstate.currField || xstate.currField.isInternal) {
|
|
5636
5673
|
return;
|
|
5637
5674
|
}
|
|
@@ -5712,7 +5749,7 @@ function validateAndParseFieldValue(field, fieldValue) {
|
|
|
5712
5749
|
for (const [index, item] of value.entries()) {
|
|
5713
5750
|
if (item !== void 0) {
|
|
5714
5751
|
const v = typeof item === "string" ? item.trim() : item;
|
|
5715
|
-
value[index] = convertValueToType(field, v);
|
|
5752
|
+
value[index] = convertValueToType(field, v, true);
|
|
5716
5753
|
}
|
|
5717
5754
|
}
|
|
5718
5755
|
} else {
|
|
@@ -6337,7 +6374,11 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6337
6374
|
const maxRetries = options.maxRetries ?? this.options?.maxRetries ?? 10;
|
|
6338
6375
|
const maxSteps = options.maxSteps ?? this.options?.maxSteps ?? 10;
|
|
6339
6376
|
const debug = options.debug ?? ai.getOptions().debug;
|
|
6340
|
-
const
|
|
6377
|
+
const memOptions = {
|
|
6378
|
+
debug: options.debug,
|
|
6379
|
+
debugHideSystemPrompt: options.debugHideSystemPrompt
|
|
6380
|
+
};
|
|
6381
|
+
const mem = options.mem ?? this.options?.mem ?? new AxMemory(1e4, memOptions);
|
|
6341
6382
|
let err;
|
|
6342
6383
|
if (options?.functions && options.functions.length > 0) {
|
|
6343
6384
|
const promptTemplate = this.options?.promptTemplate ?? AxPromptTemplate;
|
|
@@ -11123,6 +11164,7 @@ export {
|
|
|
11123
11164
|
AxAIDeepSeekModel,
|
|
11124
11165
|
AxAIGoogleGemini,
|
|
11125
11166
|
AxAIGoogleGeminiEmbedModel,
|
|
11167
|
+
AxAIGoogleGeminiEmbedTypes,
|
|
11126
11168
|
AxAIGoogleGeminiModel,
|
|
11127
11169
|
AxAIGoogleGeminiSafetyCategory,
|
|
11128
11170
|
AxAIGoogleGeminiSafetyThreshold,
|