@juspay/neurolink 7.53.1 → 7.53.3
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 +4 -0
- package/dist/agent/directTools.d.ts +3 -3
- package/dist/cli/commands/config.d.ts +62 -62
- package/dist/cli/commands/setup-google-ai.js +1 -1
- package/dist/cli/loop/optionsSchema.d.ts +1 -8
- package/dist/cli/loop/optionsSchema.js +1 -1
- package/dist/cli/utils/envManager.d.ts +1 -11
- package/dist/cli/utils/interactiveSetup.d.ts +1 -1
- package/dist/cli/utils/interactiveSetup.js +1 -1
- package/dist/constants/enums.d.ts +108 -0
- package/dist/constants/enums.js +138 -0
- package/dist/core/baseProvider.d.ts +2 -1
- package/dist/core/baseProvider.js +1 -0
- package/dist/core/factory.d.ts +2 -1
- package/dist/core/factory.js +1 -0
- package/dist/factories/providerFactory.d.ts +2 -1
- package/dist/factories/providerFactory.js +1 -0
- package/dist/factories/providerRegistry.d.ts +1 -10
- package/dist/factories/providerRegistry.js +1 -4
- package/dist/hitl/hitlManager.d.ts +1 -1
- package/dist/hitl/index.d.ts +0 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +3 -1
- package/dist/lib/constants/enums.d.ts +108 -0
- package/dist/lib/constants/enums.js +139 -0
- package/dist/lib/core/baseProvider.d.ts +2 -1
- package/dist/lib/core/baseProvider.js +1 -0
- package/dist/lib/core/factory.d.ts +2 -1
- package/dist/lib/core/factory.js +1 -0
- package/dist/lib/factories/providerFactory.d.ts +2 -1
- package/dist/lib/factories/providerFactory.js +1 -0
- package/dist/lib/factories/providerRegistry.d.ts +1 -10
- package/dist/lib/factories/providerRegistry.js +1 -4
- package/dist/lib/hitl/hitlManager.d.ts +1 -1
- package/dist/lib/hitl/index.d.ts +0 -1
- package/dist/lib/index.d.ts +7 -4
- package/dist/lib/index.js +3 -1
- package/dist/lib/mcp/index.d.ts +1 -4
- package/dist/lib/mcp/index.js +0 -6
- package/dist/lib/memory/mem0Initializer.d.ts +1 -35
- package/dist/lib/middleware/builtin/guardrails.d.ts +0 -1
- package/dist/lib/middleware/utils/guardrailsUtils.d.ts +1 -14
- package/dist/lib/models/modelRegistry.d.ts +2 -90
- package/dist/lib/models/modelRegistry.js +2 -1
- package/dist/lib/models/modelResolver.d.ts +1 -41
- package/dist/lib/models/modelResolver.js +0 -1
- package/dist/lib/neurolink.d.ts +4 -40
- package/dist/lib/neurolink.js +3 -3
- package/dist/lib/providers/amazonBedrock.d.ts +2 -1
- package/dist/lib/providers/amazonBedrock.js +1 -0
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
- package/dist/lib/providers/amazonSagemaker.js +1 -0
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +1 -1
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +1 -1
- 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 +1 -1
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +1 -0
- package/dist/lib/providers/huggingFace.d.ts +1 -1
- package/dist/lib/providers/huggingFace.js +1 -0
- package/dist/lib/providers/index.d.ts +0 -1
- package/dist/lib/providers/litellm.d.ts +1 -1
- package/dist/lib/providers/litellm.js +1 -0
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +1 -0
- package/dist/lib/providers/ollama.d.ts +1 -1
- package/dist/lib/providers/ollama.js +1 -0
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +1 -1
- package/dist/lib/providers/openaiCompatible.d.ts +1 -1
- package/dist/lib/providers/openaiCompatible.js +1 -0
- package/dist/lib/proxy/proxyFetch.js +2 -0
- package/dist/lib/session/globalSessionState.js +1 -26
- package/dist/lib/types/analytics.d.ts +13 -0
- package/dist/lib/types/cli.d.ts +253 -0
- package/dist/lib/types/configTypes.d.ts +14 -0
- package/dist/lib/types/configTypes.js +1 -0
- package/dist/lib/types/fileTypes.d.ts +4 -4
- package/dist/lib/types/generateTypes.d.ts +1 -1
- package/dist/lib/types/generateTypes.js +1 -1
- package/dist/lib/types/guardrails.d.ts +13 -0
- package/dist/{hitl/types.d.ts → lib/types/hitlTypes.d.ts} +18 -18
- package/dist/lib/{hitl/types.js → types/hitlTypes.js} +1 -1
- package/dist/lib/types/index.d.ts +3 -1
- package/dist/lib/types/index.js +4 -0
- package/dist/lib/types/mcpTypes.d.ts +16 -12
- package/dist/lib/types/modelTypes.d.ts +113 -25
- package/dist/lib/types/modelTypes.js +1 -0
- package/dist/lib/types/observability.d.ts +6 -6
- package/dist/lib/types/providers.d.ts +43 -93
- package/dist/lib/types/providers.js +1 -118
- package/dist/lib/types/sdkTypes.d.ts +1 -1
- package/dist/lib/types/streamTypes.d.ts +2 -1
- package/dist/lib/types/streamTypes.js +1 -1
- package/dist/lib/types/taskClassificationTypes.d.ts +8 -8
- package/dist/lib/types/universalProviderOptions.d.ts +12 -12
- package/dist/lib/types/utilities.d.ts +48 -0
- package/dist/lib/utils/errorHandling.d.ts +2 -2
- package/dist/lib/utils/modelRouter.d.ts +4 -4
- package/dist/lib/utils/observabilityHelpers.d.ts +27 -0
- package/dist/lib/utils/observabilityHelpers.js +48 -0
- package/dist/lib/utils/providerHealth.d.ts +5 -23
- package/dist/lib/utils/providerHealth.js +1 -1
- package/dist/lib/utils/providerSetupMessages.js +1 -1
- package/dist/lib/utils/providerUtils.js +1 -0
- package/dist/mcp/index.d.ts +1 -4
- package/dist/mcp/index.js +0 -6
- package/dist/memory/mem0Initializer.d.ts +1 -35
- package/dist/middleware/builtin/guardrails.d.ts +0 -1
- package/dist/middleware/utils/guardrailsUtils.d.ts +1 -14
- package/dist/models/modelRegistry.d.ts +2 -90
- package/dist/models/modelRegistry.js +2 -1
- package/dist/models/modelResolver.d.ts +1 -41
- package/dist/models/modelResolver.js +0 -1
- package/dist/neurolink.d.ts +4 -40
- package/dist/neurolink.js +3 -3
- package/dist/providers/amazonBedrock.d.ts +2 -1
- package/dist/providers/amazonBedrock.js +1 -0
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/amazonSagemaker.js +1 -0
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +1 -1
- 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 +1 -1
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/googleVertex.js +1 -0
- package/dist/providers/huggingFace.d.ts +1 -1
- package/dist/providers/huggingFace.js +1 -0
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/litellm.d.ts +1 -1
- package/dist/providers/litellm.js +1 -0
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +1 -0
- package/dist/providers/ollama.d.ts +1 -1
- package/dist/providers/ollama.js +1 -0
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +1 -1
- package/dist/providers/openaiCompatible.d.ts +1 -1
- package/dist/providers/openaiCompatible.js +1 -0
- package/dist/proxy/proxyFetch.js +2 -0
- package/dist/session/globalSessionState.js +1 -26
- package/dist/types/analytics.d.ts +13 -0
- package/dist/types/cli.d.ts +253 -0
- package/dist/types/configTypes.d.ts +14 -0
- package/dist/types/configTypes.js +1 -0
- package/dist/types/fileTypes.d.ts +4 -4
- package/dist/types/generateTypes.d.ts +1 -1
- package/dist/types/generateTypes.js +1 -1
- package/dist/types/guardrails.d.ts +13 -0
- package/dist/{lib/hitl/types.d.ts → types/hitlTypes.d.ts} +18 -18
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.js +4 -0
- package/dist/types/mcpTypes.d.ts +16 -12
- package/dist/types/modelTypes.d.ts +113 -25
- package/dist/types/modelTypes.js +1 -0
- package/dist/types/observability.d.ts +6 -6
- package/dist/types/providers.d.ts +43 -93
- package/dist/types/providers.js +1 -118
- package/dist/types/sdkTypes.d.ts +1 -1
- package/dist/types/streamTypes.d.ts +2 -1
- package/dist/types/streamTypes.js +1 -1
- package/dist/types/taskClassificationTypes.d.ts +8 -8
- package/dist/types/universalProviderOptions.d.ts +12 -12
- package/dist/types/utilities.d.ts +48 -0
- package/dist/utils/errorHandling.d.ts +2 -2
- package/dist/utils/modelRouter.d.ts +4 -4
- package/dist/utils/observabilityHelpers.d.ts +27 -0
- package/dist/utils/observabilityHelpers.js +47 -0
- package/dist/utils/providerHealth.d.ts +5 -23
- package/dist/utils/providerHealth.js +1 -1
- package/dist/utils/providerSetupMessages.js +1 -1
- package/dist/utils/providerUtils.js +1 -0
- package/package.json +1 -1
- /package/dist/{hitl/types.js → types/hitlTypes.js} +0 -0
package/dist/types/providers.js
CHANGED
|
@@ -1,124 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider-specific type definitions for NeuroLink
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
|
-
// ENUMS
|
|
6
|
-
// ============================================================================
|
|
7
|
-
/**
|
|
8
|
-
* Supported AI Provider Names
|
|
9
|
-
*/
|
|
10
|
-
export var AIProviderName;
|
|
11
|
-
(function (AIProviderName) {
|
|
12
|
-
AIProviderName["BEDROCK"] = "bedrock";
|
|
13
|
-
AIProviderName["OPENAI"] = "openai";
|
|
14
|
-
AIProviderName["OPENAI_COMPATIBLE"] = "openai-compatible";
|
|
15
|
-
AIProviderName["VERTEX"] = "vertex";
|
|
16
|
-
AIProviderName["ANTHROPIC"] = "anthropic";
|
|
17
|
-
AIProviderName["AZURE"] = "azure";
|
|
18
|
-
AIProviderName["GOOGLE_AI"] = "google-ai";
|
|
19
|
-
AIProviderName["HUGGINGFACE"] = "huggingface";
|
|
20
|
-
AIProviderName["OLLAMA"] = "ollama";
|
|
21
|
-
AIProviderName["MISTRAL"] = "mistral";
|
|
22
|
-
AIProviderName["LITELLM"] = "litellm";
|
|
23
|
-
AIProviderName["SAGEMAKER"] = "sagemaker";
|
|
24
|
-
AIProviderName["AUTO"] = "auto";
|
|
25
|
-
})(AIProviderName || (AIProviderName = {}));
|
|
26
|
-
/**
|
|
27
|
-
* Supported Models for Amazon Bedrock
|
|
28
|
-
*/
|
|
29
|
-
export var BedrockModels;
|
|
30
|
-
(function (BedrockModels) {
|
|
31
|
-
BedrockModels["CLAUDE_3_SONNET"] = "anthropic.claude-3-sonnet-20240229-v1:0";
|
|
32
|
-
BedrockModels["CLAUDE_3_HAIKU"] = "anthropic.claude-3-haiku-20240307-v1:0";
|
|
33
|
-
BedrockModels["CLAUDE_3_5_SONNET"] = "anthropic.claude-3-5-sonnet-20240620-v1:0";
|
|
34
|
-
BedrockModels["CLAUDE_3_7_SONNET"] = "arn:aws:bedrock:us-east-2:225681119357:inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0";
|
|
35
|
-
})(BedrockModels || (BedrockModels = {}));
|
|
36
|
-
/**
|
|
37
|
-
* Supported Models for OpenAI
|
|
38
|
-
*/
|
|
39
|
-
export var OpenAIModels;
|
|
40
|
-
(function (OpenAIModels) {
|
|
41
|
-
OpenAIModels["GPT_4"] = "gpt-4";
|
|
42
|
-
OpenAIModels["GPT_4_TURBO"] = "gpt-4-turbo";
|
|
43
|
-
OpenAIModels["GPT_4O"] = "gpt-4o";
|
|
44
|
-
OpenAIModels["GPT_4O_MINI"] = "gpt-4o-mini";
|
|
45
|
-
OpenAIModels["GPT_3_5_TURBO"] = "gpt-3.5-turbo";
|
|
46
|
-
OpenAIModels["O1_PREVIEW"] = "o1-preview";
|
|
47
|
-
OpenAIModels["O1_MINI"] = "o1-mini";
|
|
48
|
-
})(OpenAIModels || (OpenAIModels = {}));
|
|
49
|
-
/**
|
|
50
|
-
* Supported Models for Google Vertex AI
|
|
51
|
-
*/
|
|
52
|
-
export var VertexModels;
|
|
53
|
-
(function (VertexModels) {
|
|
54
|
-
// Claude 4 Series (Latest - May 2025)
|
|
55
|
-
VertexModels["CLAUDE_4_0_SONNET"] = "claude-sonnet-4@20250514";
|
|
56
|
-
VertexModels["CLAUDE_4_0_OPUS"] = "claude-opus-4@20250514";
|
|
57
|
-
// Claude 3.5 Series (Still supported)
|
|
58
|
-
VertexModels["CLAUDE_3_5_SONNET"] = "claude-3-5-sonnet-20241022";
|
|
59
|
-
VertexModels["CLAUDE_3_5_HAIKU"] = "claude-3-5-haiku-20241022";
|
|
60
|
-
// Claude 3 Series (Legacy support)
|
|
61
|
-
VertexModels["CLAUDE_3_SONNET"] = "claude-3-sonnet-20240229";
|
|
62
|
-
VertexModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
|
|
63
|
-
VertexModels["CLAUDE_3_HAIKU"] = "claude-3-haiku-20240307";
|
|
64
|
-
// Gemini 2.5 Series (Latest - 2025)
|
|
65
|
-
VertexModels["GEMINI_2_5_PRO"] = "gemini-2.5-pro";
|
|
66
|
-
VertexModels["GEMINI_2_5_FLASH"] = "gemini-2.5-flash";
|
|
67
|
-
VertexModels["GEMINI_2_5_FLASH_LITE"] = "gemini-2.5-flash-lite";
|
|
68
|
-
// Gemini 2.0 Series
|
|
69
|
-
VertexModels["GEMINI_2_0_FLASH_001"] = "gemini-2.0-flash-001";
|
|
70
|
-
// Gemini 1.5 Series (Legacy support)
|
|
71
|
-
VertexModels["GEMINI_1_5_PRO"] = "gemini-1.5-pro";
|
|
72
|
-
VertexModels["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
|
|
73
|
-
})(VertexModels || (VertexModels = {}));
|
|
74
|
-
/**
|
|
75
|
-
* Supported Models for Google AI Studio
|
|
76
|
-
*/
|
|
77
|
-
export var GoogleAIModels;
|
|
78
|
-
(function (GoogleAIModels) {
|
|
79
|
-
// Gemini 2.5 Series (Latest - 2025)
|
|
80
|
-
GoogleAIModels["GEMINI_2_5_PRO"] = "gemini-2.5-pro";
|
|
81
|
-
GoogleAIModels["GEMINI_2_5_FLASH"] = "gemini-2.5-flash";
|
|
82
|
-
GoogleAIModels["GEMINI_2_5_FLASH_LITE"] = "gemini-2.5-flash-lite";
|
|
83
|
-
// Gemini 2.0 Series
|
|
84
|
-
GoogleAIModels["GEMINI_2_0_FLASH_001"] = "gemini-2.0-flash-001";
|
|
85
|
-
// Gemini 1.5 Series (Legacy support)
|
|
86
|
-
GoogleAIModels["GEMINI_1_5_PRO"] = "gemini-1.5-pro";
|
|
87
|
-
GoogleAIModels["GEMINI_1_5_FLASH"] = "gemini-1.5-flash";
|
|
88
|
-
GoogleAIModels["GEMINI_1_5_FLASH_LITE"] = "gemini-1.5-flash-lite";
|
|
89
|
-
})(GoogleAIModels || (GoogleAIModels = {}));
|
|
90
|
-
/**
|
|
91
|
-
* Supported Models for Anthropic (Direct API)
|
|
92
|
-
*/
|
|
93
|
-
export var AnthropicModels;
|
|
94
|
-
(function (AnthropicModels) {
|
|
95
|
-
// Claude 3.5 Series (Latest)
|
|
96
|
-
AnthropicModels["CLAUDE_3_5_SONNET"] = "claude-3-5-sonnet-20241022";
|
|
97
|
-
AnthropicModels["CLAUDE_3_5_HAIKU"] = "claude-3-5-haiku-20241022";
|
|
98
|
-
// Claude 3 Series (Legacy support)
|
|
99
|
-
AnthropicModels["CLAUDE_3_SONNET"] = "claude-3-sonnet-20240229";
|
|
100
|
-
AnthropicModels["CLAUDE_3_OPUS"] = "claude-3-opus-20240229";
|
|
101
|
-
AnthropicModels["CLAUDE_3_HAIKU"] = "claude-3-haiku-20240307";
|
|
102
|
-
})(AnthropicModels || (AnthropicModels = {}));
|
|
103
|
-
/**
|
|
104
|
-
* API Versions for various providers
|
|
105
|
-
*/
|
|
106
|
-
export var APIVersions;
|
|
107
|
-
(function (APIVersions) {
|
|
108
|
-
// Azure OpenAI API versions
|
|
109
|
-
APIVersions["AZURE_LATEST"] = "2025-04-01-preview";
|
|
110
|
-
APIVersions["AZURE_STABLE"] = "2024-10-21";
|
|
111
|
-
APIVersions["AZURE_LEGACY"] = "2023-12-01-preview";
|
|
112
|
-
// OpenAI API versions
|
|
113
|
-
APIVersions["OPENAI_CURRENT"] = "v1";
|
|
114
|
-
APIVersions["OPENAI_BETA"] = "v1-beta";
|
|
115
|
-
// Google AI API versions
|
|
116
|
-
APIVersions["GOOGLE_AI_CURRENT"] = "v1";
|
|
117
|
-
APIVersions["GOOGLE_AI_BETA"] = "v1beta";
|
|
118
|
-
// Anthropic API versions
|
|
119
|
-
APIVersions["ANTHROPIC_CURRENT"] = "2023-06-01";
|
|
120
|
-
// Other provider versions can be added here
|
|
121
|
-
})(APIVersions || (APIVersions = {}));
|
|
4
|
+
import { AIProviderName, AnthropicModels, BedrockModels, GoogleAIModels, OpenAIModels, VertexModels, } from "../constants/enums.js";
|
|
122
5
|
/**
|
|
123
6
|
* Default model aliases for easy reference
|
|
124
7
|
*/
|
package/dist/types/sdkTypes.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ ToolCallResults, ToolCalls, StreamOptions, StreamingOptions, EnhancedStreamProvi
|
|
|
11
11
|
export type { TypedEventEmitter, NeuroLinkEvents, StreamEvent, AsyncFunction, SyncFunction, AnyFunction, } from "./common.js";
|
|
12
12
|
export type { NeuroLinkConfig, ProviderConfig, PerformanceConfig, CacheConfig, FallbackConfig, RetryConfig, AnalyticsConfig, ToolConfig, BackupInfo, BackupMetadata, ConfigValidationResult, ConfigUpdateOptions, } from "./configTypes.js";
|
|
13
13
|
export type { ToolArgs, ToolContext, ToolResult, ToolDefinition, SimpleTool, AvailableTool, ToolExecution, BaseToolArgs, ToolExecutionEvent, ToolExecutionSummary, ToolExecutionContext, ToolExecutionMetadata, ToolParameterSchema, ZodUnknownSchema, ZodAnySchema, ZodObjectSchema, ZodStringSchema, } from "./tools.js";
|
|
14
|
-
export type { AISDKModel, ProviderError, AIModelProviderConfig,
|
|
14
|
+
export type { AISDKModel, ProviderError, AIModelProviderConfig, ProviderName, ModelCapability, ModelUseCase, ModelFilter, ModelResolutionContext, ModelStats, ModelPricing, ProviderCapabilities, } from "./providers.js";
|
|
15
15
|
export type { GenerateOptions, GenerateResult, UnifiedGenerationOptions, EnhancedProvider, FactoryEnhancedProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, } from "./generateTypes.js";
|
|
16
16
|
export type { TokenUsage, AnalyticsData } from "./analytics.js";
|
|
17
17
|
export type { TextContent, ImageContent, Content, VisionCapability, ProviderImageFormat, ProcessedImage, MultimodalMessage, ProviderMultimodalPayload, } from "./content.js";
|
|
@@ -2,7 +2,8 @@ import type { Tool } from "ai";
|
|
|
2
2
|
import type { ValidationSchema, StandardRecord } from "./typeAliases.js";
|
|
3
3
|
import type { AIModelProviderConfig } from "./providers.js";
|
|
4
4
|
import type { TextContent, ImageContent } from "./content.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { AnalyticsData, ToolExecutionEvent, ToolExecutionSummary } from "../types/index.js";
|
|
6
|
+
import { AIProviderName } from "../constants/enums.js";
|
|
6
7
|
import type { TokenUsage } from "./analytics.js";
|
|
7
8
|
import type { EvaluationData } from "../index.js";
|
|
8
9
|
import type { UnknownRecord, JsonValue } from "./common.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import { AIProviderName } from "../constants/enums.js";
|
|
@@ -9,29 +9,29 @@ export type TaskType = "fast" | "reasoning";
|
|
|
9
9
|
/**
|
|
10
10
|
* Result of task classification analysis
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type TaskClassification = {
|
|
13
13
|
/** The classified task type */
|
|
14
14
|
type: TaskType;
|
|
15
15
|
/** Confidence score (0-1) in the classification */
|
|
16
16
|
confidence: number;
|
|
17
17
|
/** Human-readable explanation of the classification decision */
|
|
18
18
|
reasoning: string;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
/**
|
|
21
21
|
* Internal scoring data used during classification analysis
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type ClassificationScores = {
|
|
24
24
|
/** Score indicating likelihood of fast task */
|
|
25
25
|
fastScore: number;
|
|
26
26
|
/** Score indicating likelihood of reasoning task */
|
|
27
27
|
reasoningScore: number;
|
|
28
28
|
/** Array of reasons contributing to the scores */
|
|
29
29
|
reasons: string[];
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
/**
|
|
32
32
|
* Statistics for batch classification analysis
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type ClassificationStats = {
|
|
35
35
|
/** Total number of prompts analyzed */
|
|
36
36
|
total: number;
|
|
37
37
|
/** Number of prompts classified as fast */
|
|
@@ -40,13 +40,13 @@ export interface ClassificationStats {
|
|
|
40
40
|
reasoning: number;
|
|
41
41
|
/** Average confidence across all classifications */
|
|
42
42
|
averageConfidence: number;
|
|
43
|
-
}
|
|
43
|
+
};
|
|
44
44
|
/**
|
|
45
45
|
* Validation result for testing classification accuracy
|
|
46
46
|
*/
|
|
47
|
-
export
|
|
47
|
+
export type ClassificationValidation = {
|
|
48
48
|
/** Whether the classification matched the expected result */
|
|
49
49
|
correct: boolean;
|
|
50
50
|
/** The actual classification result */
|
|
51
51
|
classification: TaskClassification;
|
|
52
|
-
}
|
|
52
|
+
};
|
|
@@ -7,7 +7,7 @@ import type { BaseContext, ContextConfig } from "./contextTypes.js";
|
|
|
7
7
|
* Base configuration interface for all AI providers
|
|
8
8
|
* Uses Parameter Object Pattern for flexible, extensible configuration
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type UniversalProviderOptions = {
|
|
11
11
|
prompt?: string;
|
|
12
12
|
model?: string;
|
|
13
13
|
temperature?: number;
|
|
@@ -19,7 +19,7 @@ export interface UniversalProviderOptions {
|
|
|
19
19
|
contextConfig?: Partial<ContextConfig>;
|
|
20
20
|
metadata?: Record<string, unknown>;
|
|
21
21
|
extensionOptions?: Record<string, unknown>;
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
/**
|
|
24
24
|
* Generic provider options (without providerType)
|
|
25
25
|
*/
|
|
@@ -28,28 +28,28 @@ export type GenericProviderOptions = Omit<UniversalProviderOptions, "providerTyp
|
|
|
28
28
|
* Provider-specific configuration extensions
|
|
29
29
|
* Discriminated union pattern for type-safe provider configs
|
|
30
30
|
*/
|
|
31
|
-
export
|
|
31
|
+
export type OpenAIProviderOptions = UniversalProviderOptions & {
|
|
32
32
|
providerType: "openai";
|
|
33
33
|
organization?: string;
|
|
34
34
|
seed?: number;
|
|
35
35
|
topP?: number;
|
|
36
|
-
}
|
|
37
|
-
export
|
|
36
|
+
};
|
|
37
|
+
export type GoogleAIProviderOptions = UniversalProviderOptions & {
|
|
38
38
|
providerType: "google-ai";
|
|
39
39
|
topK?: number;
|
|
40
40
|
candidateCount?: number;
|
|
41
41
|
stopSequences?: string[];
|
|
42
|
-
}
|
|
43
|
-
export
|
|
42
|
+
};
|
|
43
|
+
export type AnthropicProviderOptions = UniversalProviderOptions & {
|
|
44
44
|
providerType: "anthropic";
|
|
45
45
|
topK?: number;
|
|
46
46
|
stopSequences?: string[];
|
|
47
|
-
}
|
|
48
|
-
export
|
|
47
|
+
};
|
|
48
|
+
export type BedrockProviderOptions = UniversalProviderOptions & {
|
|
49
49
|
providerType: "bedrock";
|
|
50
50
|
inferenceProfileArn?: string;
|
|
51
51
|
region?: string;
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
/**
|
|
54
54
|
* Discriminated union for type-safe provider configuration
|
|
55
55
|
* Enables compile-time type checking for provider-specific options
|
|
@@ -59,12 +59,12 @@ export type ProviderSpecificOptions = OpenAIProviderOptions | GoogleAIProviderOp
|
|
|
59
59
|
* Factory configuration interface
|
|
60
60
|
* Supports both universal and provider-specific parameters
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type ProviderFactoryConfig = {
|
|
63
63
|
providerName: string;
|
|
64
64
|
modelName?: string;
|
|
65
65
|
options?: UniversalProviderOptions | ProviderSpecificOptions;
|
|
66
66
|
enableMCP?: boolean;
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
68
|
/**
|
|
69
69
|
* Parameter normalization utilities
|
|
70
70
|
* Converts between different parameter formats for backward compatibility
|
|
@@ -27,3 +27,51 @@ export type APIValidationResult = {
|
|
|
27
27
|
errorType?: "missing" | "format" | "config";
|
|
28
28
|
error?: string;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Parsed proxy configuration
|
|
32
|
+
*/
|
|
33
|
+
export type ParsedProxyConfig = {
|
|
34
|
+
protocol: string;
|
|
35
|
+
hostname: string;
|
|
36
|
+
port: number;
|
|
37
|
+
auth?: {
|
|
38
|
+
username: string;
|
|
39
|
+
password: string;
|
|
40
|
+
};
|
|
41
|
+
cleanUrl: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Interface for mem0 Memory instance methods based on actual mem0ai/oss API
|
|
45
|
+
*/
|
|
46
|
+
export type Mem0Memory = {
|
|
47
|
+
search(query: string, config: {
|
|
48
|
+
userId?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
results: Array<{
|
|
52
|
+
memory: string;
|
|
53
|
+
id: string;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
56
|
+
add(messages: string, config: {
|
|
57
|
+
userId?: string;
|
|
58
|
+
metadata?: Record<string, unknown>;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
results: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
memory: string;
|
|
63
|
+
}>;
|
|
64
|
+
}>;
|
|
65
|
+
get(memoryId: string): Promise<{
|
|
66
|
+
id: string;
|
|
67
|
+
memory: string;
|
|
68
|
+
} | null>;
|
|
69
|
+
update(memoryId: string, data: string): Promise<{
|
|
70
|
+
message: string;
|
|
71
|
+
}>;
|
|
72
|
+
delete(memoryId: string): Promise<{
|
|
73
|
+
message: string;
|
|
74
|
+
}>;
|
|
75
|
+
history(memoryId: string): Promise<unknown[]>;
|
|
76
|
+
reset(): Promise<void>;
|
|
77
|
+
};
|
|
@@ -18,7 +18,7 @@ export declare enum ErrorSeverity {
|
|
|
18
18
|
HIGH = "high",
|
|
19
19
|
CRITICAL = "critical"
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export type StructuredError = {
|
|
22
22
|
code: string;
|
|
23
23
|
message: string;
|
|
24
24
|
category: ErrorCategory;
|
|
@@ -29,7 +29,7 @@ export interface StructuredError {
|
|
|
29
29
|
timestamp: Date;
|
|
30
30
|
toolName?: string;
|
|
31
31
|
serverId?: string;
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
export declare const ERROR_CODES: {
|
|
34
34
|
readonly TOOL_NOT_FOUND: "TOOL_NOT_FOUND";
|
|
35
35
|
readonly TOOL_EXECUTION_FAILED: "TOOL_EXECUTION_FAILED";
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
* Routes tasks to optimal models based on classification and requirements
|
|
4
4
|
*/
|
|
5
5
|
import type { TaskType } from "../types/taskClassificationTypes.js";
|
|
6
|
-
export
|
|
6
|
+
export type ModelRoute = {
|
|
7
7
|
provider: string;
|
|
8
8
|
model: string;
|
|
9
9
|
reasoning: string;
|
|
10
10
|
confidence: number;
|
|
11
|
-
}
|
|
12
|
-
export
|
|
11
|
+
};
|
|
12
|
+
export type ModelRoutingOptions = {
|
|
13
13
|
/** Override the task classification */
|
|
14
14
|
forceTaskType?: TaskType;
|
|
15
15
|
/** Require specific performance characteristics */
|
|
@@ -18,7 +18,7 @@ export interface ModelRoutingOptions {
|
|
|
18
18
|
requireCapability?: string;
|
|
19
19
|
/** Fallback strategy if primary choice fails */
|
|
20
20
|
fallbackStrategy?: "fast" | "reasoning" | "auto";
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
22
|
/**
|
|
23
23
|
* Model configurations for different task types and providers
|
|
24
24
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for building observability configs from environment variables
|
|
3
|
+
*/
|
|
4
|
+
import type { ObservabilityConfig } from "../types/observability.js";
|
|
5
|
+
/**
|
|
6
|
+
* Build observability config from environment variables
|
|
7
|
+
*
|
|
8
|
+
* Reads Langfuse configuration from environment:
|
|
9
|
+
* - LANGFUSE_ENABLED: Enable/disable Langfuse (must be "true")
|
|
10
|
+
* - LANGFUSE_PUBLIC_KEY: Your Langfuse public key (required)
|
|
11
|
+
* - LANGFUSE_SECRET_KEY: Your Langfuse secret key (required)
|
|
12
|
+
* - LANGFUSE_BASE_URL: Langfuse server URL (default: https://cloud.langfuse.com)
|
|
13
|
+
* - LANGFUSE_ENVIRONMENT: Environment name (default: dev)
|
|
14
|
+
* - PUBLIC_APP_VERSION: Release/version identifier (default: v1.0.0)
|
|
15
|
+
*
|
|
16
|
+
* @returns ObservabilityConfig if all required env vars are set, undefined otherwise
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* import { NeuroLink, buildObservabilityConfigFromEnv } from '@juspay/neurolink';
|
|
21
|
+
*
|
|
22
|
+
* const neurolink = new NeuroLink({
|
|
23
|
+
* observability: buildObservabilityConfigFromEnv()
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildObservabilityConfigFromEnv(): ObservabilityConfig | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for building observability configs from environment variables
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Build observability config from environment variables
|
|
6
|
+
*
|
|
7
|
+
* Reads Langfuse configuration from environment:
|
|
8
|
+
* - LANGFUSE_ENABLED: Enable/disable Langfuse (must be "true")
|
|
9
|
+
* - LANGFUSE_PUBLIC_KEY: Your Langfuse public key (required)
|
|
10
|
+
* - LANGFUSE_SECRET_KEY: Your Langfuse secret key (required)
|
|
11
|
+
* - LANGFUSE_BASE_URL: Langfuse server URL (default: https://cloud.langfuse.com)
|
|
12
|
+
* - LANGFUSE_ENVIRONMENT: Environment name (default: dev)
|
|
13
|
+
* - PUBLIC_APP_VERSION: Release/version identifier (default: v1.0.0)
|
|
14
|
+
*
|
|
15
|
+
* @returns ObservabilityConfig if all required env vars are set, undefined otherwise
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { NeuroLink, buildObservabilityConfigFromEnv } from '@juspay/neurolink';
|
|
20
|
+
*
|
|
21
|
+
* const neurolink = new NeuroLink({
|
|
22
|
+
* observability: buildObservabilityConfigFromEnv()
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function buildObservabilityConfigFromEnv() {
|
|
27
|
+
const langfuseEnabled = process.env.LANGFUSE_ENABLED?.trim().toLowerCase() === "true";
|
|
28
|
+
const publicKey = process.env.LANGFUSE_PUBLIC_KEY?.trim();
|
|
29
|
+
const secretKey = process.env.LANGFUSE_SECRET_KEY?.trim();
|
|
30
|
+
if (!langfuseEnabled || !publicKey || !secretKey) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
langfuse: {
|
|
35
|
+
enabled: langfuseEnabled,
|
|
36
|
+
publicKey,
|
|
37
|
+
secretKey,
|
|
38
|
+
baseUrl: process.env.LANGFUSE_BASE_URL?.trim() || "https://cloud.langfuse.com",
|
|
39
|
+
environment: process.env.LANGFUSE_ENVIRONMENT?.trim() ||
|
|
40
|
+
process.env.PUBLIC_APP_ENVIRONMENT?.trim() ||
|
|
41
|
+
"dev",
|
|
42
|
+
release: process.env.PUBLIC_APP_VERSION?.trim() ||
|
|
43
|
+
process.env.npm_package_version?.trim() ||
|
|
44
|
+
"v1.0.0",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -2,26 +2,8 @@
|
|
|
2
2
|
* Provider Health Checking System
|
|
3
3
|
* Prevents 500 errors by validating provider availability and configuration
|
|
4
4
|
*/
|
|
5
|
-
import { AIProviderName } from "../
|
|
6
|
-
|
|
7
|
-
provider: AIProviderName;
|
|
8
|
-
isHealthy: boolean;
|
|
9
|
-
isConfigured: boolean;
|
|
10
|
-
hasApiKey: boolean;
|
|
11
|
-
lastChecked: Date;
|
|
12
|
-
error?: string;
|
|
13
|
-
warning?: string;
|
|
14
|
-
responseTime?: number;
|
|
15
|
-
configurationIssues: string[];
|
|
16
|
-
recommendations: string[];
|
|
17
|
-
}
|
|
18
|
-
export interface ProviderHealthCheckOptions {
|
|
19
|
-
timeout?: number;
|
|
20
|
-
includeConnectivityTest?: boolean;
|
|
21
|
-
includeModelValidation?: boolean;
|
|
22
|
-
cacheResults?: boolean;
|
|
23
|
-
maxCacheAge?: number;
|
|
24
|
-
}
|
|
5
|
+
import { AIProviderName } from "../constants/enums.js";
|
|
6
|
+
import type { ProviderHealthCheckOptions, ProviderHealthStatusOptions } from "../types/providers.js";
|
|
25
7
|
export declare class ProviderHealthChecker {
|
|
26
8
|
private static healthCache;
|
|
27
9
|
private static readonly DEFAULT_TIMEOUT;
|
|
@@ -35,7 +17,7 @@ export declare class ProviderHealthChecker {
|
|
|
35
17
|
/**
|
|
36
18
|
* Comprehensive health check for a provider
|
|
37
19
|
*/
|
|
38
|
-
static checkProviderHealth(providerName: AIProviderName, options?: ProviderHealthCheckOptions): Promise<
|
|
20
|
+
static checkProviderHealth(providerName: AIProviderName, options?: ProviderHealthCheckOptions): Promise<ProviderHealthStatusOptions>;
|
|
39
21
|
/**
|
|
40
22
|
* Check environment configuration for a provider
|
|
41
23
|
*/
|
|
@@ -196,11 +178,11 @@ export declare class ProviderHealthChecker {
|
|
|
196
178
|
/**
|
|
197
179
|
* Get health status for all registered providers
|
|
198
180
|
*/
|
|
199
|
-
static checkAllProvidersHealth(options?: ProviderHealthCheckOptions): Promise<
|
|
181
|
+
static checkAllProvidersHealth(options?: ProviderHealthCheckOptions): Promise<ProviderHealthStatusOptions[]>;
|
|
200
182
|
/**
|
|
201
183
|
* Get a summary of provider health
|
|
202
184
|
*/
|
|
203
|
-
static getHealthSummary(healthStatuses:
|
|
185
|
+
static getHealthSummary(healthStatuses: ProviderHealthStatusOptions[]): {
|
|
204
186
|
total: number;
|
|
205
187
|
healthy: number;
|
|
206
188
|
configured: number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Prevents 500 errors by validating provider availability and configuration
|
|
4
4
|
*/
|
|
5
5
|
import { logger } from "./logger.js";
|
|
6
|
-
import { AIProviderName, OpenAIModels, GoogleAIModels, AnthropicModels, BedrockModels, } from "../
|
|
6
|
+
import { AIProviderName, OpenAIModels, GoogleAIModels, AnthropicModels, BedrockModels, } from "../constants/enums.js";
|
|
7
7
|
import { API_KEY_LENGTHS, PROJECT_ID_FORMAT } from "./providerConfig.js";
|
|
8
8
|
import { basename } from "path";
|
|
9
9
|
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Enhanced Provider Setup Messages
|
|
3
3
|
* Provides detailed setup instructions for AI providers
|
|
4
4
|
*/
|
|
5
|
-
import { OpenAIModels, GoogleAIModels, AnthropicModels, APIVersions, } from "../
|
|
5
|
+
import { OpenAIModels, GoogleAIModels, AnthropicModels, APIVersions, } from "../constants/enums.js";
|
|
6
6
|
/**
|
|
7
7
|
* Generate enhanced error message with setup instructions
|
|
8
8
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { AIProviderFactory } from "../core/factory.js";
|
|
6
6
|
import { logger } from "./logger.js";
|
|
7
|
+
import { AIProviderName } from "../constants/enums.js";
|
|
7
8
|
import { ProviderHealthChecker } from "./providerHealth.js";
|
|
8
9
|
import { API_KEY_FORMATS, API_KEY_LENGTHS, PROJECT_ID_FORMAT, } from "./providerConfig.js";
|
|
9
10
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "7.53.
|
|
3
|
+
"version": "7.53.3",
|
|
4
4
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Juspay Technologies",
|
|
File without changes
|