@juspay/neurolink 7.29.2 → 7.30.0
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/CHANGELOG.md +12 -0
- package/dist/cli/commands/config.d.ts +83 -83
- package/dist/cli/commands/mcp.js +39 -9
- package/dist/cli/commands/models.js +25 -21
- package/dist/cli/commands/ollama.js +2 -2
- package/dist/cli/factories/commandFactory.d.ts +8 -0
- package/dist/cli/factories/commandFactory.js +65 -65
- package/dist/cli/factories/ollamaCommandFactory.js +3 -1
- package/dist/cli/factories/sagemakerCommandFactory.js +3 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +11 -11
- package/dist/cli/utils/envManager.js +5 -5
- package/dist/cli/utils/ollamaUtils.d.ts +12 -0
- package/dist/cli/utils/ollamaUtils.js +58 -42
- package/dist/config/configManager.js +5 -2
- package/dist/config/conversationMemoryConfig.js +5 -0
- package/dist/core/analytics.d.ts +2 -24
- package/dist/core/analytics.js +12 -17
- package/dist/core/baseProvider.d.ts +30 -1
- package/dist/core/baseProvider.js +180 -198
- package/dist/core/conversationMemoryManager.d.ts +9 -15
- package/dist/core/conversationMemoryManager.js +98 -57
- package/dist/core/dynamicModels.d.ts +4 -4
- package/dist/core/dynamicModels.js +7 -7
- package/dist/core/evaluation.d.ts +9 -9
- package/dist/core/evaluation.js +117 -65
- package/dist/core/evaluationProviders.d.ts +18 -2
- package/dist/core/evaluationProviders.js +15 -13
- package/dist/core/modelConfiguration.d.ts +63 -0
- package/dist/core/modelConfiguration.js +354 -290
- package/dist/core/streamAnalytics.d.ts +10 -5
- package/dist/core/streamAnalytics.js +10 -10
- package/dist/core/types.d.ts +22 -110
- package/dist/core/types.js +13 -0
- package/dist/factories/providerFactory.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/lib/config/configManager.js +5 -2
- package/dist/lib/config/conversationMemoryConfig.js +5 -0
- package/dist/lib/core/analytics.d.ts +2 -24
- package/dist/lib/core/analytics.js +12 -17
- package/dist/lib/core/baseProvider.d.ts +30 -1
- package/dist/lib/core/baseProvider.js +180 -198
- package/dist/lib/core/conversationMemoryManager.d.ts +9 -15
- package/dist/lib/core/conversationMemoryManager.js +98 -57
- package/dist/lib/core/dynamicModels.js +7 -7
- package/dist/lib/core/evaluation.d.ts +9 -9
- package/dist/lib/core/evaluation.js +117 -65
- package/dist/lib/core/evaluationProviders.d.ts +18 -2
- package/dist/lib/core/evaluationProviders.js +15 -13
- package/dist/lib/core/modelConfiguration.d.ts +63 -0
- package/dist/lib/core/modelConfiguration.js +354 -290
- package/dist/lib/core/streamAnalytics.d.ts +10 -5
- package/dist/lib/core/streamAnalytics.js +10 -10
- package/dist/lib/core/types.d.ts +22 -110
- package/dist/lib/core/types.js +13 -0
- package/dist/lib/factories/providerFactory.js +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/mcp/externalServerManager.js +15 -6
- package/dist/lib/mcp/factory.js +1 -1
- package/dist/lib/mcp/index.d.ts +1 -1
- package/dist/lib/mcp/index.js +1 -1
- package/dist/lib/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/lib/mcp/mcpClientFactory.js +3 -0
- package/dist/lib/mcp/registry.d.ts +3 -3
- package/dist/lib/mcp/registry.js +3 -3
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/lib/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/lib/mcp/toolDiscoveryService.js +8 -2
- package/dist/lib/mcp/toolRegistry.js +4 -4
- package/dist/lib/middleware/builtin/analytics.js +4 -4
- package/dist/lib/middleware/builtin/guardrails.js +2 -2
- package/dist/lib/middleware/registry.js +11 -2
- package/dist/lib/models/modelRegistry.d.ts +1 -1
- package/dist/lib/models/modelRegistry.js +3 -3
- package/dist/lib/models/modelResolver.d.ts +1 -1
- package/dist/lib/models/modelResolver.js +2 -2
- package/dist/lib/neurolink.d.ts +116 -9
- package/dist/lib/neurolink.js +718 -956
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
- package/dist/lib/providers/amazonSagemaker.js +12 -3
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +7 -6
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +4 -3
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/azureOpenai.js +1 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +2 -2
- package/dist/lib/providers/googleVertex.d.ts +40 -0
- package/dist/lib/providers/googleVertex.js +330 -274
- package/dist/lib/providers/huggingFace.js +1 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +2 -2
- package/dist/lib/providers/ollama.d.ts +4 -0
- package/dist/lib/providers/ollama.js +38 -18
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +2 -2
- package/dist/lib/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/lib/providers/sagemaker/client.js +13 -3
- package/dist/lib/providers/sagemaker/config.js +5 -1
- package/dist/lib/providers/sagemaker/detection.js +19 -9
- package/dist/lib/providers/sagemaker/errors.d.ts +8 -1
- package/dist/lib/providers/sagemaker/errors.js +103 -20
- package/dist/lib/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/lib/providers/sagemaker/language-model.js +4 -4
- package/dist/lib/providers/sagemaker/parsers.js +14 -6
- package/dist/lib/providers/sagemaker/streaming.js +14 -3
- package/dist/lib/providers/sagemaker/types.d.ts +1 -1
- package/dist/lib/proxy/awsProxyIntegration.js +1 -1
- package/dist/lib/sdk/toolRegistration.d.ts +1 -1
- package/dist/lib/types/cli.d.ts +80 -8
- package/dist/lib/types/contextTypes.js +2 -2
- package/dist/lib/types/conversationTypes.d.ts +10 -0
- package/dist/lib/types/generateTypes.d.ts +2 -5
- package/dist/lib/types/providers.d.ts +81 -19
- package/dist/lib/types/providers.js +6 -6
- package/dist/lib/types/streamTypes.d.ts +4 -6
- package/dist/lib/types/typeAliases.d.ts +1 -1
- package/dist/lib/utils/analyticsUtils.d.ts +33 -0
- package/dist/lib/utils/analyticsUtils.js +76 -0
- package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -2
- package/dist/lib/utils/conversationMemoryUtils.js +6 -7
- package/dist/lib/utils/errorHandling.js +4 -1
- package/dist/lib/utils/evaluationUtils.d.ts +27 -0
- package/dist/lib/utils/evaluationUtils.js +131 -0
- package/dist/lib/utils/optionsUtils.js +10 -1
- package/dist/lib/utils/performance.d.ts +1 -1
- package/dist/lib/utils/performance.js +15 -3
- package/dist/lib/utils/providerHealth.d.ts +48 -0
- package/dist/lib/utils/providerHealth.js +199 -254
- package/dist/lib/utils/providerUtils.js +2 -2
- package/dist/lib/utils/timeout.js +8 -3
- package/dist/mcp/externalServerManager.js +15 -6
- package/dist/mcp/factory.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/mcp/mcpClientFactory.js +3 -0
- package/dist/mcp/registry.d.ts +3 -3
- package/dist/mcp/registry.js +3 -3
- package/dist/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/mcp/toolDiscoveryService.js +8 -2
- package/dist/mcp/toolRegistry.js +4 -4
- package/dist/middleware/builtin/analytics.js +4 -4
- package/dist/middleware/builtin/guardrails.js +2 -2
- package/dist/middleware/registry.js +11 -2
- package/dist/models/modelRegistry.d.ts +1 -1
- package/dist/models/modelRegistry.js +3 -3
- package/dist/models/modelResolver.d.ts +1 -1
- package/dist/models/modelResolver.js +2 -2
- package/dist/neurolink.d.ts +116 -9
- package/dist/neurolink.js +718 -956
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/amazonSagemaker.js +12 -3
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +7 -6
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +4 -3
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/azureOpenai.js +1 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleAiStudio.js +2 -2
- package/dist/providers/googleVertex.d.ts +40 -0
- package/dist/providers/googleVertex.js +330 -274
- package/dist/providers/huggingFace.js +1 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +2 -2
- package/dist/providers/ollama.d.ts +4 -0
- package/dist/providers/ollama.js +38 -18
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +2 -2
- package/dist/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/providers/sagemaker/client.js +13 -3
- package/dist/providers/sagemaker/config.js +5 -1
- package/dist/providers/sagemaker/detection.js +19 -9
- package/dist/providers/sagemaker/errors.d.ts +8 -1
- package/dist/providers/sagemaker/errors.js +103 -20
- package/dist/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/providers/sagemaker/language-model.js +4 -4
- package/dist/providers/sagemaker/parsers.js +14 -6
- package/dist/providers/sagemaker/streaming.js +14 -3
- package/dist/providers/sagemaker/types.d.ts +1 -1
- package/dist/proxy/awsProxyIntegration.js +1 -1
- package/dist/sdk/toolRegistration.d.ts +1 -1
- package/dist/types/cli.d.ts +80 -8
- package/dist/types/contextTypes.js +2 -2
- package/dist/types/conversationTypes.d.ts +10 -0
- package/dist/types/generateTypes.d.ts +2 -5
- package/dist/types/providers.d.ts +81 -19
- package/dist/types/providers.js +6 -6
- package/dist/types/streamTypes.d.ts +4 -6
- package/dist/types/typeAliases.d.ts +1 -1
- package/dist/utils/analyticsUtils.d.ts +33 -0
- package/dist/utils/analyticsUtils.js +76 -0
- package/dist/utils/conversationMemoryUtils.d.ts +1 -2
- package/dist/utils/conversationMemoryUtils.js +6 -7
- package/dist/utils/errorHandling.js +4 -1
- package/dist/utils/evaluationUtils.d.ts +27 -0
- package/dist/utils/evaluationUtils.js +131 -0
- package/dist/utils/optionsUtils.js +10 -1
- package/dist/utils/performance.d.ts +1 -1
- package/dist/utils/performance.js +15 -3
- package/dist/utils/providerHealth.d.ts +48 -0
- package/dist/utils/providerHealth.js +199 -254
- package/dist/utils/providerUtils.js +2 -2
- package/dist/utils/timeout.js +8 -3
- package/package.json +1 -1
- package/dist/context/ContextManager.d.ts +0 -28
- package/dist/context/ContextManager.js +0 -113
- package/dist/context/config.d.ts +0 -5
- package/dist/context/config.js +0 -42
- package/dist/context/types.d.ts +0 -20
- package/dist/context/types.js +0 -1
- package/dist/context/utils.d.ts +0 -7
- package/dist/context/utils.js +0 -8
- package/dist/lib/context/ContextManager.d.ts +0 -28
- package/dist/lib/context/ContextManager.js +0 -113
- package/dist/lib/context/config.d.ts +0 -5
- package/dist/lib/context/config.js +0 -42
- package/dist/lib/context/types.d.ts +0 -20
- package/dist/lib/context/types.js +0 -1
- package/dist/lib/context/utils.d.ts +0 -7
- package/dist/lib/context/utils.js +0 -8
|
@@ -20,7 +20,7 @@ export declare class AmazonSageMakerProvider extends BaseProvider {
|
|
|
20
20
|
protected getProviderName(): AIProviderName;
|
|
21
21
|
protected getDefaultModel(): string;
|
|
22
22
|
protected getAISDKModel(): LanguageModelV1;
|
|
23
|
-
protected executeStream(
|
|
23
|
+
protected executeStream(_options: StreamOptions, _analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
|
|
24
24
|
protected handleProviderError(error: unknown): Error;
|
|
25
25
|
/**
|
|
26
26
|
* Get SageMaker-specific provider information
|
|
@@ -50,10 +50,14 @@ export class AmazonSageMakerProvider extends BaseProvider {
|
|
|
50
50
|
getAISDKModel() {
|
|
51
51
|
return this.sagemakerModel;
|
|
52
52
|
}
|
|
53
|
-
async executeStream(
|
|
53
|
+
async executeStream(_options, _analysisSchema) {
|
|
54
54
|
try {
|
|
55
55
|
// For now, throw an error indicating this is not yet implemented
|
|
56
|
-
throw new SageMakerError("SageMaker streaming not yet fully implemented. Coming in next phase.",
|
|
56
|
+
throw new SageMakerError("SageMaker streaming not yet fully implemented. Coming in next phase.", {
|
|
57
|
+
code: "MODEL_ERROR",
|
|
58
|
+
statusCode: 501,
|
|
59
|
+
endpoint: this.modelConfig.endpointName,
|
|
60
|
+
});
|
|
57
61
|
}
|
|
58
62
|
catch (error) {
|
|
59
63
|
throw this.handleProviderError(error);
|
|
@@ -64,7 +68,12 @@ export class AmazonSageMakerProvider extends BaseProvider {
|
|
|
64
68
|
return error;
|
|
65
69
|
}
|
|
66
70
|
if (error instanceof Error && error.name === "TimeoutError") {
|
|
67
|
-
return new SageMakerError(`SageMaker request timed out. Consider increasing timeout.`,
|
|
71
|
+
return new SageMakerError(`SageMaker request timed out. Consider increasing timeout.`, {
|
|
72
|
+
code: "NETWORK_ERROR",
|
|
73
|
+
statusCode: 408,
|
|
74
|
+
cause: error,
|
|
75
|
+
endpoint: this.modelConfig.endpointName,
|
|
76
|
+
});
|
|
68
77
|
}
|
|
69
78
|
return handleSageMakerError(error, this.modelConfig.endpointName);
|
|
70
79
|
}
|
|
@@ -17,7 +17,7 @@ export declare class AnthropicProvider extends BaseProvider {
|
|
|
17
17
|
*/
|
|
18
18
|
protected getAISDKModel(): LanguageModelV1;
|
|
19
19
|
protected handleProviderError(error: unknown): Error;
|
|
20
|
-
protected executeStream(options: StreamOptions,
|
|
20
|
+
protected executeStream(options: StreamOptions, _analysisSchema?: ValidationSchema): Promise<StreamResult>;
|
|
21
21
|
isAvailable(): Promise<boolean>;
|
|
22
22
|
getModel(): LanguageModelV1;
|
|
23
23
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
+
import { AnthropicModels } from "../core/types.js";
|
|
3
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
5
|
import { logger } from "../utils/logger.js";
|
|
5
|
-
import { createTimeoutController, TimeoutError
|
|
6
|
+
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
6
7
|
import { AuthenticationError, NetworkError, ProviderError, RateLimitError, } from "../types/errors.js";
|
|
7
8
|
import { DEFAULT_MAX_TOKENS, DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
8
9
|
import { validateApiKey, createAnthropicConfig, getProviderModel, } from "../utils/providerConfig.js";
|
|
@@ -13,7 +14,7 @@ const getAnthropicApiKey = () => {
|
|
|
13
14
|
return validateApiKey(createAnthropicConfig());
|
|
14
15
|
};
|
|
15
16
|
const getDefaultAnthropicModel = () => {
|
|
16
|
-
return getProviderModel("ANTHROPIC_MODEL",
|
|
17
|
+
return getProviderModel("ANTHROPIC_MODEL", AnthropicModels.CLAUDE_3_5_SONNET);
|
|
17
18
|
};
|
|
18
19
|
/**
|
|
19
20
|
* Anthropic Provider v2 - BaseProvider Implementation
|
|
@@ -83,7 +84,7 @@ export class AnthropicProvider extends BaseProvider {
|
|
|
83
84
|
throw new ProviderError(`Anthropic error: ${message}`, this.providerName);
|
|
84
85
|
}
|
|
85
86
|
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
86
|
-
async executeStream(options,
|
|
87
|
+
async executeStream(options, _analysisSchema) {
|
|
87
88
|
this.validateStreamOptions(options);
|
|
88
89
|
const timeout = this.getTimeout(options);
|
|
89
90
|
const timeoutController = createTimeoutController(timeout, this.providerName, "stream");
|
|
@@ -120,9 +121,9 @@ export class AnthropicProvider extends BaseProvider {
|
|
|
120
121
|
toolResults, // ✅ Include tool results in stream result
|
|
121
122
|
usage: usage
|
|
122
123
|
? {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
input: usage.promptTokens || 0,
|
|
125
|
+
output: usage.completionTokens || 0,
|
|
126
|
+
total: usage.totalTokens || 0,
|
|
126
127
|
}
|
|
127
128
|
: undefined,
|
|
128
129
|
finishReason: finishReason || undefined,
|
|
@@ -18,6 +18,6 @@ export declare class AnthropicProviderV2 extends BaseProvider {
|
|
|
18
18
|
protected getAISDKModel(): LanguageModelV1;
|
|
19
19
|
protected handleProviderError(error: unknown): Error;
|
|
20
20
|
private getApiKey;
|
|
21
|
-
protected executeStream(options: StreamOptions,
|
|
21
|
+
protected executeStream(options: StreamOptions, _analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
|
|
22
22
|
}
|
|
23
23
|
export default AnthropicProviderV2;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
+
import { AnthropicModels } from "../core/types.js";
|
|
3
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
5
|
import { logger } from "../utils/logger.js";
|
|
5
|
-
import { createTimeoutController, TimeoutError
|
|
6
|
+
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
6
7
|
import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
|
|
7
8
|
import { validateApiKey, createAnthropicBaseConfig, } from "../utils/providerConfig.js";
|
|
8
9
|
/**
|
|
@@ -25,7 +26,7 @@ export class AnthropicProviderV2 extends BaseProvider {
|
|
|
25
26
|
return "anthropic";
|
|
26
27
|
}
|
|
27
28
|
getDefaultModel() {
|
|
28
|
-
return process.env.ANTHROPIC_MODEL ||
|
|
29
|
+
return process.env.ANTHROPIC_MODEL || AnthropicModels.CLAUDE_3_5_SONNET;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* Returns the Vercel AI SDK model instance for Anthropic
|
|
@@ -56,7 +57,7 @@ export class AnthropicProviderV2 extends BaseProvider {
|
|
|
56
57
|
return validateApiKey(createAnthropicBaseConfig());
|
|
57
58
|
}
|
|
58
59
|
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
59
|
-
async executeStream(options,
|
|
60
|
+
async executeStream(options, _analysisSchema) {
|
|
60
61
|
// Note: StreamOptions validation handled differently than TextGenerationOptions
|
|
61
62
|
const apiKey = this.getApiKey();
|
|
62
63
|
const anthropicClient = createAnthropic({ apiKey });
|
|
@@ -16,6 +16,6 @@ export declare class AzureOpenAIProvider extends BaseProvider {
|
|
|
16
16
|
*/
|
|
17
17
|
protected getAISDKModel(): LanguageModelV1;
|
|
18
18
|
protected handleProviderError(error: unknown): Error;
|
|
19
|
-
protected executeStream(options: StreamOptions,
|
|
19
|
+
protected executeStream(options: StreamOptions, _analysisSchema?: unknown): Promise<StreamResult>;
|
|
20
20
|
}
|
|
21
21
|
export default AzureOpenAIProvider;
|
|
@@ -70,7 +70,7 @@ export class AzureOpenAIProvider extends BaseProvider {
|
|
|
70
70
|
return new Error(`Azure OpenAI error: ${message}`);
|
|
71
71
|
}
|
|
72
72
|
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
73
|
-
async executeStream(options,
|
|
73
|
+
async executeStream(options, _analysisSchema) {
|
|
74
74
|
try {
|
|
75
75
|
// Build message array from options
|
|
76
76
|
const messages = buildMessagesArray(options);
|
|
@@ -16,7 +16,7 @@ export declare class GoogleAIStudioProvider extends BaseProvider {
|
|
|
16
16
|
*/
|
|
17
17
|
protected getAISDKModel(): LanguageModelV1;
|
|
18
18
|
protected handleProviderError(error: unknown): Error;
|
|
19
|
-
protected executeStream(options: StreamOptions,
|
|
19
|
+
protected executeStream(options: StreamOptions, _analysisSchema?: ZodUnknownSchema | Schema<unknown>): Promise<StreamResult>;
|
|
20
20
|
private getApiKey;
|
|
21
21
|
}
|
|
22
22
|
export default GoogleAIStudioProvider;
|
|
@@ -3,7 +3,7 @@ import { streamText } from "ai";
|
|
|
3
3
|
import { GoogleAIModels } from "../core/types.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
|
-
import { createTimeoutController, TimeoutError
|
|
6
|
+
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
7
7
|
import { AuthenticationError, NetworkError, ProviderError, RateLimitError, } from "../types/errors.js";
|
|
8
8
|
import { DEFAULT_MAX_TOKENS, DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
9
9
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -60,7 +60,7 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
60
60
|
throw new ProviderError(`Google AI error: ${message}`, this.providerName);
|
|
61
61
|
}
|
|
62
62
|
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
63
|
-
async executeStream(options,
|
|
63
|
+
async executeStream(options, _analysisSchema) {
|
|
64
64
|
this.validateStreamOptions(options);
|
|
65
65
|
const startTime = Date.now();
|
|
66
66
|
const apiKey = this.getApiKey();
|
|
@@ -33,12 +33,52 @@ export declare class GoogleVertexProvider extends BaseProvider {
|
|
|
33
33
|
* Creates fresh model instances for each request
|
|
34
34
|
*/
|
|
35
35
|
protected getAISDKModel(): Promise<LanguageModel>;
|
|
36
|
+
/**
|
|
37
|
+
* Initialize model creation logging and tracking
|
|
38
|
+
*/
|
|
39
|
+
private initializeModelCreationLogging;
|
|
40
|
+
/**
|
|
41
|
+
* Check if model is Anthropic-based and attempt creation
|
|
42
|
+
*/
|
|
43
|
+
private attemptAnthropicModelCreation;
|
|
44
|
+
/**
|
|
45
|
+
* Create Google Vertex model with comprehensive logging and error handling
|
|
46
|
+
*/
|
|
47
|
+
private createGoogleVertexModel;
|
|
48
|
+
/**
|
|
49
|
+
* Create Vertex AI instance and model with comprehensive logging
|
|
50
|
+
*/
|
|
51
|
+
private createVertexInstance;
|
|
36
52
|
/**
|
|
37
53
|
* Gets the appropriate model instance (Google or Anthropic)
|
|
38
54
|
* Uses dual provider architecture for proper model routing
|
|
39
55
|
* Creates fresh instances for each request to ensure proper authentication
|
|
40
56
|
*/
|
|
41
57
|
private getModel;
|
|
58
|
+
/**
|
|
59
|
+
* Log stream execution start with comprehensive analysis
|
|
60
|
+
*/
|
|
61
|
+
private logStreamExecutionStart;
|
|
62
|
+
/**
|
|
63
|
+
* Log timeout setup process
|
|
64
|
+
*/
|
|
65
|
+
private logTimeoutSetup;
|
|
66
|
+
/**
|
|
67
|
+
* Log successful timeout setup
|
|
68
|
+
*/
|
|
69
|
+
private logTimeoutSetupSuccess;
|
|
70
|
+
/**
|
|
71
|
+
* Log and perform stream options validation
|
|
72
|
+
*/
|
|
73
|
+
private logAndValidateStreamOptions;
|
|
74
|
+
/**
|
|
75
|
+
* Log start of message building process
|
|
76
|
+
*/
|
|
77
|
+
private logMessageBuildStart;
|
|
78
|
+
/**
|
|
79
|
+
* Log successful message building
|
|
80
|
+
*/
|
|
81
|
+
private logMessageBuildSuccess;
|
|
42
82
|
protected executeStream(options: StreamOptions, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
|
|
43
83
|
protected handleProviderError(error: unknown): Error;
|
|
44
84
|
/**
|