@juspay/neurolink 9.65.0 → 9.65.2
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 +12 -8
- package/dist/autoresearch/tools.d.ts +2 -214
- package/dist/autoresearch/tools.js +1 -1
- package/dist/browser/neurolink.min.js +362 -368
- 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/constants.d.ts +1 -0
- package/dist/core/constants.js +3 -0
- 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/redisConversationMemoryManager.js +0 -6
- 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 +12 -8
- 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/constants.d.ts +1 -0
- package/dist/lib/core/constants.js +3 -0
- 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/redisConversationMemoryManager.js +0 -6
- 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 +82 -6
- package/dist/lib/providers/googleNativeGemini3.d.ts +3 -6
- package/dist/lib/providers/googleNativeGemini3.js +104 -9
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +466 -165
- 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/rag/ragIntegration.d.ts +1 -12
- package/dist/lib/rag/ragIntegration.js +0 -8
- 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 +17 -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/rag.d.ts +1 -1
- package/dist/lib/types/rag.js +0 -6
- 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/googleAiStudio.js +82 -5
- package/dist/providers/googleNativeGemini3.d.ts +3 -6
- package/dist/providers/googleNativeGemini3.js +104 -9
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/googleVertex.js +466 -164
- 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/rag/ragIntegration.d.ts +1 -12
- package/dist/rag/ragIntegration.js +0 -8
- 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 +17 -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/rag.d.ts +1 -1
- package/dist/types/rag.js +0 -6
- 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/providers/groq.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Groq Provider
|
|
7
7
|
*
|
package/dist/providers/groq.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { GroqModels } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -14,6 +13,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
14
13
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
16
15
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
16
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
17
18
|
const GROQ_DEFAULT_BASE_URL = "https://api.groq.com/openai/v1";
|
|
18
19
|
const getGroqApiKey = () => validateApiKey(createGroqConfig());
|
|
19
20
|
const getDefaultGroqModel = () => getProviderModel("GROQ_MODEL", GroqModels.LLAMA_3_3_70B_VERSATILE);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type LanguageModel, type Schema } from "ai";
|
|
2
1
|
import type { ZodType } from "zod";
|
|
3
2
|
import type { AIProviderName } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import type { NeurolinkCredentials, StreamOptions, StreamResult } from "../types/index.js";
|
|
5
|
+
import type { LanguageModel, Schema } from "../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* HuggingFace Provider - BaseProvider Implementation
|
|
8
8
|
* Using AI SDK with HuggingFace's OpenAI-compatible endpoint
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { NoOutputGeneratedError, stepCountIs, streamText, } from "ai";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
5
4
|
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
@@ -10,6 +9,9 @@ import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } f
|
|
|
10
9
|
import { createHuggingFaceConfig, getProviderModel, validateApiKey, } from "../utils/providerConfig.js";
|
|
11
10
|
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
12
11
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
12
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
13
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
14
|
+
import { streamText } from "../utils/generation.js";
|
|
13
15
|
// Configuration helpers - now using consolidated utility
|
|
14
16
|
const getHuggingFaceApiKey = () => {
|
|
15
17
|
return validateApiKey(createHuggingFaceConfig());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { EnhancedGenerateResult, NeurolinkCredentials, StreamOptions, StreamResult, TextGenerationOptions, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Ideogram Provider — direct image generation with strong typography.
|
|
7
7
|
*
|
package/dist/providers/jina.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Jina AI Provider — embeddings + reranking.
|
|
7
7
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type LanguageModel, type Schema } from "ai";
|
|
2
1
|
import type { ZodType } from "zod";
|
|
3
2
|
import type { AIProviderName } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import type { StreamOptions, StreamResult } from "../types/index.js";
|
|
5
|
+
import type { LanguageModel, Schema } from "../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* LiteLLM Provider - BaseProvider Implementation
|
|
8
8
|
* Provides access to 100+ models via LiteLLM proxy server
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
2
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
3
|
-
import { NoOutputGeneratedError, Output, stepCountIs, streamText, } from "ai";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
6
5
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -12,9 +11,12 @@ import { logger } from "../utils/logger.js";
|
|
|
12
11
|
import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } from "../utils/noOutputSentinel.js";
|
|
13
12
|
import { calculateCost } from "../utils/pricing.js";
|
|
14
13
|
import { getProviderModel } from "../utils/providerConfig.js";
|
|
15
|
-
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
14
|
+
import { composeAbortSignals, createTimeoutController, TimeoutError, withTimeout, } from "../utils/timeout.js";
|
|
16
15
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
17
16
|
import { getModelId } from "./providerTypeUtils.js";
|
|
17
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
18
|
+
import { Output, stepCountIs } from "../utils/tool.js";
|
|
19
|
+
import { streamText } from "../utils/generation.js";
|
|
18
20
|
const streamTracer = trace.getTracer("neurolink.provider.litellm");
|
|
19
21
|
// Configuration helpers
|
|
20
22
|
const getLiteLLMConfig = () => {
|
|
@@ -425,7 +427,7 @@ export class LiteLLMProvider extends BaseProvider {
|
|
|
425
427
|
* Uses the LiteLLM proxy with OpenAI-compatible embedding API
|
|
426
428
|
*/
|
|
427
429
|
async embed(text, modelName) {
|
|
428
|
-
const { embed: aiEmbed } = await import("
|
|
430
|
+
const { embed: aiEmbed } = await import("../utils/generation.js");
|
|
429
431
|
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
430
432
|
const config = getLiteLLMConfig();
|
|
431
433
|
const embeddingModelName = modelName ||
|
|
@@ -437,7 +439,10 @@ export class LiteLLMProvider extends BaseProvider {
|
|
|
437
439
|
fetch: createProxyFetch(),
|
|
438
440
|
});
|
|
439
441
|
const embeddingModel = customOpenAI.textEmbeddingModel(embeddingModelName);
|
|
440
|
-
|
|
442
|
+
// Wrap in withTimeout so stalled upstream embedding requests abort instead
|
|
443
|
+
// of hanging forever. 30s matches the default for embedding endpoints
|
|
444
|
+
// across the OpenAI-compatible cluster.
|
|
445
|
+
const result = await withTimeout(aiEmbed({ model: embeddingModel, value: text }), 30_000, "litellm", "generate");
|
|
441
446
|
return result.embedding;
|
|
442
447
|
}
|
|
443
448
|
/**
|
|
@@ -445,7 +450,7 @@ export class LiteLLMProvider extends BaseProvider {
|
|
|
445
450
|
* Uses the LiteLLM proxy with OpenAI-compatible embedding API
|
|
446
451
|
*/
|
|
447
452
|
async embedMany(texts, modelName) {
|
|
448
|
-
const { embedMany: aiEmbedMany } = await import("
|
|
453
|
+
const { embedMany: aiEmbedMany } = await import("../utils/generation.js");
|
|
449
454
|
const { createOpenAI } = await import("@ai-sdk/openai");
|
|
450
455
|
const config = getLiteLLMConfig();
|
|
451
456
|
const embeddingModelName = modelName ||
|
|
@@ -457,7 +462,8 @@ export class LiteLLMProvider extends BaseProvider {
|
|
|
457
462
|
fetch: createProxyFetch(),
|
|
458
463
|
});
|
|
459
464
|
const embeddingModel = customOpenAI.textEmbeddingModel(embeddingModelName);
|
|
460
|
-
|
|
465
|
+
// Wrap in withTimeout so a single slow batch doesn't hang indefinitely.
|
|
466
|
+
const result = await withTimeout(aiEmbedMany({ model: embeddingModel, values: texts }), 30_000, "litellm", "generate");
|
|
461
467
|
return result.embeddings;
|
|
462
468
|
}
|
|
463
469
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* llama.cpp Provider
|
|
7
7
|
* Wraps a llama-server process (https://github.com/ggerganov/llama.cpp) that
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
5
4
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -13,6 +12,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
13
12
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
14
13
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
15
14
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
15
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
16
|
+
import { streamText } from "../utils/generation.js";
|
|
16
17
|
const LLAMACPP_DEFAULT_BASE_URL = "http://localhost:8080/v1";
|
|
17
18
|
const LLAMACPP_PLACEHOLDER_KEY = "llamacpp";
|
|
18
19
|
const FALLBACK_MODEL = "loaded-model";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* LM Studio Provider
|
|
7
7
|
* Wraps the LM Studio local server (https://lmstudio.ai/) which exposes an
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
5
4
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -13,6 +12,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
13
12
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
14
13
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
15
14
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
15
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
16
|
+
import { streamText } from "../utils/generation.js";
|
|
16
17
|
const LM_STUDIO_DEFAULT_BASE_URL = "http://localhost:1234/v1";
|
|
17
18
|
const LM_STUDIO_PLACEHOLDER_KEY = "lm-studio";
|
|
18
19
|
const FALLBACK_MODEL = "local-model";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Mistral AI Provider v2 - BaseProvider Implementation
|
|
7
7
|
* Supports official AI-SDK integration with all Mistral models
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createMistral } from "@ai-sdk/mistral";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
5
4
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -12,6 +11,8 @@ import { createMistralConfig, getProviderModel, validateApiKey, } from "../utils
|
|
|
12
11
|
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
13
12
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
14
13
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
14
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
15
|
+
import { streamText } from "../utils/generation.js";
|
|
15
16
|
// Configuration helpers - now using consolidated utility
|
|
16
17
|
const getMistralApiKey = () => {
|
|
17
18
|
return validateApiKey(createMistralConfig());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* NVIDIA NIM Provider
|
|
7
7
|
* Wraps NVIDIA's hosted (or self-hosted) inference endpoints via OpenAI-compat.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { NvidiaNimModels } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -14,6 +13,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
14
13
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
16
15
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
16
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
17
18
|
/**
|
|
18
19
|
* Decide whether a NIM 400 response body is a rejection of the named
|
|
19
20
|
* field (as opposed to an unrelated 400 that happens to mention the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel, Schema } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { StreamOptions, StreamResult, ZodUnknownSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel, Schema } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Ollama Provider v2 - BaseProvider Implementation
|
|
7
7
|
*
|
package/dist/providers/ollama.js
CHANGED
|
@@ -706,8 +706,7 @@ export class OllamaProvider extends BaseProvider {
|
|
|
706
706
|
let iteration = 0;
|
|
707
707
|
// Get all available tools (direct + MCP + external)
|
|
708
708
|
// BaseProvider.stream() pre-merges base tools + external tools into options.tools
|
|
709
|
-
const allTools = options.tools ||
|
|
710
|
-
(await this.getAllTools());
|
|
709
|
+
const allTools = options.tools || (await this.getAllTools());
|
|
711
710
|
// Convert tools to Ollama format
|
|
712
711
|
const ollamaTools = this.convertToolsToOllamaFormat(allTools);
|
|
713
712
|
span.setAttribute(ATTR.NL_TOOL_COUNT, ollamaTools.length);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeuroLink } from "../neurolink.js";
|
|
5
4
|
import type { EnhancedGenerateResult, TextGenerationOptions, ValidationSchema, StreamOptions, StreamResult } from "../types/index.js";
|
|
5
|
+
import type { LanguageModel } from "../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* OpenAI Provider v2 - BaseProvider Implementation
|
|
8
8
|
* Migrated to use factory pattern with exact Google AI provider pattern
|
package/dist/providers/openAI.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
2
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
3
|
-
import { embed, embedMany, NoOutputGeneratedError, stepCountIs, streamText, } from "ai";
|
|
4
3
|
import { AIProviderName } from "../constants/enums.js";
|
|
5
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
5
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -18,6 +17,9 @@ import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
|
18
17
|
import { MAX_IMAGE_BYTES, readBoundedBuffer } from "../utils/sizeGuard.js";
|
|
19
18
|
import { assertSafeUrl } from "../utils/ssrfGuard.js";
|
|
20
19
|
import { getModelId } from "./providerTypeUtils.js";
|
|
20
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
21
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
22
|
+
import { embed, embedMany, streamText } from "../utils/generation.js";
|
|
21
23
|
/**
|
|
22
24
|
* Retrieve a tool's schema, handling both AI SDK v6 (`inputSchema`) and
|
|
23
25
|
* legacy v4 (`parameters`) field names.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type LanguageModel, type Schema } from "ai";
|
|
2
1
|
import type { ZodType } from "zod";
|
|
3
2
|
import { AIProviderName } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import type { StreamOptions, StreamResult } from "../types/index.js";
|
|
5
|
+
import type { LanguageModel, Schema } from "../types/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* OpenRouter Provider - BaseProvider Implementation
|
|
8
8
|
* Provides access to 300+ models from 60+ providers via OpenRouter unified gateway
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
2
|
-
import { NoOutputGeneratedError, Output, stepCountIs, streamText, } from "ai";
|
|
3
2
|
import { AIProviderName } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -13,6 +12,9 @@ import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } f
|
|
|
13
12
|
import { getProviderModel } from "../utils/providerConfig.js";
|
|
14
13
|
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
15
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
16
|
+
import { Output, stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
16
18
|
// Constants
|
|
17
19
|
const MODELS_DISCOVERY_TIMEOUT_MS = 5000; // 5 seconds for model discovery
|
|
18
20
|
// Configuration helpers
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel, type Schema } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { StreamOptions, StreamResult, ZodUnknownSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel, Schema } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* OpenAI Compatible Provider - BaseProvider Implementation
|
|
7
7
|
* Provides access to one of the OpenAI-compatible endpoint (OpenRouter, vLLM, LiteLLM, etc.)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { NoOutputGeneratedError, stepCountIs, streamText, } from "ai";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
5
4
|
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
@@ -11,6 +10,9 @@ import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } f
|
|
|
11
10
|
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../utils/timeout.js";
|
|
12
11
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
13
12
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
13
|
+
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
14
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
15
|
+
import { streamText } from "../utils/generation.js";
|
|
14
16
|
// Constants
|
|
15
17
|
const FALLBACK_OPENAI_COMPATIBLE_MODEL = "gpt-3.5-turbo";
|
|
16
18
|
// Configuration helpers
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Perplexity Provider
|
|
7
7
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { PerplexityModels } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -14,6 +13,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
14
13
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
16
15
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
16
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
17
18
|
const PERPLEXITY_DEFAULT_BASE_URL = "https://api.perplexity.ai";
|
|
18
19
|
const getPerplexityApiKey = () => validateApiKey(createPerplexityConfig());
|
|
19
20
|
const getDefaultPerplexityModel = () => getProviderModel("PERPLEXITY_MODEL", PerplexityModels.SONAR);
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared type utilities for AI SDK provider integration.
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe helpers to bridge between the AI SDK's generic types
|
|
5
|
-
* and NeuroLink's internal type system without resorting to `as any` casts.
|
|
6
|
-
*/
|
|
7
|
-
import type { LanguageModel, streamText } from "ai";
|
|
8
1
|
import type { StreamTextResult } from "../types/index.js";
|
|
2
|
+
import type { LanguageModel } from "../types/index.js";
|
|
3
|
+
import type { streamText } from "../utils/generation.js";
|
|
9
4
|
/**
|
|
10
5
|
* Extract the model identifier from a LanguageModel value.
|
|
11
6
|
*
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared type utilities for AI SDK provider integration.
|
|
3
|
-
*
|
|
4
|
-
* Provides type-safe helpers to bridge between the AI SDK's generic types
|
|
5
|
-
* and NeuroLink's internal type system without resorting to `as any` casts.
|
|
6
|
-
*/
|
|
7
1
|
/**
|
|
8
2
|
* Type guard: checks whether a LanguageModel value is an object with `modelId`
|
|
9
3
|
* (i.e. LanguageModelV2 or LanguageModelV3) rather than a bare string ID.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { EnhancedGenerateResult, NeurolinkCredentials, StreamOptions, StreamResult, TextGenerationOptions, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Recraft Provider — image generation with vector / illustration focus.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { EnhancedGenerateResult, NeurolinkCredentials, StreamOptions, StreamResult, TextGenerationOptions, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Replicate LLM Provider — predict-then-stream pattern.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { EnhancedGenerateResult, NeurolinkCredentials, StreamOptions, StreamResult, TextGenerationOptions, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Stability AI Provider — direct image generation.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Together AI Provider
|
|
7
7
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { TogetherAIModels } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -14,6 +13,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
14
13
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
16
15
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
16
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
17
18
|
const TOGETHER_DEFAULT_BASE_URL = "https://api.together.xyz/v1";
|
|
18
19
|
const getTogetherApiKey = () => validateApiKey(createTogetherAIConfig());
|
|
19
20
|
const getDefaultTogetherModel = () => getProviderModel("TOGETHER_MODEL", TogetherAIModels.LLAMA_3_3_70B_INSTRUCT_TURBO);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Voyage AI Provider — embedding-only.
|
|
7
7
|
*
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type LanguageModel } from "ai";
|
|
2
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
3
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
4
3
|
import type { NeurolinkCredentials, StreamOptions, StreamResult, ValidationSchema } from "../types/index.js";
|
|
4
|
+
import type { LanguageModel } from "../types/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* xAI Grok Provider
|
|
7
7
|
*
|
package/dist/providers/xai.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { stepCountIs, streamText } from "ai";
|
|
3
2
|
import { XaiModels } from "../constants/enums.js";
|
|
4
3
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
4
|
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
@@ -14,6 +13,8 @@ import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../
|
|
|
14
13
|
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
15
14
|
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
16
15
|
import { toAnalyticsStreamResult } from "./providerTypeUtils.js";
|
|
16
|
+
import { stepCountIs } from "../utils/tool.js";
|
|
17
|
+
import { streamText } from "../utils/generation.js";
|
|
17
18
|
/**
|
|
18
19
|
* Logging fetch wrapper — masks the proxy URL on non-2xx responses so
|
|
19
20
|
* stack traces and log lines don't leak the upstream's internal token /
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Messages API format conversion layer.
|
|
3
|
-
*
|
|
4
|
-
* Provides a request parser (Claude -> NeuroLink), a response serializer
|
|
5
|
-
* (NeuroLink -> Claude), a streaming SSE state machine, and an error
|
|
6
|
-
* envelope helper. Together they allow NeuroLink to act as a
|
|
7
|
-
* drop-in Claude API proxy.
|
|
8
|
-
*
|
|
9
|
-
* Reference: https://docs.anthropic.com/en/api/messages
|
|
10
|
-
*/
|
|
11
1
|
import type { ClaudeErrorResponse, ClaudeRequest, ClaudeResponse, ContentBlockType, InternalResult, ParsedClaudeRequest, StreamLifecycleState } from "../types/index.js";
|
|
12
2
|
/** Generate a unique message id in the Claude format. */
|
|
13
3
|
export declare function generateMessageId(): string;
|
|
14
4
|
/** Generate a Claude-format tool use ID (`toolu_` + 24 random chars). */
|
|
15
5
|
export declare function generateToolUseId(): string;
|
|
16
|
-
/**
|
|
17
|
-
* Reset the internal id counter (useful in tests).
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
export declare function _resetIdCounter(): void;
|
|
21
6
|
/**
|
|
22
7
|
* Parse an incoming Claude Messages API request into an intermediate
|
|
23
8
|
* representation consumable by NeuroLink's generate/stream pipeline.
|
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude Messages API format conversion layer.
|
|
3
|
-
*
|
|
4
|
-
* Provides a request parser (Claude -> NeuroLink), a response serializer
|
|
5
|
-
* (NeuroLink -> Claude), a streaming SSE state machine, and an error
|
|
6
|
-
* envelope helper. Together they allow NeuroLink to act as a
|
|
7
|
-
* drop-in Claude API proxy.
|
|
8
|
-
*
|
|
9
|
-
* Reference: https://docs.anthropic.com/en/api/messages
|
|
10
|
-
*/
|
|
11
|
-
import { jsonSchema, tool } from "ai";
|
|
12
1
|
import { randomBytes } from "crypto";
|
|
13
2
|
import { normalizeJsonSchemaObject } from "../utils/schemaConversion.js";
|
|
3
|
+
import { jsonSchema, tool } from "../utils/tool.js";
|
|
14
4
|
// ---------------------------------------------------------------------------
|
|
15
5
|
// Helpers
|
|
16
6
|
// ---------------------------------------------------------------------------
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RAG Integration for generate() and stream()
|
|
3
|
-
*
|
|
4
|
-
* Provides automatic RAG pipeline setup when `rag` config is provided
|
|
5
|
-
* in GenerateOptions or StreamOptions. Handles file loading, chunking,
|
|
6
|
-
* embedding generation, vector storage, and tool creation internally
|
|
7
|
-
* so developers only need to pass `rag: { files: [...] }`.
|
|
8
|
-
*/
|
|
9
1
|
import type { RAGConfig, VectorQueryResult, RAGPreparedTool } from "../types/index.js";
|
|
10
2
|
/**
|
|
11
3
|
* Generate deterministic embeddings for chunks.
|
|
@@ -35,7 +27,4 @@ declare function diversifyResults(results: VectorQueryResult[], topK: number): V
|
|
|
35
27
|
* @returns Prepared RAG tool to inject into the tools record
|
|
36
28
|
*/
|
|
37
29
|
export declare function prepareRAGTool(ragConfig: RAGConfig, fallbackProvider?: string): Promise<RAGPreparedTool>;
|
|
38
|
-
|
|
39
|
-
export { generateSimpleEmbedding as _generateSimpleEmbedding };
|
|
40
|
-
/** @internal Exported for testing only */
|
|
41
|
-
export { diversifyResults as _diversifyResults };
|
|
30
|
+
export {};
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RAG Integration for generate() and stream()
|
|
3
|
-
*
|
|
4
|
-
* Provides automatic RAG pipeline setup when `rag` config is provided
|
|
5
|
-
* in GenerateOptions or StreamOptions. Handles file loading, chunking,
|
|
6
|
-
* embedding generation, vector storage, and tool creation internally
|
|
7
|
-
* so developers only need to pass `rag: { files: [...] }`.
|
|
8
|
-
*/
|
|
9
1
|
import { existsSync, readFileSync } from "fs";
|
|
10
2
|
import { extname, resolve } from "path";
|
|
11
3
|
import { z } from "zod";
|