@ax-llm/ax 12.0.12 → 12.0.13
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 +204 -62
- package/index.cjs.map +1 -1
- package/index.d.cts +32 -13
- package/index.d.ts +32 -13
- package/index.js +204 -62
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.cts
CHANGED
|
@@ -209,6 +209,11 @@ type AxFunction = {
|
|
|
209
209
|
parameters?: AxFunctionJSONSchema;
|
|
210
210
|
func: AxFunctionHandler;
|
|
211
211
|
};
|
|
212
|
+
type AxFunctionResult = Extract<AxChatRequest['chatPrompt'][number], {
|
|
213
|
+
role: 'function';
|
|
214
|
+
}> & {
|
|
215
|
+
index: number;
|
|
216
|
+
};
|
|
212
217
|
type AxChatResponseResult = {
|
|
213
218
|
index: number;
|
|
214
219
|
content?: string;
|
|
@@ -2140,12 +2145,7 @@ interface AxAIMemory {
|
|
|
2140
2145
|
updateResult(results: Readonly<AxChatResponseResult> & {
|
|
2141
2146
|
delta?: string;
|
|
2142
2147
|
}, sessionId?: string): void;
|
|
2143
|
-
|
|
2144
|
-
functionId: string;
|
|
2145
|
-
isError: boolean;
|
|
2146
|
-
index: number;
|
|
2147
|
-
result: Readonly<string>;
|
|
2148
|
-
}>, sessionId?: string): void;
|
|
2148
|
+
addFunctionResults(results: Readonly<AxFunctionResult[]>, sessionId?: string): void;
|
|
2149
2149
|
history(index: number, sessionId?: string): AxChatRequest['chatPrompt'];
|
|
2150
2150
|
reset(sessionId?: string): void;
|
|
2151
2151
|
getLast(sessionId?: string): AxMemoryData[number] | undefined;
|
|
@@ -2267,12 +2267,7 @@ declare class AxMemory implements AxAIMemory {
|
|
|
2267
2267
|
private getMemory;
|
|
2268
2268
|
addRequest(value: AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
2269
2269
|
addResponse(results: Readonly<AxChatResponseResult[]>, sessionId?: string): void;
|
|
2270
|
-
|
|
2271
|
-
functionId: string;
|
|
2272
|
-
isError?: boolean;
|
|
2273
|
-
index: number;
|
|
2274
|
-
result: Readonly<string>;
|
|
2275
|
-
}>, sessionId?: string): void;
|
|
2270
|
+
addFunctionResults(results: Readonly<AxFunctionResult[]>, sessionId?: string): void;
|
|
2276
2271
|
updateResult(result: Readonly<AxChatResponseResult & {
|
|
2277
2272
|
delta?: string;
|
|
2278
2273
|
}>, sessionId?: string): void;
|
|
@@ -2419,6 +2414,25 @@ type AxProgramDemos<IN extends AxGenIn, OUT extends AxGenOut> = {
|
|
|
2419
2414
|
programId: string;
|
|
2420
2415
|
};
|
|
2421
2416
|
type AxProgramExamples<IN extends AxGenIn, OUT extends AxGenOut> = AxProgramDemos<IN, OUT> | AxProgramDemos<IN, OUT>['traces'];
|
|
2417
|
+
type AxResultPickerFunctionFieldResults<OUT extends AxGenOut> = {
|
|
2418
|
+
type: 'fields';
|
|
2419
|
+
results: readonly {
|
|
2420
|
+
index: number;
|
|
2421
|
+
sample: Partial<OUT>;
|
|
2422
|
+
}[];
|
|
2423
|
+
};
|
|
2424
|
+
type AxResultPickerFunctionFunctionResults = {
|
|
2425
|
+
type: 'function';
|
|
2426
|
+
results: readonly {
|
|
2427
|
+
index: number;
|
|
2428
|
+
functionName: string;
|
|
2429
|
+
functionId: string;
|
|
2430
|
+
args: string | object;
|
|
2431
|
+
result: string;
|
|
2432
|
+
isError?: boolean;
|
|
2433
|
+
}[];
|
|
2434
|
+
};
|
|
2435
|
+
type AxResultPickerFunction<OUT extends AxGenOut> = (data: AxResultPickerFunctionFieldResults<OUT> | AxResultPickerFunctionFunctionResults) => number | Promise<number>;
|
|
2422
2436
|
type AxProgramForwardOptions = {
|
|
2423
2437
|
maxRetries?: number;
|
|
2424
2438
|
maxSteps?: number;
|
|
@@ -2432,6 +2446,7 @@ type AxProgramForwardOptions = {
|
|
|
2432
2446
|
rateLimiter?: AxRateLimiterFunction;
|
|
2433
2447
|
stream?: boolean;
|
|
2434
2448
|
sampleCount?: number;
|
|
2449
|
+
resultPicker?: AxResultPickerFunction<AxGenOut>;
|
|
2435
2450
|
functions?: AxInputFunctionType;
|
|
2436
2451
|
functionCall?: AxChatRequest['functionCall'];
|
|
2437
2452
|
stopFunction?: string;
|
|
@@ -4297,4 +4312,8 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
4297
4312
|
|
|
4298
4313
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
4299
4314
|
|
|
4300
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, type AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, 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, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, 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, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, 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, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, type AxLoggerFunction, type AxLoggerTag, AxMCPClient, AxMCPHTTPSSETransport, AxMCPStdioTransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCreateDefaultLogger, axCreateDefaultTextLogger, axCreateOptimizerLogger, axDefaultOptimizerLogger, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };
|
|
4315
|
+
interface AxSamplePickerOptions<OUT extends AxGenOut> {
|
|
4316
|
+
resultPicker?: AxResultPickerFunction<OUT>;
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, type AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, 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, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, 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, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, 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, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, type AxFunctionResult, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, type AxLoggerFunction, type AxLoggerTag, AxMCPClient, AxMCPHTTPSSETransport, AxMCPStdioTransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxResultPickerFunction, type AxResultPickerFunctionFieldResults, type AxResultPickerFunctionFunctionResults, type AxRewriteIn, type AxRewriteOut, type AxSamplePickerOptions, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCreateDefaultLogger, axCreateDefaultTextLogger, axCreateOptimizerLogger, axDefaultOptimizerLogger, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };
|
package/index.d.ts
CHANGED
|
@@ -209,6 +209,11 @@ type AxFunction = {
|
|
|
209
209
|
parameters?: AxFunctionJSONSchema;
|
|
210
210
|
func: AxFunctionHandler;
|
|
211
211
|
};
|
|
212
|
+
type AxFunctionResult = Extract<AxChatRequest['chatPrompt'][number], {
|
|
213
|
+
role: 'function';
|
|
214
|
+
}> & {
|
|
215
|
+
index: number;
|
|
216
|
+
};
|
|
212
217
|
type AxChatResponseResult = {
|
|
213
218
|
index: number;
|
|
214
219
|
content?: string;
|
|
@@ -2140,12 +2145,7 @@ interface AxAIMemory {
|
|
|
2140
2145
|
updateResult(results: Readonly<AxChatResponseResult> & {
|
|
2141
2146
|
delta?: string;
|
|
2142
2147
|
}, sessionId?: string): void;
|
|
2143
|
-
|
|
2144
|
-
functionId: string;
|
|
2145
|
-
isError: boolean;
|
|
2146
|
-
index: number;
|
|
2147
|
-
result: Readonly<string>;
|
|
2148
|
-
}>, sessionId?: string): void;
|
|
2148
|
+
addFunctionResults(results: Readonly<AxFunctionResult[]>, sessionId?: string): void;
|
|
2149
2149
|
history(index: number, sessionId?: string): AxChatRequest['chatPrompt'];
|
|
2150
2150
|
reset(sessionId?: string): void;
|
|
2151
2151
|
getLast(sessionId?: string): AxMemoryData[number] | undefined;
|
|
@@ -2267,12 +2267,7 @@ declare class AxMemory implements AxAIMemory {
|
|
|
2267
2267
|
private getMemory;
|
|
2268
2268
|
addRequest(value: AxChatRequest['chatPrompt'], sessionId?: string): void;
|
|
2269
2269
|
addResponse(results: Readonly<AxChatResponseResult[]>, sessionId?: string): void;
|
|
2270
|
-
|
|
2271
|
-
functionId: string;
|
|
2272
|
-
isError?: boolean;
|
|
2273
|
-
index: number;
|
|
2274
|
-
result: Readonly<string>;
|
|
2275
|
-
}>, sessionId?: string): void;
|
|
2270
|
+
addFunctionResults(results: Readonly<AxFunctionResult[]>, sessionId?: string): void;
|
|
2276
2271
|
updateResult(result: Readonly<AxChatResponseResult & {
|
|
2277
2272
|
delta?: string;
|
|
2278
2273
|
}>, sessionId?: string): void;
|
|
@@ -2419,6 +2414,25 @@ type AxProgramDemos<IN extends AxGenIn, OUT extends AxGenOut> = {
|
|
|
2419
2414
|
programId: string;
|
|
2420
2415
|
};
|
|
2421
2416
|
type AxProgramExamples<IN extends AxGenIn, OUT extends AxGenOut> = AxProgramDemos<IN, OUT> | AxProgramDemos<IN, OUT>['traces'];
|
|
2417
|
+
type AxResultPickerFunctionFieldResults<OUT extends AxGenOut> = {
|
|
2418
|
+
type: 'fields';
|
|
2419
|
+
results: readonly {
|
|
2420
|
+
index: number;
|
|
2421
|
+
sample: Partial<OUT>;
|
|
2422
|
+
}[];
|
|
2423
|
+
};
|
|
2424
|
+
type AxResultPickerFunctionFunctionResults = {
|
|
2425
|
+
type: 'function';
|
|
2426
|
+
results: readonly {
|
|
2427
|
+
index: number;
|
|
2428
|
+
functionName: string;
|
|
2429
|
+
functionId: string;
|
|
2430
|
+
args: string | object;
|
|
2431
|
+
result: string;
|
|
2432
|
+
isError?: boolean;
|
|
2433
|
+
}[];
|
|
2434
|
+
};
|
|
2435
|
+
type AxResultPickerFunction<OUT extends AxGenOut> = (data: AxResultPickerFunctionFieldResults<OUT> | AxResultPickerFunctionFunctionResults) => number | Promise<number>;
|
|
2422
2436
|
type AxProgramForwardOptions = {
|
|
2423
2437
|
maxRetries?: number;
|
|
2424
2438
|
maxSteps?: number;
|
|
@@ -2432,6 +2446,7 @@ type AxProgramForwardOptions = {
|
|
|
2432
2446
|
rateLimiter?: AxRateLimiterFunction;
|
|
2433
2447
|
stream?: boolean;
|
|
2434
2448
|
sampleCount?: number;
|
|
2449
|
+
resultPicker?: AxResultPickerFunction<AxGenOut>;
|
|
2435
2450
|
functions?: AxInputFunctionType;
|
|
2436
2451
|
functionCall?: AxChatRequest['functionCall'];
|
|
2437
2452
|
stopFunction?: string;
|
|
@@ -4297,4 +4312,8 @@ declare const axModelInfoReka: AxModelInfo[];
|
|
|
4297
4312
|
|
|
4298
4313
|
declare const axModelInfoTogether: AxModelInfo[];
|
|
4299
4314
|
|
|
4300
|
-
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, type AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, 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, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, 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, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, 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, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, type AxLoggerFunction, type AxLoggerTag, AxMCPClient, AxMCPHTTPSSETransport, AxMCPStdioTransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxRewriteIn, type AxRewriteOut, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCreateDefaultLogger, axCreateDefaultTextLogger, axCreateOptimizerLogger, axDefaultOptimizerLogger, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };
|
|
4315
|
+
interface AxSamplePickerOptions<OUT extends AxGenOut> {
|
|
4316
|
+
resultPicker?: AxResultPickerFunction<OUT>;
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
export { AxAI, AxAIAnthropic, type AxAIAnthropicArgs, type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatRequestCacheParam, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig, type AxAIAnthropicContentBlockDeltaEvent, type AxAIAnthropicContentBlockStartEvent, type AxAIAnthropicContentBlockStopEvent, type AxAIAnthropicErrorEvent, type AxAIAnthropicMessageDeltaEvent, type AxAIAnthropicMessageStartEvent, type AxAIAnthropicMessageStopEvent, AxAIAnthropicModel, type AxAIAnthropicPingEvent, type AxAIAnthropicThinkingConfig, type AxAIAnthropicThinkingTokenBudgetLevels, 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, type AxAIGoogleGeminiContentPart, AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiEmbedTypes, type AxAIGoogleGeminiGenerationConfig, AxAIGoogleGeminiModel, type AxAIGoogleGeminiOptionsTools, AxAIGoogleGeminiSafetyCategory, type AxAIGoogleGeminiSafetySettings, AxAIGoogleGeminiSafetyThreshold, type AxAIGoogleGeminiThinkingConfig, type AxAIGoogleGeminiThinkingTokenBudgetLevels, type AxAIGoogleGeminiTool, type AxAIGoogleGeminiToolConfig, type AxAIGoogleGeminiToolFunctionDeclaration, type AxAIGoogleGeminiToolGoogleSearchRetrieval, type AxAIGoogleVertexBatchEmbedRequest, type AxAIGoogleVertexBatchEmbedResponse, AxAIGrok, type AxAIGrokArgs, type AxAIGrokChatRequest, AxAIGrokEmbedModels, AxAIGrokModel, type AxAIGrokOptionsTools, type AxAIGrokSearchSource, AxAIGroq, type AxAIGroqArgs, AxAIGroqModel, AxAIHuggingFace, type AxAIHuggingFaceArgs, type AxAIHuggingFaceConfig, AxAIHuggingFaceModel, type AxAIHuggingFaceRequest, type AxAIHuggingFaceResponse, type AxAIInputModelList, type AxAIMemory, AxAIMistral, type AxAIMistralArgs, type AxAIMistralChatRequest, 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, AxAIOpenAIResponses, type AxAIOpenAIResponsesArgs, AxAIOpenAIResponsesBase, type AxAIOpenAIResponsesCodeInterpreterToolCall, type AxAIOpenAIResponsesComputerToolCall, type AxAIOpenAIResponsesConfig, type AxAIOpenAIResponsesContentPartAddedEvent, type AxAIOpenAIResponsesContentPartDoneEvent, type AxAIOpenAIResponsesDefineFunctionTool, type AxAIOpenAIResponsesErrorEvent, type AxAIOpenAIResponsesFileSearchCallCompletedEvent, type AxAIOpenAIResponsesFileSearchCallInProgressEvent, type AxAIOpenAIResponsesFileSearchCallSearchingEvent, type AxAIOpenAIResponsesFileSearchToolCall, type AxAIOpenAIResponsesFunctionCallArgumentsDeltaEvent, type AxAIOpenAIResponsesFunctionCallArgumentsDoneEvent, type AxAIOpenAIResponsesFunctionCallItem, type AxAIOpenAIResponsesImageGenerationCallCompletedEvent, type AxAIOpenAIResponsesImageGenerationCallGeneratingEvent, type AxAIOpenAIResponsesImageGenerationCallInProgressEvent, type AxAIOpenAIResponsesImageGenerationCallPartialImageEvent, type AxAIOpenAIResponsesImageGenerationToolCall, AxAIOpenAIResponsesImpl, type AxAIOpenAIResponsesInputAudioContentPart, type AxAIOpenAIResponsesInputContentPart, type AxAIOpenAIResponsesInputFunctionCallItem, type AxAIOpenAIResponsesInputFunctionCallOutputItem, type AxAIOpenAIResponsesInputImageUrlContentPart, type AxAIOpenAIResponsesInputItem, type AxAIOpenAIResponsesInputMessageItem, type AxAIOpenAIResponsesInputTextContentPart, type AxAIOpenAIResponsesLocalShellToolCall, type AxAIOpenAIResponsesMCPCallArgumentsDeltaEvent, type AxAIOpenAIResponsesMCPCallArgumentsDoneEvent, type AxAIOpenAIResponsesMCPCallCompletedEvent, type AxAIOpenAIResponsesMCPCallFailedEvent, type AxAIOpenAIResponsesMCPCallInProgressEvent, type AxAIOpenAIResponsesMCPListToolsCompletedEvent, type AxAIOpenAIResponsesMCPListToolsFailedEvent, type AxAIOpenAIResponsesMCPListToolsInProgressEvent, type AxAIOpenAIResponsesMCPToolCall, AxAIOpenAIResponsesModel, type AxAIOpenAIResponsesOutputItem, type AxAIOpenAIResponsesOutputItemAddedEvent, type AxAIOpenAIResponsesOutputItemDoneEvent, type AxAIOpenAIResponsesOutputMessageItem, type AxAIOpenAIResponsesOutputRefusalContentPart, type AxAIOpenAIResponsesOutputTextAnnotationAddedEvent, type AxAIOpenAIResponsesOutputTextContentPart, type AxAIOpenAIResponsesOutputTextDeltaEvent, type AxAIOpenAIResponsesOutputTextDoneEvent, type AxAIOpenAIResponsesReasoningDeltaEvent, type AxAIOpenAIResponsesReasoningDoneEvent, type AxAIOpenAIResponsesReasoningItem, type AxAIOpenAIResponsesReasoningSummaryDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryDoneEvent, type AxAIOpenAIResponsesReasoningSummaryPart, type AxAIOpenAIResponsesReasoningSummaryPartAddedEvent, type AxAIOpenAIResponsesReasoningSummaryPartDoneEvent, type AxAIOpenAIResponsesReasoningSummaryTextDeltaEvent, type AxAIOpenAIResponsesReasoningSummaryTextDoneEvent, type AxAIOpenAIResponsesRefusalDeltaEvent, type AxAIOpenAIResponsesRefusalDoneEvent, type AxAIOpenAIResponsesRequest, type AxAIOpenAIResponsesResponse, type AxAIOpenAIResponsesResponseCompletedEvent, type AxAIOpenAIResponsesResponseCreatedEvent, type AxAIOpenAIResponsesResponseDelta, type AxAIOpenAIResponsesResponseFailedEvent, type AxAIOpenAIResponsesResponseInProgressEvent, type AxAIOpenAIResponsesResponseIncompleteEvent, type AxAIOpenAIResponsesResponseQueuedEvent, type AxAIOpenAIResponsesStreamEvent, type AxAIOpenAIResponsesStreamEventBase, type AxAIOpenAIResponsesToolCall, type AxAIOpenAIResponsesToolCallBase, type AxAIOpenAIResponsesToolChoice, type AxAIOpenAIResponsesToolDefinition, type AxAIOpenAIResponsesWebSearchCallCompletedEvent, type AxAIOpenAIResponsesWebSearchCallInProgressEvent, type AxAIOpenAIResponsesWebSearchCallSearchingEvent, type AxAIOpenAIResponsesWebSearchToolCall, type AxAIOpenAIUsage, type AxAIPromptConfig, AxAIReka, type AxAIRekaArgs, type AxAIRekaChatRequest, type AxAIRekaChatResponse, type AxAIRekaChatResponseDelta, type AxAIRekaConfig, AxAIRekaModel, type AxAIRekaUsage, type AxAIService, AxAIServiceAbortedError, 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, AxBaseOptimizer, type AxBootstrapCompileOptions, AxBootstrapFewShot, type AxBootstrapOptimizerOptions, AxChainOfThought, type AxChatRequest, type AxChatResponse, type AxChatResponseFunctionCall, type AxChatResponseResult, type AxCheckpointLoadFn, type AxCheckpointSaveFn, type AxCompileOptions, type AxCostTracker, type AxCostTrackerOptions, 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, AxDefaultCostTracker, AxDefaultResultReranker, type AxDockerContainer, AxDockerSession, type AxEmbedRequest, type AxEmbedResponse, AxEmbeddingAdapter, AxEvalUtil, type AxEvaluateArgs, type AxExample, type AxField, type AxFieldDescriptor, type AxFieldProcessor, type AxFieldProcessorProcess, type AxFieldTemplateFn, type AxFieldType, type AxFieldValue, type AxFunction, AxFunctionError, type AxFunctionHandler, type AxFunctionJSONSchema, AxFunctionProcessor, type AxFunctionResult, AxGen, type AxGenDeltaOut, type AxGenIn, type AxGenOut, type AxGenStreamingOut, AxGenerateError, type AxGenerateErrorDetails, type AxGenerateResult, AxHFDataLoader, type AxIField, type AxInputFunctionType, AxInstanceRegistry, type AxInternalChatRequest, type AxInternalEmbedRequest, AxJSInterpreter, AxJSInterpreterPermission, AxLLMRequestTypeValues, type AxLoggerFunction, type AxLoggerTag, AxMCPClient, AxMCPHTTPSSETransport, AxMCPStdioTransport, type AxMCPStreamableHTTPTransportOptions, AxMCPStreambleHTTPTransport, type AxMCPTransport, AxMemory, type AxMemoryData, type AxMessage, type AxMetricFn, type AxMetricFnArgs, AxMiPRO, type AxMiPROCompileOptions, type AxMiPROOptimizerOptions, type AxMiPROResult, AxMockAIService, type AxMockAIServiceConfig, type AxModelConfig, type AxModelInfo, type AxModelInfoWithProvider, type AxModelUsage, type AxMultiMetricFn, AxMultiServiceRouter, type AxOptimizationCheckpoint, type AxOptimizationProgress, type AxOptimizationStats, type AxOptimizer, type AxOptimizerArgs, type AxOptimizerResult, type AxParetoResult, AxProgram, type AxProgramDemos, type AxProgramExamples, type AxProgramForwardOptions, type AxProgramStreamingForwardOptions, type AxProgramTrace, type AxProgramUsage, AxProgramWithSignature, type AxProgramWithSignatureOptions, AxPromptTemplate, type AxPromptTemplateOptions, AxRAG, type AxRateLimiterFunction, AxRateLimiterTokenUsage, type AxRateLimiterTokenUsageOptions, type AxRerankerIn, type AxRerankerOut, type AxResponseHandlerArgs, type AxResultPickerFunction, type AxResultPickerFunctionFieldResults, type AxResultPickerFunctionFunctionResults, type AxRewriteIn, type AxRewriteOut, type AxSamplePickerOptions, type AxSetExamplesOptions, AxSignature, type AxSignatureConfig, type AxSignatureTemplateValue, AxSimpleClassifier, AxSimpleClassifierClass, type AxSimpleClassifierForwardOptions, AxSpanKindValues, type AxStreamingAssertion, type AxStreamingEvent, type AxStreamingFieldProcessorProcess, AxStringUtil, AxTestPrompt, type AxTokenUsage, type AxTunable, type AxUsable, ax, axAIAnthropicDefaultConfig, axAIAnthropicVertexDefaultConfig, axAIAzureOpenAIBestConfig, axAIAzureOpenAICreativeConfig, axAIAzureOpenAIDefaultConfig, axAIAzureOpenAIFastConfig, axAICohereCreativeConfig, axAICohereDefaultConfig, axAIDeepSeekCodeConfig, axAIDeepSeekDefaultConfig, axAIGoogleGeminiDefaultConfig, axAIGoogleGeminiDefaultCreativeConfig, axAIGrokBestConfig, axAIGrokDefaultConfig, axAIHuggingFaceCreativeConfig, axAIHuggingFaceDefaultConfig, axAIMistralBestConfig, axAIMistralDefaultConfig, axAIOllamaDefaultConfig, axAIOllamaDefaultCreativeConfig, axAIOpenAIBestConfig, axAIOpenAICreativeConfig, axAIOpenAIDefaultConfig, axAIOpenAIFastConfig, axAIOpenAIResponsesBestConfig, axAIOpenAIResponsesCreativeConfig, axAIOpenAIResponsesDefaultConfig, axAIRekaBestConfig, axAIRekaCreativeConfig, axAIRekaDefaultConfig, axAIRekaFastConfig, axAITogetherDefaultConfig, axBaseAIDefaultConfig, axBaseAIDefaultCreativeConfig, axCreateDefaultLogger, axCreateDefaultTextLogger, axCreateOptimizerLogger, axDefaultOptimizerLogger, axGlobals, axModelInfoAnthropic, axModelInfoCohere, axModelInfoDeepSeek, axModelInfoGoogleGemini, axModelInfoGrok, axModelInfoGroq, axModelInfoHuggingFace, axModelInfoMistral, axModelInfoOpenAI, axModelInfoReka, axModelInfoTogether, axSpanAttributes, axSpanEvents, axValidateChatRequestMessage, axValidateChatResponseResult, f, s };
|
package/index.js
CHANGED
|
@@ -6083,15 +6083,24 @@ var MemoryImpl = class {
|
|
|
6083
6083
|
debugRequest(items, this.options?.debugHideSystemPrompt);
|
|
6084
6084
|
}
|
|
6085
6085
|
}
|
|
6086
|
+
addFunctionResults(results) {
|
|
6087
|
+
const chat = results.map(({ index, ...value }) => ({
|
|
6088
|
+
index,
|
|
6089
|
+
value: structuredClone(value)
|
|
6090
|
+
}));
|
|
6091
|
+
const lastItem = this.getLast();
|
|
6092
|
+
if (lastItem?.role === "function") {
|
|
6093
|
+
lastItem.chat.push(...chat);
|
|
6094
|
+
} else {
|
|
6095
|
+
this.data.push({ role: "function", chat });
|
|
6096
|
+
}
|
|
6097
|
+
}
|
|
6086
6098
|
addResponse(results) {
|
|
6087
|
-
const chat = results.map((
|
|
6088
|
-
index
|
|
6089
|
-
value: structuredClone(
|
|
6099
|
+
const chat = results.map(({ index, ...value }) => ({
|
|
6100
|
+
index,
|
|
6101
|
+
value: structuredClone(value)
|
|
6090
6102
|
}));
|
|
6091
|
-
this.data.push({
|
|
6092
|
-
role: "assistant",
|
|
6093
|
-
chat
|
|
6094
|
-
});
|
|
6103
|
+
this.data.push({ role: "assistant", chat });
|
|
6095
6104
|
if (this.options?.debug) {
|
|
6096
6105
|
for (const result of results) {
|
|
6097
6106
|
debugResponse(result);
|
|
@@ -6179,9 +6188,20 @@ var MemoryImpl = class {
|
|
|
6179
6188
|
history(index) {
|
|
6180
6189
|
const result = [];
|
|
6181
6190
|
for (const { role, chat } of this.data) {
|
|
6182
|
-
|
|
6183
|
-
if (
|
|
6184
|
-
|
|
6191
|
+
let values;
|
|
6192
|
+
if (role === "function") {
|
|
6193
|
+
values = chat.filter((v) => v.index === index).map((v) => v.value);
|
|
6194
|
+
} else {
|
|
6195
|
+
values = chat.find((v) => v.index === index)?.value;
|
|
6196
|
+
}
|
|
6197
|
+
if (Array.isArray(values)) {
|
|
6198
|
+
result.push(
|
|
6199
|
+
...values.map(
|
|
6200
|
+
(v) => ({ ...v, role })
|
|
6201
|
+
)
|
|
6202
|
+
);
|
|
6203
|
+
} else if (values) {
|
|
6204
|
+
result.push({ ...values, role });
|
|
6185
6205
|
}
|
|
6186
6206
|
}
|
|
6187
6207
|
return result;
|
|
@@ -6219,20 +6239,8 @@ var AxMemory = class {
|
|
|
6219
6239
|
axValidateChatResponseResult(results);
|
|
6220
6240
|
this.getMemory(sessionId).addResponse(results);
|
|
6221
6241
|
}
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
isError,
|
|
6225
|
-
index,
|
|
6226
|
-
result
|
|
6227
|
-
}, sessionId) {
|
|
6228
|
-
const functionMessage = {
|
|
6229
|
-
role: "function",
|
|
6230
|
-
functionId,
|
|
6231
|
-
isError,
|
|
6232
|
-
result
|
|
6233
|
-
};
|
|
6234
|
-
axValidateChatRequestMessage(functionMessage);
|
|
6235
|
-
this.getMemory(sessionId).addRequest([functionMessage], index);
|
|
6242
|
+
addFunctionResults(results, sessionId) {
|
|
6243
|
+
this.getMemory(sessionId).addFunctionResults(results);
|
|
6236
6244
|
}
|
|
6237
6245
|
updateResult(result, sessionId) {
|
|
6238
6246
|
this.getMemory(sessionId).updateResult(result);
|
|
@@ -7469,51 +7477,48 @@ var processFunctions = async ({
|
|
|
7469
7477
|
}
|
|
7470
7478
|
return {
|
|
7471
7479
|
result: functionResult ?? "",
|
|
7480
|
+
role: "function",
|
|
7472
7481
|
functionId: func.id,
|
|
7473
7482
|
index
|
|
7474
7483
|
};
|
|
7475
7484
|
}).catch((e) => {
|
|
7476
|
-
if (e instanceof FunctionError) {
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7485
|
+
if (!(e instanceof FunctionError)) {
|
|
7486
|
+
throw e;
|
|
7487
|
+
}
|
|
7488
|
+
const result = e.getFixingInstructions();
|
|
7489
|
+
if (span) {
|
|
7490
|
+
const errorEventData = {
|
|
7491
|
+
name: func.name,
|
|
7492
|
+
message: e.toString()
|
|
7493
|
+
};
|
|
7494
|
+
if (!excludeContentFromTrace) {
|
|
7495
|
+
errorEventData.args = func.args;
|
|
7496
|
+
errorEventData.fixing_instructions = result;
|
|
7488
7497
|
}
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
result
|
|
7495
|
-
},
|
|
7496
|
-
sessionId
|
|
7497
|
-
);
|
|
7498
|
-
mem.addTag("error", sessionId);
|
|
7499
|
-
if (ai.getOptions().debug) {
|
|
7500
|
-
const logger = ai.getLogger();
|
|
7501
|
-
logger(`\u274C Function Error Correction:
|
|
7498
|
+
span.addEvent("function.error", errorEventData);
|
|
7499
|
+
}
|
|
7500
|
+
if (ai.getOptions().debug) {
|
|
7501
|
+
const logger = ai.getLogger();
|
|
7502
|
+
logger(`\u274C Function Error Correction:
|
|
7502
7503
|
${result}`, {
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
}
|
|
7506
|
-
} else {
|
|
7507
|
-
throw e;
|
|
7504
|
+
tags: ["error"]
|
|
7505
|
+
});
|
|
7508
7506
|
}
|
|
7507
|
+
return {
|
|
7508
|
+
functionId: func.id,
|
|
7509
|
+
isError: true,
|
|
7510
|
+
index,
|
|
7511
|
+
result,
|
|
7512
|
+
role: "function"
|
|
7513
|
+
};
|
|
7509
7514
|
});
|
|
7510
7515
|
return promise;
|
|
7511
7516
|
});
|
|
7512
7517
|
const results = await Promise.all(promises);
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7518
|
+
const functionResults = results.filter((result) => result !== void 0);
|
|
7519
|
+
mem.addFunctionResults(functionResults, sessionId);
|
|
7520
|
+
if (functionResults.some((result) => result.isError)) {
|
|
7521
|
+
mem.addTag("error", sessionId);
|
|
7517
7522
|
}
|
|
7518
7523
|
return functionsExecuted;
|
|
7519
7524
|
};
|
|
@@ -9787,6 +9792,96 @@ var AxProgram = class {
|
|
|
9787
9792
|
}
|
|
9788
9793
|
};
|
|
9789
9794
|
|
|
9795
|
+
// dsp/samples.ts
|
|
9796
|
+
function checkForFunctionCalls(mem, sessionId) {
|
|
9797
|
+
const history = mem.history(0, sessionId);
|
|
9798
|
+
const hasFunctionResults = history.some((msg) => msg.role === "function");
|
|
9799
|
+
const hasFunctionCalls = history.some(
|
|
9800
|
+
(msg) => msg.role === "assistant" && "functionCalls" in msg && Array.isArray(msg.functionCalls) && msg.functionCalls.length > 0
|
|
9801
|
+
);
|
|
9802
|
+
return hasFunctionCalls && hasFunctionResults;
|
|
9803
|
+
}
|
|
9804
|
+
function extractFunctionResults(mem, sessionId) {
|
|
9805
|
+
const history = mem.history(0, sessionId);
|
|
9806
|
+
const results = [];
|
|
9807
|
+
const assistantMessages = history.filter(
|
|
9808
|
+
(msg) => msg.role === "assistant" && "functionCalls" in msg && Array.isArray(msg.functionCalls) && msg.functionCalls.length > 0
|
|
9809
|
+
);
|
|
9810
|
+
const functionMessages = history.filter((msg) => msg.role === "function");
|
|
9811
|
+
for (const assistantMsg of assistantMessages) {
|
|
9812
|
+
if ("functionCalls" in assistantMsg && assistantMsg.functionCalls) {
|
|
9813
|
+
for (const funcCall of assistantMsg.functionCalls) {
|
|
9814
|
+
const funcResult = functionMessages.find(
|
|
9815
|
+
(msg) => "functionId" in msg && msg.functionId === funcCall.id
|
|
9816
|
+
);
|
|
9817
|
+
if (funcResult && "result" in funcResult && "functionId" in funcResult) {
|
|
9818
|
+
results.push({
|
|
9819
|
+
index: results.length,
|
|
9820
|
+
// Use sequential index for function results
|
|
9821
|
+
functionName: funcCall.function.name,
|
|
9822
|
+
functionId: funcCall.id,
|
|
9823
|
+
args: funcCall.function.params || "",
|
|
9824
|
+
result: String(funcResult.result),
|
|
9825
|
+
isError: "isError" in funcResult ? Boolean(funcResult.isError) : false
|
|
9826
|
+
});
|
|
9827
|
+
}
|
|
9828
|
+
}
|
|
9829
|
+
}
|
|
9830
|
+
}
|
|
9831
|
+
return results;
|
|
9832
|
+
}
|
|
9833
|
+
async function selectFromSamples(buffer, options, mem, sessionId) {
|
|
9834
|
+
if (!options?.resultPicker || buffer.length <= 1) {
|
|
9835
|
+
return 0;
|
|
9836
|
+
}
|
|
9837
|
+
const resultPicker = options.resultPicker;
|
|
9838
|
+
const hasFunctionCalls = mem ? checkForFunctionCalls(mem, sessionId) : false;
|
|
9839
|
+
if (hasFunctionCalls && mem) {
|
|
9840
|
+
const functionResults = extractFunctionResults(mem, sessionId);
|
|
9841
|
+
const selectedIndex = await resultPicker({
|
|
9842
|
+
type: "function",
|
|
9843
|
+
results: functionResults
|
|
9844
|
+
});
|
|
9845
|
+
if (selectedIndex < 0 || selectedIndex >= functionResults.length) {
|
|
9846
|
+
throw new Error(
|
|
9847
|
+
`Result picker returned invalid index: ${selectedIndex}. Must be between 0 and ${functionResults.length - 1}`
|
|
9848
|
+
);
|
|
9849
|
+
}
|
|
9850
|
+
return selectedIndex;
|
|
9851
|
+
} else {
|
|
9852
|
+
const fieldResults = buffer.map((b, index) => ({
|
|
9853
|
+
index,
|
|
9854
|
+
sample: b.delta
|
|
9855
|
+
}));
|
|
9856
|
+
const selectedIndex = await resultPicker({
|
|
9857
|
+
type: "fields",
|
|
9858
|
+
results: fieldResults
|
|
9859
|
+
});
|
|
9860
|
+
if (selectedIndex < 0 || selectedIndex >= buffer.length) {
|
|
9861
|
+
throw new Error(
|
|
9862
|
+
`Result picker returned invalid index: ${selectedIndex}. Must be between 0 and ${buffer.length - 1}`
|
|
9863
|
+
);
|
|
9864
|
+
}
|
|
9865
|
+
return selectedIndex;
|
|
9866
|
+
}
|
|
9867
|
+
}
|
|
9868
|
+
async function selectFromSamplesInMemory(mem, sessionId, options) {
|
|
9869
|
+
const lastMemory = mem?.getLast(sessionId);
|
|
9870
|
+
if (!lastMemory || lastMemory.role !== "assistant") {
|
|
9871
|
+
return 0;
|
|
9872
|
+
}
|
|
9873
|
+
if (lastMemory.chat.length <= 1) {
|
|
9874
|
+
return 0;
|
|
9875
|
+
}
|
|
9876
|
+
const buffer = lastMemory.chat.map((chat) => ({
|
|
9877
|
+
version: 0,
|
|
9878
|
+
index: chat.index,
|
|
9879
|
+
delta: chat.value
|
|
9880
|
+
}));
|
|
9881
|
+
const selectedIndex = await selectFromSamples(buffer, options, mem, sessionId);
|
|
9882
|
+
return selectedIndex;
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9790
9885
|
// dsp/validate.ts
|
|
9791
9886
|
function handleValidationError(mem, errorFields, ai, promptTemplate, sessionId) {
|
|
9792
9887
|
mem.addRequest(
|
|
@@ -9902,7 +9997,10 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
9902
9997
|
thinkingTokenBudget,
|
|
9903
9998
|
showThoughts
|
|
9904
9999
|
} = options ?? {};
|
|
9905
|
-
const
|
|
10000
|
+
const selectedIndex = await selectFromSamplesInMemory(mem, sessionId, {
|
|
10001
|
+
resultPicker: options?.resultPicker
|
|
10002
|
+
});
|
|
10003
|
+
const chatPrompt = mem?.history(selectedIndex, sessionId) ?? [];
|
|
9906
10004
|
if (chatPrompt.length === 0) {
|
|
9907
10005
|
throw new Error("No chat prompt found");
|
|
9908
10006
|
}
|
|
@@ -9913,7 +10011,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
9913
10011
|
}
|
|
9914
10012
|
const modelConfig = {
|
|
9915
10013
|
...options?.modelConfig,
|
|
9916
|
-
...options?.sampleCount ? { n: options.sampleCount } : {}
|
|
10014
|
+
...options?.sampleCount ? { n: options.sampleCount } : {},
|
|
10015
|
+
...options?.sampleCount && options?.modelConfig?.temperature == 1 ? { temperature: 0.8 } : {}
|
|
9917
10016
|
};
|
|
9918
10017
|
const res = await ai.chat(
|
|
9919
10018
|
{
|
|
@@ -10190,15 +10289,58 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
10190
10289
|
currentVersion = delta.version;
|
|
10191
10290
|
buffer = mergeDeltas(buffer, delta);
|
|
10192
10291
|
}
|
|
10193
|
-
const
|
|
10292
|
+
const selectedIndex = await selectFromSamples(
|
|
10293
|
+
buffer,
|
|
10294
|
+
{
|
|
10295
|
+
resultPicker: options?.resultPicker
|
|
10296
|
+
},
|
|
10297
|
+
// Pass memory to enable function result selection
|
|
10298
|
+
options?.mem,
|
|
10299
|
+
options?.sessionId
|
|
10300
|
+
);
|
|
10301
|
+
const selectedResult = buffer[selectedIndex];
|
|
10302
|
+
const result = selectedResult?.delta ?? {};
|
|
10194
10303
|
this.trace = { ...values, ...result };
|
|
10195
10304
|
return result;
|
|
10196
10305
|
}
|
|
10197
10306
|
async *streamingForward(ai, values, options) {
|
|
10198
|
-
|
|
10307
|
+
if (!options?.resultPicker) {
|
|
10308
|
+
yield* this._forward1(ai, values, {
|
|
10309
|
+
...options,
|
|
10310
|
+
stream: true
|
|
10311
|
+
});
|
|
10312
|
+
return;
|
|
10313
|
+
}
|
|
10314
|
+
const generator = this._forward1(ai, values, {
|
|
10199
10315
|
...options,
|
|
10200
10316
|
stream: true
|
|
10201
10317
|
});
|
|
10318
|
+
let buffer = [];
|
|
10319
|
+
let currentVersion = 0;
|
|
10320
|
+
for await (const delta of generator) {
|
|
10321
|
+
if (delta.version !== currentVersion) {
|
|
10322
|
+
buffer = [];
|
|
10323
|
+
}
|
|
10324
|
+
currentVersion = delta.version;
|
|
10325
|
+
buffer = mergeDeltas(buffer, delta);
|
|
10326
|
+
}
|
|
10327
|
+
const selectedIndex = await selectFromSamples(
|
|
10328
|
+
buffer,
|
|
10329
|
+
{
|
|
10330
|
+
resultPicker: options?.resultPicker
|
|
10331
|
+
},
|
|
10332
|
+
// Pass memory to enable function result selection
|
|
10333
|
+
options?.mem,
|
|
10334
|
+
options?.sessionId
|
|
10335
|
+
);
|
|
10336
|
+
const selectedResult = buffer[selectedIndex];
|
|
10337
|
+
if (selectedResult) {
|
|
10338
|
+
yield {
|
|
10339
|
+
version: currentVersion,
|
|
10340
|
+
index: selectedIndex,
|
|
10341
|
+
delta: selectedResult.delta
|
|
10342
|
+
};
|
|
10343
|
+
}
|
|
10202
10344
|
}
|
|
10203
10345
|
setExamples(examples, options) {
|
|
10204
10346
|
super.setExamples(examples, options);
|