@juspay/neurolink 9.65.1 → 9.66.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 +8 -0
- package/dist/adapters/video/videoAnalyzer.d.ts +1 -1
- package/dist/agent/directTools.d.ts +9 -17
- package/dist/agent/directTools.js +1 -5
- package/dist/autoresearch/tools.d.ts +2 -214
- package/dist/autoresearch/tools.js +1 -1
- package/dist/browser/neurolink.min.js +388 -386
- package/dist/cli/commands/proxy.js +154 -5
- package/dist/client/reactHooks.js +16 -8
- package/dist/client/reactHooks.tsx +24 -9
- package/dist/core/baseProvider.d.ts +1 -6
- package/dist/core/baseProvider.js +1 -1
- package/dist/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/core/modules/GenerationHandler.js +3 -1
- package/dist/core/modules/MessageBuilder.d.ts +1 -15
- package/dist/core/modules/MessageBuilder.js +0 -14
- package/dist/core/modules/StreamHandler.js +1 -1
- package/dist/core/modules/ToolsManager.d.ts +1 -17
- package/dist/core/modules/ToolsManager.js +1 -17
- package/dist/core/streamAnalytics.js +1 -1
- package/dist/evaluation/contextBuilder.d.ts +1 -4
- package/dist/evaluation/contextBuilder.js +0 -3
- package/dist/evaluation/index.d.ts +1 -4
- package/dist/evaluation/index.js +0 -3
- package/dist/files/fileTools.d.ts +2 -18
- package/dist/files/fileTools.js +3 -19
- package/dist/lib/adapters/video/videoAnalyzer.d.ts +1 -1
- package/dist/lib/agent/directTools.d.ts +9 -17
- package/dist/lib/agent/directTools.js +1 -5
- package/dist/lib/autoresearch/tools.d.ts +2 -214
- package/dist/lib/autoresearch/tools.js +1 -1
- package/dist/lib/client/reactHooks.js +16 -8
- package/dist/lib/core/baseProvider.d.ts +1 -6
- package/dist/lib/core/baseProvider.js +1 -1
- package/dist/lib/core/modules/GenerationHandler.d.ts +2 -2
- package/dist/lib/core/modules/GenerationHandler.js +3 -1
- package/dist/lib/core/modules/MessageBuilder.d.ts +1 -15
- package/dist/lib/core/modules/MessageBuilder.js +0 -14
- package/dist/lib/core/modules/StreamHandler.js +1 -1
- package/dist/lib/core/modules/ToolsManager.d.ts +1 -17
- package/dist/lib/core/modules/ToolsManager.js +1 -17
- package/dist/lib/core/streamAnalytics.js +1 -1
- package/dist/lib/evaluation/contextBuilder.d.ts +1 -4
- package/dist/lib/evaluation/contextBuilder.js +0 -3
- package/dist/lib/evaluation/index.d.ts +1 -4
- package/dist/lib/evaluation/index.js +0 -3
- package/dist/lib/files/fileTools.d.ts +2 -18
- package/dist/lib/files/fileTools.js +3 -19
- package/dist/lib/memory/memoryRetrievalTools.d.ts +2 -126
- package/dist/lib/memory/memoryRetrievalTools.js +1 -9
- package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -3
- package/dist/lib/middleware/builtin/autoEvaluation.js +0 -3
- package/dist/lib/middleware/builtin/guardrails.js +1 -1
- package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -9
- package/dist/lib/middleware/builtin/lifecycle.js +0 -9
- package/dist/lib/middleware/factory.d.ts +1 -1
- package/dist/lib/middleware/factory.js +1 -1
- package/dist/lib/middleware/registry.d.ts +1 -1
- package/dist/lib/neurolink.d.ts +14 -2
- package/dist/lib/neurolink.js +46 -18
- package/dist/lib/processors/media/AudioProcessor.js +8 -3
- package/dist/lib/providers/amazonBedrock.js +1 -2
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -7
- package/dist/lib/providers/amazonSagemaker.js +0 -6
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +2 -1
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +2 -1
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/azureOpenai.js +2 -1
- package/dist/lib/providers/cloudflare.d.ts +1 -1
- package/dist/lib/providers/cloudflare.js +2 -1
- package/dist/lib/providers/cohere.d.ts +1 -1
- package/dist/lib/providers/cohere.js +2 -1
- package/dist/lib/providers/deepseek.d.ts +1 -1
- package/dist/lib/providers/deepseek.js +2 -1
- package/dist/lib/providers/fireworks.d.ts +1 -1
- package/dist/lib/providers/fireworks.js +2 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +0 -1
- package/dist/lib/providers/googleNativeGemini3.d.ts +1 -1
- package/dist/lib/providers/googleNativeGemini3.js +1 -1
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +0 -1
- package/dist/lib/providers/groq.d.ts +1 -1
- package/dist/lib/providers/groq.js +2 -1
- package/dist/lib/providers/huggingFace.d.ts +1 -1
- package/dist/lib/providers/huggingFace.js +3 -1
- package/dist/lib/providers/ideogram.d.ts +1 -1
- package/dist/lib/providers/jina.d.ts +1 -1
- package/dist/lib/providers/litellm.d.ts +1 -1
- package/dist/lib/providers/litellm.js +12 -6
- package/dist/lib/providers/llamaCpp.d.ts +1 -1
- package/dist/lib/providers/llamaCpp.js +2 -1
- package/dist/lib/providers/lmStudio.d.ts +1 -1
- package/dist/lib/providers/lmStudio.js +2 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +2 -1
- package/dist/lib/providers/nvidiaNim.d.ts +1 -1
- package/dist/lib/providers/nvidiaNim.js +2 -1
- package/dist/lib/providers/ollama.d.ts +1 -1
- package/dist/lib/providers/ollama.js +1 -2
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +3 -1
- package/dist/lib/providers/openRouter.d.ts +1 -1
- package/dist/lib/providers/openRouter.js +3 -1
- package/dist/lib/providers/openaiCompatible.d.ts +1 -1
- package/dist/lib/providers/openaiCompatible.js +3 -1
- package/dist/lib/providers/perplexity.d.ts +1 -1
- package/dist/lib/providers/perplexity.js +2 -1
- package/dist/lib/providers/providerTypeUtils.d.ts +2 -7
- package/dist/lib/providers/providerTypeUtils.js +0 -6
- package/dist/lib/providers/recraft.d.ts +1 -1
- package/dist/lib/providers/replicate.d.ts +1 -1
- package/dist/lib/providers/stability.d.ts +1 -1
- package/dist/lib/providers/togetherAi.d.ts +1 -1
- package/dist/lib/providers/togetherAi.js +2 -1
- package/dist/lib/providers/voyage.d.ts +1 -1
- package/dist/lib/providers/xai.d.ts +1 -1
- package/dist/lib/providers/xai.js +2 -1
- package/dist/lib/proxy/claudeFormat.d.ts +0 -15
- package/dist/lib/proxy/claudeFormat.js +1 -11
- package/dist/lib/proxy/modelRouter.d.ts +5 -1
- package/dist/lib/proxy/modelRouter.js +8 -0
- package/dist/lib/proxy/openaiFormat.d.ts +137 -0
- package/dist/lib/proxy/openaiFormat.js +801 -0
- package/dist/lib/proxy/proxyTranslationEngine.d.ts +124 -0
- package/dist/lib/proxy/proxyTranslationEngine.js +679 -0
- package/dist/lib/rag/ragIntegration.d.ts +1 -12
- package/dist/lib/rag/ragIntegration.js +0 -8
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +6 -5
- package/dist/lib/server/routes/claudeProxyRoutes.js +22 -355
- package/dist/lib/server/routes/index.d.ts +1 -0
- package/dist/lib/server/routes/index.js +10 -2
- package/dist/lib/server/routes/openaiProxyRoutes.d.ts +30 -0
- package/dist/lib/server/routes/openaiProxyRoutes.js +337 -0
- package/dist/lib/tasks/tools/taskTools.d.ts +2 -117
- package/dist/lib/tasks/tools/taskTools.js +1 -10
- package/dist/lib/types/aliases.d.ts +1 -1
- package/dist/lib/types/conversation.d.ts +1 -0
- package/dist/lib/types/evaluation.d.ts +1 -5
- package/dist/lib/types/evaluation.js +0 -4
- package/dist/lib/types/generate.d.ts +2 -22
- package/dist/lib/types/guardrails.d.ts +1 -1
- package/dist/lib/types/middleware.d.ts +8 -3
- package/dist/lib/types/providers.d.ts +2 -1
- package/dist/lib/types/proxy.d.ts +179 -0
- package/dist/lib/types/rag.d.ts +1 -1
- package/dist/lib/types/rag.js +0 -6
- package/dist/lib/types/server.d.ts +3 -0
- package/dist/lib/types/stream.d.ts +2 -11
- package/dist/lib/types/tools.d.ts +2 -1
- package/dist/lib/utils/generation.d.ts +8 -0
- package/dist/lib/utils/generation.js +9 -0
- package/dist/lib/utils/generationErrors.d.ts +10 -0
- package/dist/lib/utils/generationErrors.js +11 -0
- package/dist/lib/utils/messageBuilder.d.ts +1 -6
- package/dist/lib/utils/messageBuilder.js +0 -5
- package/dist/lib/utils/noOutputSentinel.d.ts +0 -13
- package/dist/lib/utils/noOutputSentinel.js +1 -14
- package/dist/lib/utils/providerRetry.js +1 -1
- package/dist/lib/utils/tool.d.ts +8 -0
- package/dist/lib/utils/tool.js +9 -0
- package/dist/lib/utils/toolCallRepair.d.ts +1 -16
- package/dist/lib/utils/toolCallRepair.js +1 -16
- package/dist/lib/utils/toolChoice.d.ts +1 -1
- package/dist/lib/utils/videoAnalysisProcessor.d.ts +1 -8
- package/dist/lib/utils/videoAnalysisProcessor.js +0 -7
- package/dist/memory/memoryRetrievalTools.d.ts +2 -126
- package/dist/memory/memoryRetrievalTools.js +1 -9
- package/dist/middleware/builtin/autoEvaluation.d.ts +0 -3
- package/dist/middleware/builtin/autoEvaluation.js +0 -3
- package/dist/middleware/builtin/guardrails.js +1 -1
- package/dist/middleware/builtin/lifecycle.d.ts +0 -9
- package/dist/middleware/builtin/lifecycle.js +0 -9
- package/dist/middleware/factory.d.ts +1 -1
- package/dist/middleware/factory.js +1 -1
- package/dist/middleware/registry.d.ts +1 -1
- package/dist/neurolink.d.ts +14 -2
- package/dist/neurolink.js +46 -18
- package/dist/processors/media/AudioProcessor.js +8 -3
- package/dist/providers/amazonBedrock.js +1 -2
- package/dist/providers/amazonSagemaker.d.ts +1 -7
- package/dist/providers/amazonSagemaker.js +0 -6
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +2 -1
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +2 -1
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/azureOpenai.js +2 -1
- package/dist/providers/cloudflare.d.ts +1 -1
- package/dist/providers/cloudflare.js +2 -1
- package/dist/providers/cohere.d.ts +1 -1
- package/dist/providers/cohere.js +2 -1
- package/dist/providers/deepseek.d.ts +1 -1
- package/dist/providers/deepseek.js +2 -1
- package/dist/providers/fireworks.d.ts +1 -1
- package/dist/providers/fireworks.js +2 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleNativeGemini3.d.ts +1 -1
- package/dist/providers/googleNativeGemini3.js +1 -1
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/groq.d.ts +1 -1
- package/dist/providers/groq.js +2 -1
- package/dist/providers/huggingFace.d.ts +1 -1
- package/dist/providers/huggingFace.js +3 -1
- package/dist/providers/ideogram.d.ts +1 -1
- package/dist/providers/jina.d.ts +1 -1
- package/dist/providers/litellm.d.ts +1 -1
- package/dist/providers/litellm.js +12 -6
- package/dist/providers/llamaCpp.d.ts +1 -1
- package/dist/providers/llamaCpp.js +2 -1
- package/dist/providers/lmStudio.d.ts +1 -1
- package/dist/providers/lmStudio.js +2 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +2 -1
- package/dist/providers/nvidiaNim.d.ts +1 -1
- package/dist/providers/nvidiaNim.js +2 -1
- package/dist/providers/ollama.d.ts +1 -1
- package/dist/providers/ollama.js +1 -2
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +3 -1
- package/dist/providers/openRouter.d.ts +1 -1
- package/dist/providers/openRouter.js +3 -1
- package/dist/providers/openaiCompatible.d.ts +1 -1
- package/dist/providers/openaiCompatible.js +3 -1
- package/dist/providers/perplexity.d.ts +1 -1
- package/dist/providers/perplexity.js +2 -1
- package/dist/providers/providerTypeUtils.d.ts +2 -7
- package/dist/providers/providerTypeUtils.js +0 -6
- package/dist/providers/recraft.d.ts +1 -1
- package/dist/providers/replicate.d.ts +1 -1
- package/dist/providers/stability.d.ts +1 -1
- package/dist/providers/togetherAi.d.ts +1 -1
- package/dist/providers/togetherAi.js +2 -1
- package/dist/providers/voyage.d.ts +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.js +2 -1
- package/dist/proxy/claudeFormat.d.ts +0 -15
- package/dist/proxy/claudeFormat.js +1 -11
- package/dist/proxy/modelRouter.d.ts +5 -1
- package/dist/proxy/modelRouter.js +8 -0
- package/dist/proxy/openaiFormat.d.ts +137 -0
- package/dist/proxy/openaiFormat.js +800 -0
- package/dist/proxy/proxyTranslationEngine.d.ts +124 -0
- package/dist/proxy/proxyTranslationEngine.js +678 -0
- package/dist/rag/ragIntegration.d.ts +1 -12
- package/dist/rag/ragIntegration.js +0 -8
- package/dist/server/routes/claudeProxyRoutes.d.ts +6 -5
- package/dist/server/routes/claudeProxyRoutes.js +22 -355
- package/dist/server/routes/index.d.ts +1 -0
- package/dist/server/routes/index.js +10 -2
- package/dist/server/routes/openaiProxyRoutes.d.ts +30 -0
- package/dist/server/routes/openaiProxyRoutes.js +336 -0
- package/dist/tasks/tools/taskTools.d.ts +2 -117
- package/dist/tasks/tools/taskTools.js +1 -10
- package/dist/types/aliases.d.ts +1 -1
- package/dist/types/conversation.d.ts +1 -0
- package/dist/types/evaluation.d.ts +1 -5
- package/dist/types/evaluation.js +0 -4
- package/dist/types/generate.d.ts +2 -22
- package/dist/types/guardrails.d.ts +1 -1
- package/dist/types/middleware.d.ts +8 -3
- package/dist/types/providers.d.ts +2 -1
- package/dist/types/proxy.d.ts +179 -0
- package/dist/types/rag.d.ts +1 -1
- package/dist/types/rag.js +0 -6
- package/dist/types/server.d.ts +3 -0
- package/dist/types/stream.d.ts +2 -11
- package/dist/types/tools.d.ts +2 -1
- package/dist/utils/generation.d.ts +8 -0
- package/dist/utils/generation.js +8 -0
- package/dist/utils/generationErrors.d.ts +10 -0
- package/dist/utils/generationErrors.js +10 -0
- package/dist/utils/messageBuilder.d.ts +1 -6
- package/dist/utils/messageBuilder.js +0 -5
- package/dist/utils/noOutputSentinel.d.ts +0 -13
- package/dist/utils/noOutputSentinel.js +1 -14
- package/dist/utils/providerRetry.js +1 -1
- package/dist/utils/tool.d.ts +8 -0
- package/dist/utils/tool.js +8 -0
- package/dist/utils/toolCallRepair.d.ts +1 -16
- package/dist/utils/toolCallRepair.js +1 -16
- package/dist/utils/toolChoice.d.ts +1 -1
- package/dist/utils/videoAnalysisProcessor.d.ts +1 -8
- package/dist/utils/videoAnalysisProcessor.js +0 -7
- package/package.json +2 -3
package/dist/types/proxy.d.ts
CHANGED
|
@@ -1079,3 +1079,182 @@ export type StatusStats = {
|
|
|
1079
1079
|
};
|
|
1080
1080
|
/** Sub-action of the `proxy telemetry` CLI command. */
|
|
1081
1081
|
export type ProxyTelemetryAction = "setup" | "start" | "stop" | "status" | "logs" | "import-dashboard";
|
|
1082
|
+
/** Wire format a proxy request is using. */
|
|
1083
|
+
export type ProxyFormat = "claude" | "openai";
|
|
1084
|
+
/**
|
|
1085
|
+
* Common adapter interface that hides the differences between
|
|
1086
|
+
* Claude and OpenAI stream serializers from the unified translation engine.
|
|
1087
|
+
*/
|
|
1088
|
+
export type StreamSerializerAdapter = {
|
|
1089
|
+
start(): Iterable<string>;
|
|
1090
|
+
pushDelta(text: string): Iterable<string>;
|
|
1091
|
+
pushToolUse(id: string, name: string, input: unknown): Iterable<string>;
|
|
1092
|
+
finish(finishReason: string, usage: {
|
|
1093
|
+
input: number;
|
|
1094
|
+
output: number;
|
|
1095
|
+
total: number;
|
|
1096
|
+
}): Iterable<string>;
|
|
1097
|
+
emitError(message: string): Iterable<string>;
|
|
1098
|
+
};
|
|
1099
|
+
/** OpenAI content part in a user message. */
|
|
1100
|
+
export type OpenAIContentPartText = {
|
|
1101
|
+
type: "text";
|
|
1102
|
+
text: string;
|
|
1103
|
+
};
|
|
1104
|
+
export type OpenAIContentPartImage = {
|
|
1105
|
+
type: "image_url";
|
|
1106
|
+
image_url: {
|
|
1107
|
+
url: string;
|
|
1108
|
+
detail?: "auto" | "low" | "high";
|
|
1109
|
+
};
|
|
1110
|
+
};
|
|
1111
|
+
export type OpenAIContentPart = OpenAIContentPartText | OpenAIContentPartImage;
|
|
1112
|
+
/** OpenAI message types. */
|
|
1113
|
+
export type OpenAISystemMessage = {
|
|
1114
|
+
role: "system";
|
|
1115
|
+
content: string;
|
|
1116
|
+
};
|
|
1117
|
+
export type OpenAIUserMessage = {
|
|
1118
|
+
role: "user";
|
|
1119
|
+
content: string | OpenAIContentPart[];
|
|
1120
|
+
};
|
|
1121
|
+
export type OpenAIAssistantMessage = {
|
|
1122
|
+
role: "assistant";
|
|
1123
|
+
content?: string | null;
|
|
1124
|
+
tool_calls?: OpenAIToolCall[];
|
|
1125
|
+
};
|
|
1126
|
+
export type OpenAIToolMessage = {
|
|
1127
|
+
role: "tool";
|
|
1128
|
+
tool_call_id: string;
|
|
1129
|
+
content: string;
|
|
1130
|
+
};
|
|
1131
|
+
export type OpenAIMessage = OpenAISystemMessage | OpenAIUserMessage | OpenAIAssistantMessage | OpenAIToolMessage;
|
|
1132
|
+
/** OpenAI tool call (in assistant messages and responses). */
|
|
1133
|
+
export type OpenAIToolCall = {
|
|
1134
|
+
id: string;
|
|
1135
|
+
type: "function";
|
|
1136
|
+
function: {
|
|
1137
|
+
name: string;
|
|
1138
|
+
arguments: string;
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
/** OpenAI tool definition. */
|
|
1142
|
+
export type OpenAIToolDef = {
|
|
1143
|
+
type: "function";
|
|
1144
|
+
function: {
|
|
1145
|
+
name: string;
|
|
1146
|
+
description?: string;
|
|
1147
|
+
parameters: Record<string, unknown>;
|
|
1148
|
+
};
|
|
1149
|
+
};
|
|
1150
|
+
/** OpenAI tool_choice options. */
|
|
1151
|
+
export type OpenAIToolChoice = "auto" | "required" | "none" | {
|
|
1152
|
+
type: "function";
|
|
1153
|
+
function: {
|
|
1154
|
+
name: string;
|
|
1155
|
+
};
|
|
1156
|
+
};
|
|
1157
|
+
/** OpenAI Chat Completions request body. */
|
|
1158
|
+
export type OpenAICompletionRequest = {
|
|
1159
|
+
model: string;
|
|
1160
|
+
messages: OpenAIMessage[];
|
|
1161
|
+
tools?: OpenAIToolDef[];
|
|
1162
|
+
tool_choice?: OpenAIToolChoice;
|
|
1163
|
+
stream?: boolean;
|
|
1164
|
+
temperature?: number;
|
|
1165
|
+
top_p?: number;
|
|
1166
|
+
max_tokens?: number;
|
|
1167
|
+
max_completion_tokens?: number;
|
|
1168
|
+
stop?: string | string[];
|
|
1169
|
+
n?: number;
|
|
1170
|
+
response_format?: {
|
|
1171
|
+
type: "text" | "json_object" | "json_schema";
|
|
1172
|
+
json_schema?: unknown;
|
|
1173
|
+
};
|
|
1174
|
+
stream_options?: {
|
|
1175
|
+
include_usage?: boolean;
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
/** OpenAI usage counters. */
|
|
1179
|
+
export type OpenAIUsage = {
|
|
1180
|
+
prompt_tokens: number;
|
|
1181
|
+
completion_tokens: number;
|
|
1182
|
+
total_tokens: number;
|
|
1183
|
+
};
|
|
1184
|
+
/** OpenAI non-streaming response. */
|
|
1185
|
+
export type OpenAICompletionResponse = {
|
|
1186
|
+
id: string;
|
|
1187
|
+
object: "chat.completion";
|
|
1188
|
+
created: number;
|
|
1189
|
+
model: string;
|
|
1190
|
+
choices: Array<{
|
|
1191
|
+
index: number;
|
|
1192
|
+
message: {
|
|
1193
|
+
role: "assistant";
|
|
1194
|
+
content: string | null;
|
|
1195
|
+
tool_calls?: OpenAIToolCall[];
|
|
1196
|
+
};
|
|
1197
|
+
finish_reason: "stop" | "tool_calls" | "length" | "content_filter" | null;
|
|
1198
|
+
}>;
|
|
1199
|
+
usage: OpenAIUsage;
|
|
1200
|
+
};
|
|
1201
|
+
/** OpenAI streaming chunk. */
|
|
1202
|
+
export type OpenAIStreamChunk = {
|
|
1203
|
+
id: string;
|
|
1204
|
+
object: "chat.completion.chunk";
|
|
1205
|
+
created: number;
|
|
1206
|
+
model: string;
|
|
1207
|
+
choices: Array<{
|
|
1208
|
+
index: number;
|
|
1209
|
+
delta: {
|
|
1210
|
+
role?: "assistant";
|
|
1211
|
+
content?: string;
|
|
1212
|
+
tool_calls?: Array<{
|
|
1213
|
+
index: number;
|
|
1214
|
+
id?: string;
|
|
1215
|
+
type?: "function";
|
|
1216
|
+
function?: {
|
|
1217
|
+
name?: string;
|
|
1218
|
+
arguments?: string;
|
|
1219
|
+
};
|
|
1220
|
+
}>;
|
|
1221
|
+
};
|
|
1222
|
+
finish_reason: string | null;
|
|
1223
|
+
}>;
|
|
1224
|
+
usage?: OpenAIUsage;
|
|
1225
|
+
};
|
|
1226
|
+
/** OpenAI error response. */
|
|
1227
|
+
export type OpenAIErrorResponse = {
|
|
1228
|
+
error: {
|
|
1229
|
+
message: string;
|
|
1230
|
+
type: string;
|
|
1231
|
+
code: string | null;
|
|
1232
|
+
};
|
|
1233
|
+
};
|
|
1234
|
+
/** Parsed OpenAI request — intermediate form for NeuroLink pipeline. */
|
|
1235
|
+
export type ParsedOpenAIRequest = {
|
|
1236
|
+
model: string;
|
|
1237
|
+
maxTokens?: number;
|
|
1238
|
+
temperature?: number;
|
|
1239
|
+
topP?: number;
|
|
1240
|
+
systemPrompt?: string;
|
|
1241
|
+
stream: boolean;
|
|
1242
|
+
prompt: string;
|
|
1243
|
+
images: string[];
|
|
1244
|
+
conversationMessages: Array<{
|
|
1245
|
+
role: string;
|
|
1246
|
+
content: string;
|
|
1247
|
+
}>;
|
|
1248
|
+
tools: Record<string, {
|
|
1249
|
+
description?: string;
|
|
1250
|
+
inputSchema: unknown;
|
|
1251
|
+
execute?: (...args: unknown[]) => unknown;
|
|
1252
|
+
}>;
|
|
1253
|
+
toolChoice?: "auto" | "required" | "none";
|
|
1254
|
+
toolChoiceName?: string;
|
|
1255
|
+
stopSequences?: string[];
|
|
1256
|
+
responseFormat?: {
|
|
1257
|
+
type: string;
|
|
1258
|
+
jsonSchema?: unknown;
|
|
1259
|
+
};
|
|
1260
|
+
};
|
package/dist/types/rag.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Tool } from "./tools.js";
|
|
1
2
|
/**
|
|
2
3
|
* RAG Type Definitions
|
|
3
4
|
*
|
|
@@ -525,7 +526,6 @@ export type RAGCircuitBreakerEvents = {
|
|
|
525
526
|
timestamp: Date;
|
|
526
527
|
}];
|
|
527
528
|
};
|
|
528
|
-
import type { Tool } from "ai";
|
|
529
529
|
/** Prepared RAG tool ready for injection into generate/stream. */
|
|
530
530
|
export type RAGPreparedTool = {
|
|
531
531
|
/** The tool to inject into the tools Record */
|
package/dist/types/rag.js
CHANGED
package/dist/types/server.d.ts
CHANGED
|
@@ -1058,7 +1058,10 @@ export type OpenAPISpec = {
|
|
|
1058
1058
|
export type CreateRoutesOptions = {
|
|
1059
1059
|
enableSwagger?: boolean;
|
|
1060
1060
|
getRoutes?: () => RouteDefinition[];
|
|
1061
|
+
/** Enable both Claude and OpenAI proxy endpoints. */
|
|
1062
|
+
proxy?: boolean;
|
|
1061
1063
|
claudeProxy?: boolean;
|
|
1064
|
+
openaiProxy?: boolean;
|
|
1062
1065
|
};
|
|
1063
1066
|
/** Data stream finish event. */
|
|
1064
1067
|
export type FinishEvent = DataStreamEvent & {
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LanguageModel, StepResult, Tool, ToolChoice } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import type { EvaluationData } from "./evaluation.js";
|
|
4
3
|
import type { RAGConfig } from "./rag.js";
|
|
@@ -16,6 +15,8 @@ import type { STTOptions, STTResult } from "./stt.js";
|
|
|
16
15
|
import type { StandardRecord, ValidationSchema } from "./aliases.js";
|
|
17
16
|
import type { FileWithMetadata } from "./file.js";
|
|
18
17
|
import type { WorkflowConfig } from "./workflow.js";
|
|
18
|
+
import type { LanguageModel, StepResult } from "./providers.js";
|
|
19
|
+
import type { Tool, ToolChoice } from "./tools.js";
|
|
19
20
|
/**
|
|
20
21
|
* Progress tracking and metadata for streaming operations
|
|
21
22
|
*/
|
|
@@ -433,16 +434,6 @@ export type StreamOptions = {
|
|
|
433
434
|
* ```
|
|
434
435
|
*/
|
|
435
436
|
rag?: RAGConfig;
|
|
436
|
-
/**
|
|
437
|
-
* File reference registry for on-demand file processing (internal).
|
|
438
|
-
*
|
|
439
|
-
* When set, files above the "tiny" size tier (>10KB) will be registered
|
|
440
|
-
* as lightweight references instead of being fully loaded into the prompt.
|
|
441
|
-
* The LLM can then access file content on-demand via file tools.
|
|
442
|
-
*
|
|
443
|
-
* @internal Set by NeuroLink SDK — not typically used directly by consumers.
|
|
444
|
-
*/
|
|
445
|
-
fileRegistry?: unknown;
|
|
446
437
|
/** BZ-1341: Override fallback provider name (takes precedence over env/model config). */
|
|
447
438
|
fallbackProvider?: string;
|
|
448
439
|
/** BZ-1341: Override fallback model name (takes precedence over env/model config). */
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* argument patterns, execution metadata, context, and result types.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import type { Tool } from "ai";
|
|
7
6
|
import type { ErrorInfo, JsonObject, JsonValue, Result, UnknownRecord } from "./common.js";
|
|
8
7
|
import type { StandardRecord, StringArray, ZodUnknownSchema } from "./aliases.js";
|
|
9
8
|
import type { ValidationError } from "../utils/parameterValidation.js";
|
|
10
9
|
import type { MCPToolAnnotations } from "./mcp.js";
|
|
11
10
|
import type { Logger } from "./utilities.js";
|
|
12
11
|
import type { HITLExecutionState } from "./hitl.js";
|
|
12
|
+
import type { Tool } from "ai";
|
|
13
|
+
export type { Tool, ToolSet, ToolChoice, ToolCallOptions, ToolExecuteFunction, ToolApprovalRequest, ToolApprovalResponse, InferToolInput, InferToolOutput, Schema, FlexibleSchema, InferSchema, } from "ai";
|
|
13
14
|
/**
|
|
14
15
|
* Commonly used Zod schema type aliases for cleaner type declarations
|
|
15
16
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation, streaming, embedding, and middleware-composition primitives.
|
|
3
|
+
*
|
|
4
|
+
* Today these resolve through the upstream generation library; this file is
|
|
5
|
+
* the only internal source so the implementation can be replaced without
|
|
6
|
+
* touching call sites.
|
|
7
|
+
*/
|
|
8
|
+
export { generateText, streamText, generateObject, streamObject, embed, embedMany, wrapLanguageModel, experimental_transcribe, } from "ai";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation, streaming, embedding, and middleware-composition primitives.
|
|
3
|
+
*
|
|
4
|
+
* Today these resolve through the upstream generation library; this file is
|
|
5
|
+
* the only internal source so the implementation can be replaced without
|
|
6
|
+
* touching call sites.
|
|
7
|
+
*/
|
|
8
|
+
export { generateText, streamText, generateObject, streamObject, embed, embedMany, wrapLanguageModel, experimental_transcribe, } from "ai";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes surfaced by the generation pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Used with `.isInstance(e)` checks and instanceof guards in retry,
|
|
5
|
+
* tool-call repair, and stream handling. Today these resolve through the
|
|
6
|
+
* upstream generation library; this file is the only internal source so the
|
|
7
|
+
* implementation can be replaced without touching call sites.
|
|
8
|
+
*/
|
|
9
|
+
export { NoOutputGeneratedError, NoObjectGeneratedError, NoSuchToolError, InvalidToolInputError, } from "ai";
|
|
10
|
+
export { APICallError } from "@ai-sdk/provider";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error classes surfaced by the generation pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Used with `.isInstance(e)` checks and instanceof guards in retry,
|
|
5
|
+
* tool-call repair, and stream handling. Today these resolve through the
|
|
6
|
+
* upstream generation library; this file is the only internal source so the
|
|
7
|
+
* implementation can be replaced without touching call sites.
|
|
8
|
+
*/
|
|
9
|
+
export { NoOutputGeneratedError, NoObjectGeneratedError, NoSuchToolError, InvalidToolInputError, } from "ai";
|
|
10
|
+
export { APICallError } from "@ai-sdk/provider";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message Builder Utility
|
|
3
|
-
* Centralized logic for building message arrays from TextGenerationOptions
|
|
4
|
-
* Enhanced with multimodal support for images
|
|
5
|
-
*/
|
|
6
|
-
import type { ModelMessage } from "ai";
|
|
7
1
|
import type { GenerateOptions, MultimodalChatMessage, StreamOptions, TextGenerationOptions } from "../types/index.js";
|
|
2
|
+
import type { ModelMessage } from "../types/index.js";
|
|
8
3
|
/**
|
|
9
4
|
* Type-safe conversion from MultimodalChatMessage[] to ModelMessage[]
|
|
10
5
|
* Filters out invalid content and ensures strict ModelMessage contract compliance
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message Builder Utility
|
|
3
|
-
* Centralized logic for building message arrays from TextGenerationOptions
|
|
4
|
-
* Enhanced with multimodal support for images
|
|
5
|
-
*/
|
|
6
1
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
7
2
|
import { getGlobalDispatcher, interceptors, request } from "undici";
|
|
8
3
|
import { MultimodalLogger, ProviderImageAdapter, } from "../adapters/providerImageAdapter.js";
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Curator P3-6: shared builder for the `NoOutputGeneratedError` sentinel
|
|
3
|
-
* chunk. Each provider's stream-transformation generator catches the AI
|
|
4
|
-
* SDK's `NoOutputGeneratedError` and yields this sentinel so downstream
|
|
5
|
-
* telemetry has finish reason + token usage + provider error context
|
|
6
|
-
* instead of just `{ noOutput: true, errorType: "..." }`.
|
|
7
|
-
*
|
|
8
|
-
* The AI SDK rejects `result.finishReason` / `result.totalUsage` in this
|
|
9
|
-
* branch today (see `ai/src/generate-text/stream-text.ts` ~L1078); we
|
|
10
|
-
* still attempt to await them so a future SDK version surfacing partial
|
|
11
|
-
* values populates the sentinel automatically. When they reject we keep
|
|
12
|
-
* conservative defaults (`finishReason: "error"`, zero usage).
|
|
13
|
-
*/
|
|
14
1
|
import type { StreamNoOutputSentinel, StreamNoOutputSentinelResultLike } from "../types/index.js";
|
|
15
2
|
export declare function buildNoOutputSentinel(error: unknown, result?: StreamNoOutputSentinelResultLike,
|
|
16
3
|
/**
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Curator P3-6: shared builder for the `NoOutputGeneratedError` sentinel
|
|
3
|
-
* chunk. Each provider's stream-transformation generator catches the AI
|
|
4
|
-
* SDK's `NoOutputGeneratedError` and yields this sentinel so downstream
|
|
5
|
-
* telemetry has finish reason + token usage + provider error context
|
|
6
|
-
* instead of just `{ noOutput: true, errorType: "..." }`.
|
|
7
|
-
*
|
|
8
|
-
* The AI SDK rejects `result.finishReason` / `result.totalUsage` in this
|
|
9
|
-
* branch today (see `ai/src/generate-text/stream-text.ts` ~L1078); we
|
|
10
|
-
* still attempt to await them so a future SDK version surfacing partial
|
|
11
|
-
* values populates the sentinel automatically. When they reject we keep
|
|
12
|
-
* conservative defaults (`finishReason: "error"`, zero usage).
|
|
13
|
-
*/
|
|
14
|
-
import { NoOutputGeneratedError } from "ai";
|
|
15
1
|
import { trace, context as otelContext } from "@opentelemetry/api";
|
|
2
|
+
import { NoOutputGeneratedError } from "./generationErrors.js";
|
|
16
3
|
export async function buildNoOutputSentinel(error, result,
|
|
17
4
|
/**
|
|
18
5
|
* Reviewer follow-up: AI SDK v6 wraps the AI SDK's
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module utils/providerRetry
|
|
15
15
|
*/
|
|
16
|
-
import { APICallError } from "@ai-sdk/provider";
|
|
17
16
|
import { logger } from "./logger.js";
|
|
17
|
+
import { APICallError } from "./generationErrors.js";
|
|
18
18
|
/** Maximum number of retry attempts after the initial call (total = 1 + MAX_PROVIDER_RETRIES). */
|
|
19
19
|
export const MAX_PROVIDER_RETRIES = 2;
|
|
20
20
|
/** Base delay in ms for exponential backoff between retries. */
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool definition helpers + structured-output spec.
|
|
3
|
+
*
|
|
4
|
+
* Today these resolve through the upstream generation library; this file is
|
|
5
|
+
* the only internal source for them so the implementation can be replaced
|
|
6
|
+
* without touching call sites.
|
|
7
|
+
*/
|
|
8
|
+
export { tool, jsonSchema, Output, stepCountIs } from "ai";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool definition helpers + structured-output spec.
|
|
3
|
+
*
|
|
4
|
+
* Today these resolve through the upstream generation library; this file is
|
|
5
|
+
* the only internal source for them so the implementation can be replaced
|
|
6
|
+
* without touching call sites.
|
|
7
|
+
*/
|
|
8
|
+
export { tool, jsonSchema, Output, stepCountIs } from "ai";
|
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Schema-Driven Tool Call Repair (BZ-665)
|
|
3
|
-
*
|
|
4
|
-
* Implements `experimental_repairToolCall` for the Vercel AI SDK.
|
|
5
|
-
* When an LLM sends a wrong tool name or wrong parameter names,
|
|
6
|
-
* this module attempts deterministic, schema-driven repair:
|
|
7
|
-
*
|
|
8
|
-
* 1. Tool name: case-insensitive → substring → Levenshtein
|
|
9
|
-
* 2. Param names: compare against JSON schema properties dynamically
|
|
10
|
-
* 3. Type coercion: string→number, JSON string→object/array per schema
|
|
11
|
-
*
|
|
12
|
-
* Zero static alias maps. The tool's JSON schema is the only source of truth.
|
|
13
|
-
*
|
|
14
|
-
* @module utils/toolCallRepair
|
|
15
|
-
*/
|
|
16
|
-
import type { ToolCallRepairFunction, ToolSet } from "ai";
|
|
1
|
+
import type { ToolCallRepairFunction, ToolSet } from "../types/index.js";
|
|
17
2
|
/**
|
|
18
3
|
* Create an `experimental_repairToolCall` handler for streamText/generateText.
|
|
19
4
|
* Fully dynamic — reads the tool schema at repair time, no configuration needed.
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-Driven Tool Call Repair (BZ-665)
|
|
3
|
-
*
|
|
4
|
-
* Implements `experimental_repairToolCall` for the Vercel AI SDK.
|
|
5
|
-
* When an LLM sends a wrong tool name or wrong parameter names,
|
|
6
|
-
* this module attempts deterministic, schema-driven repair:
|
|
7
|
-
*
|
|
8
|
-
* 1. Tool name: case-insensitive → substring → Levenshtein
|
|
9
|
-
* 2. Param names: compare against JSON schema properties dynamically
|
|
10
|
-
* 3. Type coercion: string→number, JSON string→object/array per schema
|
|
11
|
-
*
|
|
12
|
-
* Zero static alias maps. The tool's JSON schema is the only source of truth.
|
|
13
|
-
*
|
|
14
|
-
* @module utils/toolCallRepair
|
|
15
|
-
*/
|
|
16
1
|
import { logger } from "./logger.js";
|
|
17
2
|
/**
|
|
18
3
|
* Create an `experimental_repairToolCall` handler for streamText/generateText.
|
|
@@ -21,7 +6,7 @@ import { logger } from "./logger.js";
|
|
|
21
6
|
export function createToolCallRepair() {
|
|
22
7
|
return async ({ toolCall, tools, inputSchema, error }) => {
|
|
23
8
|
// Import error classes lazily to avoid circular deps at module level
|
|
24
|
-
const { NoSuchToolError: NoSuchTool, InvalidToolInputError: InvalidInput } = await import("
|
|
9
|
+
const { NoSuchToolError: NoSuchTool, InvalidToolInputError: InvalidInput } = await import("./generationErrors.js");
|
|
25
10
|
if (NoSuchTool.isInstance(error)) {
|
|
26
11
|
return repairToolName(toolCall, Object.keys(tools));
|
|
27
12
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Tool, ToolChoice } from "
|
|
1
|
+
import type { Tool, ToolChoice } from "../types/index.js";
|
|
2
2
|
export declare function resolveToolChoice(options: {
|
|
3
3
|
toolChoice?: ToolChoice<Record<string, Tool>>;
|
|
4
4
|
}, tools: Record<string, Tool> | undefined, shouldUseTools: boolean): ToolChoice<Record<string, Tool>> | "none";
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Video Analysis Processor
|
|
3
|
-
*
|
|
4
|
-
* Formats video analysis results into human-readable text
|
|
5
|
-
*
|
|
6
|
-
* @module utils/videoAnalysisProcessor
|
|
7
|
-
*/
|
|
8
|
-
import type { ModelMessage } from "ai";
|
|
9
1
|
import { AIProviderName } from "../constants/enums.js";
|
|
2
|
+
import type { ModelMessage } from "../types/index.js";
|
|
10
3
|
/**
|
|
11
4
|
* Check if messages contain video frames (images)
|
|
12
5
|
* Only checks user messages to match buildContentParts behavior
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.66.0",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applications with 21+ providers: OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, Azure OpenAI, Mistral, LiteLLM, SageMaker, Hugging Face, Ollama, OpenAI-compatible, OpenRouter, DeepSeek, NVIDIA NIM, LM Studio, llama.cpp, plus voice (OpenAI TTS, ElevenLabs, Deepgram, Azure Speech).",
|
|
6
6
|
"author": {
|
|
@@ -274,7 +274,6 @@
|
|
|
274
274
|
"jose": "^6.1.3",
|
|
275
275
|
"json-schema-to-zod": "^2.7.0",
|
|
276
276
|
"nanoid": "^5.1.5",
|
|
277
|
-
"ollama-ai-provider": "^1.2.0",
|
|
278
277
|
"open": "^11.0.0",
|
|
279
278
|
"ora": "^9.3.0",
|
|
280
279
|
"p-limit": "^7.3.0",
|
|
@@ -339,6 +338,7 @@
|
|
|
339
338
|
"@changesets/changelog-github": "^0.6.0",
|
|
340
339
|
"@changesets/cli": "^2.29.8",
|
|
341
340
|
"@eslint/js": "^10.0.1",
|
|
341
|
+
"@juspay/hippocampus": "^0.1.6",
|
|
342
342
|
"@opentelemetry/api": "^1.9.0",
|
|
343
343
|
"@opentelemetry/sdk-trace-base": "^2.6.0",
|
|
344
344
|
"@opentelemetry/sdk-trace-node": "^2.6.0",
|
|
@@ -357,7 +357,6 @@
|
|
|
357
357
|
"@types/cors": "^2.8.19",
|
|
358
358
|
"@types/express": "^5.0.6",
|
|
359
359
|
"@types/fluent-ffmpeg": "^2.1.28",
|
|
360
|
-
"@juspay/hippocampus": "^0.1.6",
|
|
361
360
|
"@types/inquirer": "^9.0.9",
|
|
362
361
|
"@types/js-yaml": "^4.0.9",
|
|
363
362
|
"@types/koa": "^3.0.1",
|