@juspay/neurolink 9.54.7 → 9.54.9
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/browser/neurolink.min.js +330 -330
- package/dist/lib/providers/googleAiStudio.js +14 -26
- package/dist/lib/providers/googleVertex.js +14 -27
- package/dist/lib/rag/chunkers/BaseChunker.js +2 -2
- package/dist/providers/googleAiStudio.js +14 -26
- package/dist/providers/googleVertex.js +14 -27
- package/dist/rag/chunkers/BaseChunker.js +2 -2
- package/package.json +1 -9
|
@@ -395,15 +395,13 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
395
395
|
// Check for tools from options AND from SDK (MCP tools)
|
|
396
396
|
// Need to check early if we should route to native SDK
|
|
397
397
|
const gemini3CheckShouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
const combinedToolCount = Object.keys(optionTools).length + Object.keys(sdkTools).length;
|
|
401
|
-
const hasTools = gemini3CheckShouldUseTools && combinedToolCount > 0;
|
|
398
|
+
const tools = options.tools || {};
|
|
399
|
+
const hasTools = gemini3CheckShouldUseTools && Object.keys(tools).length > 0;
|
|
402
400
|
if (isGemini3Model(gemini3CheckModelName) && hasTools) {
|
|
403
401
|
// Merge SDK tools into options for native SDK path
|
|
404
402
|
let mergedOptions = {
|
|
405
403
|
...options,
|
|
406
|
-
tools:
|
|
404
|
+
tools: tools,
|
|
407
405
|
};
|
|
408
406
|
// Check for tools + JSON schema conflict (Gemini limitation)
|
|
409
407
|
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
@@ -421,9 +419,7 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
421
419
|
if (hasActiveTools) {
|
|
422
420
|
logger.info("[GoogleAIStudio] Routing Gemini 3 to native SDK for tool calling", {
|
|
423
421
|
model: gemini3CheckModelName,
|
|
424
|
-
|
|
425
|
-
sdkToolCount: Object.keys(sdkTools).length,
|
|
426
|
-
totalToolCount: combinedToolCount,
|
|
422
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
427
423
|
});
|
|
428
424
|
return this.executeNativeGemini3Stream(mergedOptions);
|
|
429
425
|
}
|
|
@@ -448,14 +444,13 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
448
444
|
logger.warn("[GoogleAIStudio] Structured output active — disabling tools (Gemini limitation).");
|
|
449
445
|
}
|
|
450
446
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
? { ...baseTools, ...(options.tools || {}) }
|
|
447
|
+
const filteredTools = shouldUseTools
|
|
448
|
+
? (options.tools ?? {})
|
|
454
449
|
: {};
|
|
455
450
|
// Sanitize tool schemas for Gemini proto compatibility (converts anyOf/oneOf unions to string)
|
|
456
451
|
let tools;
|
|
457
|
-
if (Object.keys(
|
|
458
|
-
const sanitized = sanitizeToolsForGemini(
|
|
452
|
+
if (Object.keys(filteredTools).length > 0) {
|
|
453
|
+
const sanitized = sanitizeToolsForGemini(filteredTools);
|
|
459
454
|
if (sanitized.dropped.length > 0) {
|
|
460
455
|
logger.warn(`[GoogleAIStudio] Dropped ${sanitized.dropped.length} incompatible tool(s): ${sanitized.dropped.join(", ")}`);
|
|
461
456
|
}
|
|
@@ -851,10 +846,9 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
851
846
|
let executeMap = new Map();
|
|
852
847
|
const shouldUseTools = !options.disableTools;
|
|
853
848
|
if (shouldUseTools) {
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
const result = buildNativeToolDeclarations(mergedTools);
|
|
849
|
+
const tools = options.tools || {};
|
|
850
|
+
if (Object.keys(tools).length > 0) {
|
|
851
|
+
const result = buildNativeToolDeclarations(tools);
|
|
858
852
|
toolsConfig = result.toolsConfig;
|
|
859
853
|
executeMap = result.executeMap;
|
|
860
854
|
logger.debug("[GoogleAIStudio] Converted tools for native SDK generate", {
|
|
@@ -989,15 +983,12 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
989
983
|
const modelName = options.model || this.modelName;
|
|
990
984
|
// Check if we should use native SDK for Gemini 3 with tools
|
|
991
985
|
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
992
|
-
const
|
|
993
|
-
const hasTools = shouldUseTools &&
|
|
994
|
-
(Object.keys(sdkTools).length > 0 ||
|
|
995
|
-
(options.tools && Object.keys(options.tools).length > 0));
|
|
986
|
+
const hasTools = shouldUseTools && options.tools && Object.keys(options.tools).length > 0;
|
|
996
987
|
if (isGemini3Model(modelName) && hasTools) {
|
|
997
988
|
// Merge SDK tools into options for native SDK path
|
|
998
989
|
let mergedOptions = {
|
|
999
990
|
...options,
|
|
1000
|
-
tools:
|
|
991
|
+
tools: options.tools,
|
|
1001
992
|
};
|
|
1002
993
|
// Check for tools + JSON schema conflict (Gemini limitation)
|
|
1003
994
|
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
@@ -1015,10 +1006,7 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
1015
1006
|
if (hasActiveTools) {
|
|
1016
1007
|
logger.info("[GoogleAIStudio] Routing Gemini 3 generate to native SDK for tool calling", {
|
|
1017
1008
|
model: modelName,
|
|
1018
|
-
|
|
1019
|
-
optionToolCount: Object.keys(options.tools || {}).length,
|
|
1020
|
-
totalToolCount: Object.keys(sdkTools).length +
|
|
1021
|
-
Object.keys(options.tools || {}).length,
|
|
1009
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
1022
1010
|
});
|
|
1023
1011
|
return this.executeNativeGemini3Generate(mergedOptions);
|
|
1024
1012
|
}
|
|
@@ -858,23 +858,19 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
858
858
|
async maybeExecuteNativeGemini3ToolStream(options, analysisSchema, modelName) {
|
|
859
859
|
const wantsStructuredOutput = analysisSchema || options.output?.format === "json" || options.schema;
|
|
860
860
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
861
|
-
const
|
|
862
|
-
const
|
|
863
|
-
const combinedToolCount = Object.keys(optionTools).length + Object.keys(sdkTools).length;
|
|
864
|
-
const hasTools = shouldUseTools && combinedToolCount > 0;
|
|
861
|
+
const tools = options.tools || {};
|
|
862
|
+
const hasTools = shouldUseTools && Object.keys(tools).length > 0;
|
|
865
863
|
if (!isGemini3Model(modelName) || !hasTools) {
|
|
866
864
|
return null;
|
|
867
865
|
}
|
|
868
866
|
const processedOptions = await this.processCSVFilesForNativeSDK(options);
|
|
869
867
|
const mergedOptions = {
|
|
870
868
|
...processedOptions,
|
|
871
|
-
tools:
|
|
869
|
+
tools: tools,
|
|
872
870
|
};
|
|
873
871
|
logger.info("[GoogleVertex] Routing Gemini 3 to native SDK for tool calling", {
|
|
874
872
|
model: modelName,
|
|
875
|
-
optionToolCount: Object.keys(
|
|
876
|
-
sdkToolCount: Object.keys(sdkTools).length,
|
|
877
|
-
totalToolCount: combinedToolCount,
|
|
873
|
+
optionToolCount: Object.keys(tools).length,
|
|
878
874
|
});
|
|
879
875
|
return this.executeNativeGemini3Stream(mergedOptions);
|
|
880
876
|
}
|
|
@@ -934,9 +930,8 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
934
930
|
}
|
|
935
931
|
async resolveAISDKStreamTools(options, modelName, functionTag) {
|
|
936
932
|
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
937
|
-
const baseStreamTools = shouldUseTools ? await this.getAllTools() : {};
|
|
938
933
|
const rawTools = shouldUseTools
|
|
939
|
-
?
|
|
934
|
+
? options.tools
|
|
940
935
|
: {};
|
|
941
936
|
const isAnthropic = isAnthropicModel(modelName);
|
|
942
937
|
let tools;
|
|
@@ -964,8 +959,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
964
959
|
}
|
|
965
960
|
logger.debug(`${functionTag}: Tools for streaming`, {
|
|
966
961
|
shouldUseTools,
|
|
967
|
-
|
|
968
|
-
externalToolCount: Object.keys(options.tools || {}).length,
|
|
962
|
+
externalToolCount: Object.keys(options.tools ?? {}).length,
|
|
969
963
|
toolCount: Object.keys(tools ?? {}).length,
|
|
970
964
|
toolNames: Object.keys(tools ?? {}),
|
|
971
965
|
});
|
|
@@ -973,7 +967,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
973
967
|
shouldUseTools,
|
|
974
968
|
tools,
|
|
975
969
|
isAnthropic,
|
|
976
|
-
baseToolCount:
|
|
970
|
+
baseToolCount: 0,
|
|
977
971
|
};
|
|
978
972
|
}
|
|
979
973
|
buildAISDKStreamOptions(params) {
|
|
@@ -1592,14 +1586,13 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
1592
1586
|
logger.warn("[GoogleVertex] Gemini does not support tools and JSON schema output simultaneously. Disabling tools for this request.");
|
|
1593
1587
|
shouldUseTools = false;
|
|
1594
1588
|
}
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
? { ...sdkTools, ...(options.tools || {}) }
|
|
1589
|
+
const tools = shouldUseTools
|
|
1590
|
+
? (options.tools ?? {})
|
|
1598
1591
|
: {};
|
|
1599
1592
|
let toolsConfig;
|
|
1600
1593
|
let executeMap = new Map();
|
|
1601
|
-
if (Object.keys(
|
|
1602
|
-
const result = buildNativeToolDeclarations(
|
|
1594
|
+
if (Object.keys(tools).length > 0) {
|
|
1595
|
+
const result = buildNativeToolDeclarations(tools);
|
|
1603
1596
|
toolsConfig = result.toolsConfig;
|
|
1604
1597
|
executeMap = result.executeMap;
|
|
1605
1598
|
logger.debug("[GoogleVertex] Converted tools for native SDK generate", {
|
|
@@ -1812,24 +1805,18 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
1812
1805
|
const wantsStructuredOutput = options.output?.format === "json" || !!options.schema;
|
|
1813
1806
|
// Check if we should use native SDK for Gemini 3 with tools
|
|
1814
1807
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
1815
|
-
const
|
|
1816
|
-
const hasTools = shouldUseTools &&
|
|
1817
|
-
(Object.keys(sdkTools).length > 0 ||
|
|
1818
|
-
(options.tools && Object.keys(options.tools).length > 0));
|
|
1808
|
+
const hasTools = shouldUseTools && options.tools && Object.keys(options.tools).length > 0;
|
|
1819
1809
|
if (isGemini3Model(modelName) && hasTools && !wantsStructuredOutput) {
|
|
1820
1810
|
// Process CSV files before routing to native SDK (bypasses normal message builder)
|
|
1821
1811
|
const processedOptions = await this.processCSVFilesForNativeSDK(options);
|
|
1822
1812
|
// Merge SDK tools into options for native SDK path
|
|
1823
1813
|
const mergedOptions = {
|
|
1824
1814
|
...processedOptions,
|
|
1825
|
-
tools:
|
|
1815
|
+
tools: options.tools || {},
|
|
1826
1816
|
};
|
|
1827
1817
|
logger.info("[GoogleVertex] Routing Gemini 3 generate to native SDK for tool calling", {
|
|
1828
1818
|
model: modelName,
|
|
1829
|
-
|
|
1830
|
-
optionToolCount: Object.keys(processedOptions.tools || {}).length,
|
|
1831
|
-
totalToolCount: Object.keys(sdkTools).length +
|
|
1832
|
-
Object.keys(processedOptions.tools || {}).length,
|
|
1819
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
1833
1820
|
});
|
|
1834
1821
|
return this.executeNativeGemini3Generate(mergedOptions);
|
|
1835
1822
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Abstract base class for all chunker implementations.
|
|
5
5
|
* Provides common functionality and interface contract.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { ChunkingError, RAGErrorCodes } from "../errors/RAGError.js";
|
|
9
9
|
import { withSpan } from "../../telemetry/withSpan.js";
|
|
10
10
|
import { tracers } from "../../telemetry/tracers.js";
|
|
@@ -121,7 +121,7 @@ export class BaseChunker {
|
|
|
121
121
|
custom: this.config.preserveMetadata ? customMetadata : undefined,
|
|
122
122
|
};
|
|
123
123
|
return {
|
|
124
|
-
id:
|
|
124
|
+
id: randomUUID(),
|
|
125
125
|
text,
|
|
126
126
|
metadata,
|
|
127
127
|
};
|
|
@@ -395,15 +395,13 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
395
395
|
// Check for tools from options AND from SDK (MCP tools)
|
|
396
396
|
// Need to check early if we should route to native SDK
|
|
397
397
|
const gemini3CheckShouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
const combinedToolCount = Object.keys(optionTools).length + Object.keys(sdkTools).length;
|
|
401
|
-
const hasTools = gemini3CheckShouldUseTools && combinedToolCount > 0;
|
|
398
|
+
const tools = options.tools || {};
|
|
399
|
+
const hasTools = gemini3CheckShouldUseTools && Object.keys(tools).length > 0;
|
|
402
400
|
if (isGemini3Model(gemini3CheckModelName) && hasTools) {
|
|
403
401
|
// Merge SDK tools into options for native SDK path
|
|
404
402
|
let mergedOptions = {
|
|
405
403
|
...options,
|
|
406
|
-
tools:
|
|
404
|
+
tools: tools,
|
|
407
405
|
};
|
|
408
406
|
// Check for tools + JSON schema conflict (Gemini limitation)
|
|
409
407
|
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
@@ -421,9 +419,7 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
421
419
|
if (hasActiveTools) {
|
|
422
420
|
logger.info("[GoogleAIStudio] Routing Gemini 3 to native SDK for tool calling", {
|
|
423
421
|
model: gemini3CheckModelName,
|
|
424
|
-
|
|
425
|
-
sdkToolCount: Object.keys(sdkTools).length,
|
|
426
|
-
totalToolCount: combinedToolCount,
|
|
422
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
427
423
|
});
|
|
428
424
|
return this.executeNativeGemini3Stream(mergedOptions);
|
|
429
425
|
}
|
|
@@ -448,14 +444,13 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
448
444
|
logger.warn("[GoogleAIStudio] Structured output active — disabling tools (Gemini limitation).");
|
|
449
445
|
}
|
|
450
446
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
? { ...baseTools, ...(options.tools || {}) }
|
|
447
|
+
const filteredTools = shouldUseTools
|
|
448
|
+
? (options.tools ?? {})
|
|
454
449
|
: {};
|
|
455
450
|
// Sanitize tool schemas for Gemini proto compatibility (converts anyOf/oneOf unions to string)
|
|
456
451
|
let tools;
|
|
457
|
-
if (Object.keys(
|
|
458
|
-
const sanitized = sanitizeToolsForGemini(
|
|
452
|
+
if (Object.keys(filteredTools).length > 0) {
|
|
453
|
+
const sanitized = sanitizeToolsForGemini(filteredTools);
|
|
459
454
|
if (sanitized.dropped.length > 0) {
|
|
460
455
|
logger.warn(`[GoogleAIStudio] Dropped ${sanitized.dropped.length} incompatible tool(s): ${sanitized.dropped.join(", ")}`);
|
|
461
456
|
}
|
|
@@ -851,10 +846,9 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
851
846
|
let executeMap = new Map();
|
|
852
847
|
const shouldUseTools = !options.disableTools;
|
|
853
848
|
if (shouldUseTools) {
|
|
854
|
-
const
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
const result = buildNativeToolDeclarations(mergedTools);
|
|
849
|
+
const tools = options.tools || {};
|
|
850
|
+
if (Object.keys(tools).length > 0) {
|
|
851
|
+
const result = buildNativeToolDeclarations(tools);
|
|
858
852
|
toolsConfig = result.toolsConfig;
|
|
859
853
|
executeMap = result.executeMap;
|
|
860
854
|
logger.debug("[GoogleAIStudio] Converted tools for native SDK generate", {
|
|
@@ -989,15 +983,12 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
989
983
|
const modelName = options.model || this.modelName;
|
|
990
984
|
// Check if we should use native SDK for Gemini 3 with tools
|
|
991
985
|
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
992
|
-
const
|
|
993
|
-
const hasTools = shouldUseTools &&
|
|
994
|
-
(Object.keys(sdkTools).length > 0 ||
|
|
995
|
-
(options.tools && Object.keys(options.tools).length > 0));
|
|
986
|
+
const hasTools = shouldUseTools && options.tools && Object.keys(options.tools).length > 0;
|
|
996
987
|
if (isGemini3Model(modelName) && hasTools) {
|
|
997
988
|
// Merge SDK tools into options for native SDK path
|
|
998
989
|
let mergedOptions = {
|
|
999
990
|
...options,
|
|
1000
|
-
tools:
|
|
991
|
+
tools: options.tools,
|
|
1001
992
|
};
|
|
1002
993
|
// Check for tools + JSON schema conflict (Gemini limitation)
|
|
1003
994
|
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
@@ -1015,10 +1006,7 @@ export class GoogleAIStudioProvider extends BaseProvider {
|
|
|
1015
1006
|
if (hasActiveTools) {
|
|
1016
1007
|
logger.info("[GoogleAIStudio] Routing Gemini 3 generate to native SDK for tool calling", {
|
|
1017
1008
|
model: modelName,
|
|
1018
|
-
|
|
1019
|
-
optionToolCount: Object.keys(options.tools || {}).length,
|
|
1020
|
-
totalToolCount: Object.keys(sdkTools).length +
|
|
1021
|
-
Object.keys(options.tools || {}).length,
|
|
1009
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
1022
1010
|
});
|
|
1023
1011
|
return this.executeNativeGemini3Generate(mergedOptions);
|
|
1024
1012
|
}
|
|
@@ -858,23 +858,19 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
858
858
|
async maybeExecuteNativeGemini3ToolStream(options, analysisSchema, modelName) {
|
|
859
859
|
const wantsStructuredOutput = analysisSchema || options.output?.format === "json" || options.schema;
|
|
860
860
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
861
|
-
const
|
|
862
|
-
const
|
|
863
|
-
const combinedToolCount = Object.keys(optionTools).length + Object.keys(sdkTools).length;
|
|
864
|
-
const hasTools = shouldUseTools && combinedToolCount > 0;
|
|
861
|
+
const tools = options.tools || {};
|
|
862
|
+
const hasTools = shouldUseTools && Object.keys(tools).length > 0;
|
|
865
863
|
if (!isGemini3Model(modelName) || !hasTools) {
|
|
866
864
|
return null;
|
|
867
865
|
}
|
|
868
866
|
const processedOptions = await this.processCSVFilesForNativeSDK(options);
|
|
869
867
|
const mergedOptions = {
|
|
870
868
|
...processedOptions,
|
|
871
|
-
tools:
|
|
869
|
+
tools: tools,
|
|
872
870
|
};
|
|
873
871
|
logger.info("[GoogleVertex] Routing Gemini 3 to native SDK for tool calling", {
|
|
874
872
|
model: modelName,
|
|
875
|
-
optionToolCount: Object.keys(
|
|
876
|
-
sdkToolCount: Object.keys(sdkTools).length,
|
|
877
|
-
totalToolCount: combinedToolCount,
|
|
873
|
+
optionToolCount: Object.keys(tools).length,
|
|
878
874
|
});
|
|
879
875
|
return this.executeNativeGemini3Stream(mergedOptions);
|
|
880
876
|
}
|
|
@@ -934,9 +930,8 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
934
930
|
}
|
|
935
931
|
async resolveAISDKStreamTools(options, modelName, functionTag) {
|
|
936
932
|
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
937
|
-
const baseStreamTools = shouldUseTools ? await this.getAllTools() : {};
|
|
938
933
|
const rawTools = shouldUseTools
|
|
939
|
-
?
|
|
934
|
+
? options.tools
|
|
940
935
|
: {};
|
|
941
936
|
const isAnthropic = isAnthropicModel(modelName);
|
|
942
937
|
let tools;
|
|
@@ -964,8 +959,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
964
959
|
}
|
|
965
960
|
logger.debug(`${functionTag}: Tools for streaming`, {
|
|
966
961
|
shouldUseTools,
|
|
967
|
-
|
|
968
|
-
externalToolCount: Object.keys(options.tools || {}).length,
|
|
962
|
+
externalToolCount: Object.keys(options.tools ?? {}).length,
|
|
969
963
|
toolCount: Object.keys(tools ?? {}).length,
|
|
970
964
|
toolNames: Object.keys(tools ?? {}),
|
|
971
965
|
});
|
|
@@ -973,7 +967,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
973
967
|
shouldUseTools,
|
|
974
968
|
tools,
|
|
975
969
|
isAnthropic,
|
|
976
|
-
baseToolCount:
|
|
970
|
+
baseToolCount: 0,
|
|
977
971
|
};
|
|
978
972
|
}
|
|
979
973
|
buildAISDKStreamOptions(params) {
|
|
@@ -1592,14 +1586,13 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
1592
1586
|
logger.warn("[GoogleVertex] Gemini does not support tools and JSON schema output simultaneously. Disabling tools for this request.");
|
|
1593
1587
|
shouldUseTools = false;
|
|
1594
1588
|
}
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
? { ...sdkTools, ...(options.tools || {}) }
|
|
1589
|
+
const tools = shouldUseTools
|
|
1590
|
+
? (options.tools ?? {})
|
|
1598
1591
|
: {};
|
|
1599
1592
|
let toolsConfig;
|
|
1600
1593
|
let executeMap = new Map();
|
|
1601
|
-
if (Object.keys(
|
|
1602
|
-
const result = buildNativeToolDeclarations(
|
|
1594
|
+
if (Object.keys(tools).length > 0) {
|
|
1595
|
+
const result = buildNativeToolDeclarations(tools);
|
|
1603
1596
|
toolsConfig = result.toolsConfig;
|
|
1604
1597
|
executeMap = result.executeMap;
|
|
1605
1598
|
logger.debug("[GoogleVertex] Converted tools for native SDK generate", {
|
|
@@ -1812,24 +1805,18 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
1812
1805
|
const wantsStructuredOutput = options.output?.format === "json" || !!options.schema;
|
|
1813
1806
|
// Check if we should use native SDK for Gemini 3 with tools
|
|
1814
1807
|
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
1815
|
-
const
|
|
1816
|
-
const hasTools = shouldUseTools &&
|
|
1817
|
-
(Object.keys(sdkTools).length > 0 ||
|
|
1818
|
-
(options.tools && Object.keys(options.tools).length > 0));
|
|
1808
|
+
const hasTools = shouldUseTools && options.tools && Object.keys(options.tools).length > 0;
|
|
1819
1809
|
if (isGemini3Model(modelName) && hasTools && !wantsStructuredOutput) {
|
|
1820
1810
|
// Process CSV files before routing to native SDK (bypasses normal message builder)
|
|
1821
1811
|
const processedOptions = await this.processCSVFilesForNativeSDK(options);
|
|
1822
1812
|
// Merge SDK tools into options for native SDK path
|
|
1823
1813
|
const mergedOptions = {
|
|
1824
1814
|
...processedOptions,
|
|
1825
|
-
tools:
|
|
1815
|
+
tools: options.tools || {},
|
|
1826
1816
|
};
|
|
1827
1817
|
logger.info("[GoogleVertex] Routing Gemini 3 generate to native SDK for tool calling", {
|
|
1828
1818
|
model: modelName,
|
|
1829
|
-
|
|
1830
|
-
optionToolCount: Object.keys(processedOptions.tools || {}).length,
|
|
1831
|
-
totalToolCount: Object.keys(sdkTools).length +
|
|
1832
|
-
Object.keys(processedOptions.tools || {}).length,
|
|
1819
|
+
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
1833
1820
|
});
|
|
1834
1821
|
return this.executeNativeGemini3Generate(mergedOptions);
|
|
1835
1822
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Abstract base class for all chunker implementations.
|
|
5
5
|
* Provides common functionality and interface contract.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
8
|
import { ChunkingError, RAGErrorCodes } from "../errors/RAGError.js";
|
|
9
9
|
import { withSpan } from "../../telemetry/withSpan.js";
|
|
10
10
|
import { tracers } from "../../telemetry/tracers.js";
|
|
@@ -121,7 +121,7 @@ export class BaseChunker {
|
|
|
121
121
|
custom: this.config.preserveMetadata ? customMetadata : undefined,
|
|
122
122
|
};
|
|
123
123
|
return {
|
|
124
|
-
id:
|
|
124
|
+
id: randomUUID(),
|
|
125
125
|
text,
|
|
126
126
|
metadata,
|
|
127
127
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.54.
|
|
3
|
+
"version": "9.54.9",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"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 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
6
6
|
"author": {
|
|
@@ -210,7 +210,6 @@
|
|
|
210
210
|
"@google-cloud/text-to-speech": "^6.4.0",
|
|
211
211
|
"@google-cloud/vertexai": "^1.10.0",
|
|
212
212
|
"@google/genai": "^1.43.0",
|
|
213
|
-
"@google/generative-ai": "^0.24.1",
|
|
214
213
|
"@huggingface/inference": "^4.13.14",
|
|
215
214
|
"@juspay/hippocampus": "^0.1.4",
|
|
216
215
|
"@langfuse/otel": "^5.0.1",
|
|
@@ -243,9 +242,7 @@
|
|
|
243
242
|
"jose": "^6.1.3",
|
|
244
243
|
"json-schema-to-zod": "^2.7.0",
|
|
245
244
|
"mammoth": "^1.11.0",
|
|
246
|
-
"mathjs": "^15.2.0",
|
|
247
245
|
"mediabunny": "^1.40.1",
|
|
248
|
-
"minisearch": "^7.2.0",
|
|
249
246
|
"music-metadata": "^11.11.2",
|
|
250
247
|
"nanoid": "^5.1.5",
|
|
251
248
|
"ollama-ai-provider": "^1.2.0",
|
|
@@ -258,9 +255,7 @@
|
|
|
258
255
|
"redis": "^5.11.0",
|
|
259
256
|
"tar-stream": "^3.1.8",
|
|
260
257
|
"undici": ">=7.22.0",
|
|
261
|
-
"uuid": "^13.0.0",
|
|
262
258
|
"ws": "^8.19.0",
|
|
263
|
-
"xml2js": "^0.6.2",
|
|
264
259
|
"yargs": "^18.0.0",
|
|
265
260
|
"zod": "^4.3.6",
|
|
266
261
|
"zod-to-json-schema": "^3.25.1"
|
|
@@ -285,7 +280,6 @@
|
|
|
285
280
|
"@hono/node-server": "^1.19.9",
|
|
286
281
|
"@koa/cors": "^5.0.0",
|
|
287
282
|
"@koa/router": "^15.3.1",
|
|
288
|
-
"canvas": "^3.2.1",
|
|
289
283
|
"cors": "^2.8.5",
|
|
290
284
|
"express": "^5.1.0",
|
|
291
285
|
"express-rate-limit": "^8.2.1",
|
|
@@ -329,7 +323,6 @@
|
|
|
329
323
|
"@types/react": "^19.2.10",
|
|
330
324
|
"@types/tar-stream": "^3.1.4",
|
|
331
325
|
"@types/ws": "^8.18.1",
|
|
332
|
-
"@types/xml2js": "^0.4.14",
|
|
333
326
|
"@types/yargs": "^17.0.35",
|
|
334
327
|
"@typescript-eslint/eslint-plugin": "^8.57.2",
|
|
335
328
|
"@typescript-eslint/parser": "^8.57.2",
|
|
@@ -405,7 +398,6 @@
|
|
|
405
398
|
"protobufjs",
|
|
406
399
|
"puppeteer",
|
|
407
400
|
"sqlite3",
|
|
408
|
-
"canvas",
|
|
409
401
|
"ffmpeg-static",
|
|
410
402
|
"sharp"
|
|
411
403
|
],
|