@juspay/neurolink 10.12.9 → 11.1.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 +32 -0
- package/dist/browser/neurolink.min.js +504 -506
- package/dist/cli/commands/setup.d.ts +20 -1
- package/dist/cli/commands/setup.js +160 -36
- package/dist/cli/factories/commandFactory.d.ts +1157 -1
- package/dist/cli/factories/commandFactory.js +20 -53
- package/dist/core/baseProvider.js +3 -3
- package/dist/core/dynamicModels.d.ts +1 -1
- package/dist/core/dynamicModels.js +1 -23
- package/dist/core/modelConfiguration.d.ts +1 -70
- package/dist/core/modelConfiguration.js +0 -303
- package/dist/core/modules/GenerationHandler.js +2 -2
- package/dist/core/modules/structuredOutputPolicy.d.ts +2 -2
- package/dist/core/modules/structuredOutputPolicy.js +2 -2
- package/dist/factories/providerDescriptors.d.ts +18 -0
- package/dist/factories/providerDescriptors.js +536 -0
- package/dist/factories/providerFactory.d.ts +28 -2
- package/dist/factories/providerFactory.js +53 -42
- package/dist/factories/providerRegistry.js +33 -32
- package/dist/index.d.ts +10 -1
- package/dist/index.js +13 -3
- package/dist/lib/core/baseProvider.js +3 -3
- package/dist/lib/core/dynamicModels.d.ts +1 -1
- package/dist/lib/core/dynamicModels.js +1 -23
- package/dist/lib/core/modelConfiguration.d.ts +1 -70
- package/dist/lib/core/modelConfiguration.js +0 -303
- package/dist/lib/core/modules/GenerationHandler.js +2 -2
- package/dist/lib/core/modules/structuredOutputPolicy.d.ts +2 -2
- package/dist/lib/core/modules/structuredOutputPolicy.js +2 -2
- package/dist/lib/factories/providerDescriptors.d.ts +18 -0
- package/dist/lib/factories/providerDescriptors.js +537 -0
- package/dist/lib/factories/providerFactory.d.ts +28 -2
- package/dist/lib/factories/providerFactory.js +53 -42
- package/dist/lib/factories/providerRegistry.js +33 -32
- package/dist/lib/index.d.ts +10 -1
- package/dist/lib/index.js +13 -3
- package/dist/lib/models/anthropicModels.d.ts +0 -7
- package/dist/lib/models/anthropicModels.js +0 -9
- package/dist/lib/neurolink.js +25 -37
- package/dist/lib/providers/amazonBedrock/client.js +34 -16
- package/dist/lib/providers/anthropic/client.js +39 -34
- package/dist/lib/providers/anthropic/constants.d.ts +0 -1
- package/dist/lib/providers/anthropic/constants.js +0 -2
- package/dist/lib/providers/anthropic/index.d.ts +0 -1
- package/dist/lib/providers/anthropic/index.js +0 -1
- package/dist/lib/providers/azureOpenai.js +17 -15
- package/dist/lib/providers/cloudflare.js +12 -21
- package/dist/lib/providers/cohere.js +31 -25
- package/dist/lib/providers/deepseek.js +23 -26
- package/dist/lib/providers/fireworks.js +12 -21
- package/dist/lib/providers/googleAiStudio/client.d.ts +2 -0
- package/dist/lib/providers/googleAiStudio/client.js +39 -17
- package/dist/lib/providers/googleAiStudio/index.d.ts +0 -1
- package/dist/lib/providers/googleAiStudio/index.js +0 -1
- package/dist/lib/providers/googleNativeGemini3/index.d.ts +0 -1
- package/dist/lib/providers/googleNativeGemini3/index.js +0 -1
- package/dist/lib/providers/googleVertex/client.d.ts +0 -51
- package/dist/lib/providers/googleVertex/client.js +107 -777
- package/dist/lib/providers/groq.js +19 -22
- package/dist/lib/providers/huggingFace/client.d.ts +1 -1
- package/dist/lib/providers/huggingFace/client.js +27 -25
- package/dist/lib/providers/huggingFace/index.d.ts +0 -1
- package/dist/lib/providers/huggingFace/index.js +0 -1
- package/dist/lib/providers/jina.d.ts +0 -1
- package/dist/lib/providers/jina.js +0 -1
- package/dist/lib/providers/litellm/client.js +54 -39
- package/dist/lib/providers/litellm/index.d.ts +0 -2
- package/dist/lib/providers/litellm/index.js +0 -2
- package/dist/lib/providers/llamaCpp.d.ts +1 -0
- package/dist/lib/providers/llamaCpp.js +24 -18
- package/dist/lib/providers/lmStudio.js +25 -42
- package/dist/lib/providers/mistral.js +12 -24
- package/dist/lib/providers/nvidiaNim/client.js +37 -34
- package/dist/lib/providers/nvidiaNim/index.d.ts +0 -1
- package/dist/lib/providers/nvidiaNim/index.js +0 -1
- package/dist/lib/providers/ollama/client.js +51 -58
- package/dist/lib/providers/ollama/index.d.ts +0 -1
- package/dist/lib/providers/ollama/index.js +0 -1
- package/dist/lib/providers/openAI/client.js +37 -40
- package/dist/lib/providers/openAI/index.d.ts +0 -2
- package/dist/lib/providers/openAI/index.js +0 -2
- package/dist/lib/providers/openRouter/client.js +53 -47
- package/dist/lib/providers/openRouter/utils.d.ts +0 -2
- package/dist/lib/providers/openRouter/utils.js +0 -12
- package/dist/lib/providers/openaiChatCompletionsBase.d.ts +9 -0
- package/dist/lib/providers/openaiChatCompletionsBase.js +73 -16
- package/dist/lib/providers/openaiCompatible/client.js +36 -32
- package/dist/lib/providers/perplexity.d.ts +2 -1
- package/dist/lib/providers/perplexity.js +14 -22
- package/dist/lib/providers/replicate.d.ts +0 -1
- package/dist/lib/providers/replicate.js +22 -9
- package/dist/lib/providers/togetherAi.js +12 -21
- package/dist/lib/providers/voyage.d.ts +0 -1
- package/dist/lib/providers/voyage.js +0 -1
- package/dist/lib/providers/xai.js +17 -26
- package/dist/lib/server/errors.d.ts +1 -1
- package/dist/lib/server/errors.js +2 -2
- package/dist/lib/server/index.d.ts +2 -2
- package/dist/lib/server/index.js +5 -3
- package/dist/lib/server/middleware/rateLimit.d.ts +0 -4
- package/dist/lib/server/middleware/rateLimit.js +0 -4
- package/dist/lib/types/errors.d.ts +35 -0
- package/dist/lib/types/index.d.ts +0 -1
- package/dist/lib/types/index.js +0 -1
- package/dist/lib/types/providers.d.ts +66 -11
- package/dist/lib/utils/errorClassifier.d.ts +30 -0
- package/dist/lib/utils/errorClassifier.js +94 -0
- package/dist/lib/utils/fileDetector.js +6 -43
- package/dist/lib/utils/providerConfig.d.ts +0 -8
- package/dist/lib/utils/providerConfig.js +0 -37
- package/dist/lib/utils/providerHealth.d.ts +42 -7
- package/dist/lib/utils/providerHealth.js +115 -122
- package/dist/lib/utils/providerUtils.js +21 -87
- package/dist/models/anthropicModels.d.ts +0 -7
- package/dist/models/anthropicModels.js +0 -9
- package/dist/neurolink.js +25 -37
- package/dist/providers/amazonBedrock/client.js +34 -16
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/anthropic/client.js +39 -34
- package/dist/providers/anthropic/constants.d.ts +0 -1
- package/dist/providers/anthropic/constants.js +0 -2
- package/dist/providers/anthropic/index.d.ts +0 -1
- package/dist/providers/anthropic/index.js +0 -1
- package/dist/providers/azureOpenai.js +17 -15
- package/dist/providers/cloudflare.js +12 -21
- package/dist/providers/cohere.js +31 -25
- package/dist/providers/deepseek.js +23 -26
- package/dist/providers/fireworks.js +12 -21
- package/dist/providers/googleAiStudio/client.d.ts +2 -0
- package/dist/providers/googleAiStudio/client.js +39 -17
- package/dist/providers/googleAiStudio/index.d.ts +0 -1
- package/dist/providers/googleAiStudio/index.js +0 -1
- package/dist/providers/googleNativeGemini3/index.d.ts +0 -1
- package/dist/providers/googleNativeGemini3/index.js +0 -1
- package/dist/providers/googleVertex/client.d.ts +0 -51
- package/dist/providers/googleVertex/client.js +107 -777
- package/dist/providers/groq.js +19 -22
- package/dist/providers/huggingFace/client.d.ts +1 -1
- package/dist/providers/huggingFace/client.js +27 -25
- package/dist/providers/huggingFace/index.d.ts +0 -1
- package/dist/providers/huggingFace/index.js +0 -1
- package/dist/providers/jina.d.ts +0 -1
- package/dist/providers/jina.js +0 -1
- package/dist/providers/litellm/client.js +54 -39
- package/dist/providers/litellm/index.d.ts +0 -2
- package/dist/providers/litellm/index.js +0 -2
- package/dist/providers/llamaCpp.d.ts +1 -0
- package/dist/providers/llamaCpp.js +24 -18
- package/dist/providers/lmStudio.js +25 -42
- package/dist/providers/mistral.js +12 -24
- package/dist/providers/nvidiaNim/client.js +37 -34
- package/dist/providers/nvidiaNim/index.d.ts +0 -1
- package/dist/providers/nvidiaNim/index.js +0 -1
- package/dist/providers/ollama/client.js +51 -58
- package/dist/providers/ollama/index.d.ts +0 -1
- package/dist/providers/ollama/index.js +0 -1
- package/dist/providers/openAI/client.js +37 -40
- package/dist/providers/openAI/index.d.ts +0 -2
- package/dist/providers/openAI/index.js +0 -2
- package/dist/providers/openRouter/client.js +53 -47
- package/dist/providers/openRouter/utils.d.ts +0 -2
- package/dist/providers/openRouter/utils.js +0 -12
- package/dist/providers/openaiChatCompletionsBase.d.ts +9 -0
- package/dist/providers/openaiChatCompletionsBase.js +73 -16
- package/dist/providers/openaiCompatible/client.js +36 -32
- package/dist/providers/perplexity.d.ts +2 -1
- package/dist/providers/perplexity.js +14 -22
- package/dist/providers/replicate.d.ts +0 -1
- package/dist/providers/replicate.js +22 -9
- package/dist/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/providers/togetherAi.js +12 -21
- package/dist/providers/voyage.d.ts +0 -1
- package/dist/providers/voyage.js +0 -1
- package/dist/providers/xai.js +17 -26
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/errors.js +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +5 -3
- package/dist/server/middleware/rateLimit.d.ts +0 -4
- package/dist/server/middleware/rateLimit.js +0 -4
- package/dist/types/errors.d.ts +35 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/providers.d.ts +66 -11
- package/dist/utils/errorClassifier.d.ts +30 -0
- package/dist/utils/errorClassifier.js +93 -0
- package/dist/utils/fileDetector.js +6 -43
- package/dist/utils/providerConfig.d.ts +0 -8
- package/dist/utils/providerConfig.js +0 -37
- package/dist/utils/providerHealth.d.ts +42 -7
- package/dist/utils/providerHealth.js +115 -122
- package/dist/utils/providerUtils.js +21 -87
- package/package.json +21 -75
- package/dist/lib/providers/anthropic/utils.d.ts +0 -7
- package/dist/lib/providers/anthropic/utils.js +0 -150
- package/dist/lib/providers/googleAiStudio/utils.d.ts +0 -2
- package/dist/lib/providers/googleAiStudio/utils.js +0 -19
- package/dist/lib/providers/googleNativeGemini3/constants.d.ts +0 -1
- package/dist/lib/providers/googleNativeGemini3/constants.js +0 -2
- package/dist/lib/providers/huggingFace/utils.d.ts +0 -2
- package/dist/lib/providers/huggingFace/utils.js +0 -8
- package/dist/lib/providers/index.d.ts +0 -33
- package/dist/lib/providers/index.js +0 -34
- package/dist/lib/providers/litellm/constants.d.ts +0 -1
- package/dist/lib/providers/litellm/constants.js +0 -3
- package/dist/lib/providers/litellm/utils.d.ts +0 -5
- package/dist/lib/providers/litellm/utils.js +0 -11
- package/dist/lib/providers/nvidiaNim/utils.d.ts +0 -9
- package/dist/lib/providers/nvidiaNim/utils.js +0 -101
- package/dist/lib/providers/ollama/utils.d.ts +0 -8
- package/dist/lib/providers/ollama/utils.js +0 -43
- package/dist/lib/providers/openAI/constants.d.ts +0 -1
- package/dist/lib/providers/openAI/constants.js +0 -3
- package/dist/lib/providers/openAI/utils.d.ts +0 -2
- package/dist/lib/providers/openAI/utils.js +0 -8
- package/dist/lib/types/universalProviderOptions.d.ts +0 -89
- package/dist/lib/types/universalProviderOptions.js +0 -55
- package/dist/providers/anthropic/utils.d.ts +0 -7
- package/dist/providers/anthropic/utils.js +0 -149
- package/dist/providers/googleAiStudio/utils.d.ts +0 -2
- package/dist/providers/googleAiStudio/utils.js +0 -18
- package/dist/providers/googleNativeGemini3/constants.d.ts +0 -1
- package/dist/providers/googleNativeGemini3/constants.js +0 -1
- package/dist/providers/huggingFace/utils.d.ts +0 -2
- package/dist/providers/huggingFace/utils.js +0 -7
- package/dist/providers/index.d.ts +0 -33
- package/dist/providers/index.js +0 -33
- package/dist/providers/litellm/constants.d.ts +0 -1
- package/dist/providers/litellm/constants.js +0 -2
- package/dist/providers/litellm/utils.d.ts +0 -5
- package/dist/providers/litellm/utils.js +0 -10
- package/dist/providers/nvidiaNim/utils.d.ts +0 -9
- package/dist/providers/nvidiaNim/utils.js +0 -100
- package/dist/providers/ollama/utils.d.ts +0 -8
- package/dist/providers/ollama/utils.js +0 -42
- package/dist/providers/openAI/constants.d.ts +0 -1
- package/dist/providers/openAI/constants.js +0 -2
- package/dist/providers/openAI/utils.d.ts +0 -2
- package/dist/providers/openAI/utils.js +0 -7
- package/dist/types/universalProviderOptions.d.ts +0 -89
- package/dist/types/universalProviderOptions.js +0 -54
|
@@ -5,8 +5,27 @@
|
|
|
5
5
|
* Provides a beautiful welcome experience for new users and guided
|
|
6
6
|
* provider selection, while delegating to existing setup commands.
|
|
7
7
|
*/
|
|
8
|
-
import type { SetupArgs } from "../../lib/types/index.js";
|
|
8
|
+
import type { ProviderConfigOptions, SetupArgs } from "../../lib/types/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* ProviderConfigOptions for the 21 canonical AIProviderName values the
|
|
11
|
+
* interactive wizard above doesn't have a bespoke handleXSetup() for. 16
|
|
12
|
+
* reuse the existing createXConfig() factories in providerConfig.ts; the
|
|
13
|
+
* remaining 5 (ollama, litellm, sagemaker, lm-studio, llamacpp) don't have a
|
|
14
|
+
* factory and are defined inline using their real env var names. lm-studio
|
|
15
|
+
* and llamacpp previously had createLmStudioConfig()/createLlamaCppConfig()
|
|
16
|
+
* factories, but those were removed as dead code in a later cleanup — this
|
|
17
|
+
* mirrors that removal rather than re-adding them.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EXTRA_PROVIDER_CONFIGS: Record<string, ProviderConfigOptions>;
|
|
9
20
|
/**
|
|
10
21
|
* Main setup command handler
|
|
11
22
|
*/
|
|
12
23
|
export declare function handleSetup(argv: SetupArgs): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Check which providers are already configured
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkExistingConfigurations(): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Delegate to existing provider setup commands
|
|
30
|
+
*/
|
|
31
|
+
export declare function delegateToProviderSetup(providerId: string): Promise<void>;
|
|
@@ -19,6 +19,8 @@ import { handleBedrockSetup } from "./setup-bedrock.js";
|
|
|
19
19
|
import { handleGCPSetup } from "./setup-gcp.js";
|
|
20
20
|
import { handleHuggingFaceSetup } from "./setup-huggingface.js";
|
|
21
21
|
import { handleMistralSetup } from "./setup-mistral.js";
|
|
22
|
+
import { PROVIDER_DESCRIPTORS_BY_NAME } from "../../lib/factories/providerDescriptors.js";
|
|
23
|
+
import { createCloudflareConfig, createCohereConfig, createDeepSeekConfig, createFireworksConfig, createGroqConfig, createIdeogramConfig, createJinaConfig, createNvidiaNimConfig, createOpenAICompatibleConfig, createPerplexityConfig, createRecraftConfig, createReplicateConfig, createStabilityConfig, createTogetherAIConfig, createVoyageConfig, createXaiConfig, } from "../../lib/utils/providerConfig.js";
|
|
22
24
|
// Provider information database
|
|
23
25
|
const PROVIDERS = [
|
|
24
26
|
{
|
|
@@ -139,6 +141,137 @@ const PROVIDERS = [
|
|
|
139
141
|
setupCommand: "neurolink setup --provider openrouter",
|
|
140
142
|
},
|
|
141
143
|
];
|
|
144
|
+
/**
|
|
145
|
+
* ProviderConfigOptions for the 21 canonical AIProviderName values the
|
|
146
|
+
* interactive wizard above doesn't have a bespoke handleXSetup() for. 16
|
|
147
|
+
* reuse the existing createXConfig() factories in providerConfig.ts; the
|
|
148
|
+
* remaining 5 (ollama, litellm, sagemaker, lm-studio, llamacpp) don't have a
|
|
149
|
+
* factory and are defined inline using their real env var names. lm-studio
|
|
150
|
+
* and llamacpp previously had createLmStudioConfig()/createLlamaCppConfig()
|
|
151
|
+
* factories, but those were removed as dead code in a later cleanup — this
|
|
152
|
+
* mirrors that removal rather than re-adding them.
|
|
153
|
+
*/
|
|
154
|
+
export const EXTRA_PROVIDER_CONFIGS = {
|
|
155
|
+
"openai-compatible": createOpenAICompatibleConfig(),
|
|
156
|
+
deepseek: createDeepSeekConfig(),
|
|
157
|
+
"nvidia-nim": createNvidiaNimConfig(),
|
|
158
|
+
xai: createXaiConfig(),
|
|
159
|
+
groq: createGroqConfig(),
|
|
160
|
+
cohere: createCohereConfig(),
|
|
161
|
+
replicate: createReplicateConfig(),
|
|
162
|
+
"together-ai": createTogetherAIConfig(),
|
|
163
|
+
fireworks: createFireworksConfig(),
|
|
164
|
+
perplexity: createPerplexityConfig(),
|
|
165
|
+
voyage: createVoyageConfig(),
|
|
166
|
+
jina: createJinaConfig(),
|
|
167
|
+
stability: createStabilityConfig(),
|
|
168
|
+
ideogram: createIdeogramConfig(),
|
|
169
|
+
recraft: createRecraftConfig(),
|
|
170
|
+
cloudflare: createCloudflareConfig(),
|
|
171
|
+
ollama: {
|
|
172
|
+
providerName: "Ollama",
|
|
173
|
+
envVarName: "OLLAMA_BASE_URL",
|
|
174
|
+
setupUrl: "https://ollama.com/download",
|
|
175
|
+
description: "Run open-source models locally via Ollama's OpenAI-compatible API.",
|
|
176
|
+
instructions: [
|
|
177
|
+
"Install Ollama from https://ollama.com/download",
|
|
178
|
+
"Pull a model: ollama pull llama3.1",
|
|
179
|
+
"Ollama serves its API at http://localhost:11434 by default — set OLLAMA_BASE_URL only to override.",
|
|
180
|
+
"Optionally set OLLAMA_MODEL to choose the default model.",
|
|
181
|
+
],
|
|
182
|
+
optional: true,
|
|
183
|
+
},
|
|
184
|
+
litellm: {
|
|
185
|
+
providerName: "LiteLLM",
|
|
186
|
+
envVarName: "LITELLM_API_KEY",
|
|
187
|
+
setupUrl: "https://docs.litellm.ai/docs/simple_proxy",
|
|
188
|
+
description: "Route through a LiteLLM proxy server for unified access to 100+ upstream providers.",
|
|
189
|
+
instructions: [
|
|
190
|
+
"Start a LiteLLM proxy server (see https://docs.litellm.ai/docs/simple_proxy).",
|
|
191
|
+
"Set LITELLM_BASE_URL to the proxy's URL (defaults to http://localhost:4000).",
|
|
192
|
+
"Set LITELLM_API_KEY to the proxy's virtual key (defaults to a permissive placeholder for local proxies without auth).",
|
|
193
|
+
],
|
|
194
|
+
fallbackEnvVars: ["LITELLM_BASE_URL"],
|
|
195
|
+
optional: true,
|
|
196
|
+
},
|
|
197
|
+
sagemaker: {
|
|
198
|
+
providerName: "Amazon SageMaker",
|
|
199
|
+
envVarName: "SAGEMAKER_ENDPOINT_NAME",
|
|
200
|
+
setupUrl: "https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints.html",
|
|
201
|
+
description: "Invoke a self-hosted model on an Amazon SageMaker real-time inference endpoint.",
|
|
202
|
+
instructions: [
|
|
203
|
+
"Deploy a model to a SageMaker real-time endpoint (see AWS docs above).",
|
|
204
|
+
"Set SAGEMAKER_ENDPOINT_NAME to the deployed endpoint's name.",
|
|
205
|
+
"Set SAGEMAKER_REGION to the AWS region hosting the endpoint.",
|
|
206
|
+
"Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (or use an AWS credential provider chain) for authentication.",
|
|
207
|
+
],
|
|
208
|
+
fallbackEnvVars: [
|
|
209
|
+
"SAGEMAKER_REGION",
|
|
210
|
+
"AWS_ACCESS_KEY_ID",
|
|
211
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
212
|
+
],
|
|
213
|
+
optional: false,
|
|
214
|
+
},
|
|
215
|
+
"lm-studio": {
|
|
216
|
+
providerName: "LM Studio",
|
|
217
|
+
envVarName: "LM_STUDIO_BASE_URL",
|
|
218
|
+
setupUrl: "https://lmstudio.ai/",
|
|
219
|
+
description: "Run open-source models locally via LM Studio's OpenAI-compatible API.",
|
|
220
|
+
instructions: [
|
|
221
|
+
"Install LM Studio from https://lmstudio.ai/",
|
|
222
|
+
'Load a model in the LM Studio app and click "Start Server".',
|
|
223
|
+
"LM Studio serves its API at http://localhost:1234/v1 by default — set LM_STUDIO_BASE_URL only to override.",
|
|
224
|
+
"Optionally set LM_STUDIO_API_KEY if running behind an auth-proxying reverse proxy.",
|
|
225
|
+
"Optionally set LM_STUDIO_MODEL to choose the default model.",
|
|
226
|
+
],
|
|
227
|
+
fallbackEnvVars: ["LM_STUDIO_API_KEY", "LM_STUDIO_MODEL"],
|
|
228
|
+
optional: true,
|
|
229
|
+
},
|
|
230
|
+
llamacpp: {
|
|
231
|
+
providerName: "llama.cpp",
|
|
232
|
+
envVarName: "LLAMACPP_BASE_URL",
|
|
233
|
+
setupUrl: "https://github.com/ggerganov/llama.cpp",
|
|
234
|
+
description: "Run a self-hosted GGUF model locally via llama.cpp's OpenAI-compatible llama-server.",
|
|
235
|
+
instructions: [
|
|
236
|
+
"Build or install llama.cpp from https://github.com/ggerganov/llama.cpp",
|
|
237
|
+
"Start the server: ./llama-server -m model.gguf --port 8080",
|
|
238
|
+
"llama-server serves its API at http://localhost:8080/v1 by default — set LLAMACPP_BASE_URL only to override.",
|
|
239
|
+
"Optionally set LLAMACPP_API_KEY if running behind an auth-proxying reverse proxy.",
|
|
240
|
+
"Optionally set LLAMACPP_MODEL to choose the default model.",
|
|
241
|
+
],
|
|
242
|
+
fallbackEnvVars: ["LLAMACPP_API_KEY", "LLAMACPP_MODEL"],
|
|
243
|
+
optional: true,
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Generic, data-driven setup printout for providers without a bespoke
|
|
248
|
+
* interactive handler — reads directly from a ProviderConfigOptions entry.
|
|
249
|
+
*/
|
|
250
|
+
function printGenericProviderSetup(providerId, config) {
|
|
251
|
+
logger.always("");
|
|
252
|
+
logger.always(chalk.blue(`🔧 ${config.providerName} Setup`));
|
|
253
|
+
logger.always("");
|
|
254
|
+
logger.always(config.description);
|
|
255
|
+
logger.always("");
|
|
256
|
+
logger.always(chalk.yellow("Setup steps:"));
|
|
257
|
+
config.instructions.forEach((step, index) => {
|
|
258
|
+
logger.always(` ${index + 1}. ${step}`);
|
|
259
|
+
});
|
|
260
|
+
logger.always("");
|
|
261
|
+
logger.always(chalk.yellow("Environment variable:"));
|
|
262
|
+
const optionalNote = config.optional
|
|
263
|
+
? " (optional — has a working local default)"
|
|
264
|
+
: "";
|
|
265
|
+
logger.always(chalk.cyan(` export ${config.envVarName}=your_value_here${optionalNote}`));
|
|
266
|
+
if (config.fallbackEnvVars?.length) {
|
|
267
|
+
logger.always(chalk.cyan(` Also relevant: ${config.fallbackEnvVars.join(", ")}`));
|
|
268
|
+
}
|
|
269
|
+
logger.always("");
|
|
270
|
+
logger.always(chalk.yellow("Test the configuration:"));
|
|
271
|
+
logger.always(chalk.cyan(` neurolink generate "Hello!" --provider ${providerId}`));
|
|
272
|
+
logger.always("");
|
|
273
|
+
logger.always(chalk.gray(`Docs: ${config.setupUrl}`));
|
|
274
|
+
}
|
|
142
275
|
/**
|
|
143
276
|
* Main setup command handler
|
|
144
277
|
*/
|
|
@@ -251,40 +384,25 @@ async function runSetupWizard() {
|
|
|
251
384
|
/**
|
|
252
385
|
* Check which providers are already configured
|
|
253
386
|
*/
|
|
254
|
-
async function checkExistingConfigurations() {
|
|
387
|
+
export async function checkExistingConfigurations() {
|
|
255
388
|
const configured = [];
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (process.env.GOOGLE_APPLICATION_CREDENTIALS ||
|
|
274
|
-
process.env.GOOGLE_SERVICE_ACCOUNT_KEY) {
|
|
275
|
-
configured.push("vertex");
|
|
276
|
-
}
|
|
277
|
-
if (process.env.HUGGINGFACE_API_KEY ||
|
|
278
|
-
process.env.HUGGINGFACE_API_TOKEN ||
|
|
279
|
-
process.env.HF_TOKEN ||
|
|
280
|
-
process.env.HF_API_TOKEN) {
|
|
281
|
-
configured.push("huggingface");
|
|
282
|
-
}
|
|
283
|
-
if (process.env.MISTRAL_API_KEY) {
|
|
284
|
-
configured.push("mistral");
|
|
285
|
-
}
|
|
286
|
-
if (process.env.OPENROUTER_API_KEY) {
|
|
287
|
-
configured.push("openrouter");
|
|
389
|
+
for (const p of PROVIDERS) {
|
|
390
|
+
const descriptor = PROVIDER_DESCRIPTORS_BY_NAME.get(p.id);
|
|
391
|
+
if (!descriptor) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
const { apiKey, fallbacks, extraRequired, extraRequiredFallbacks } = descriptor.envVars;
|
|
395
|
+
const hasPrimary = !!apiKey &&
|
|
396
|
+
(!!process.env[apiKey] ||
|
|
397
|
+
(fallbacks ?? []).some((v) => !!process.env[v]));
|
|
398
|
+
if (!hasPrimary) {
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
const requiredOk = (extraRequired ?? []).every((v) => !!process.env[v]) ||
|
|
402
|
+
(extraRequiredFallbacks ?? []).some((v) => !!process.env[v]);
|
|
403
|
+
if (requiredOk) {
|
|
404
|
+
configured.push(p.id);
|
|
405
|
+
}
|
|
288
406
|
}
|
|
289
407
|
return configured;
|
|
290
408
|
}
|
|
@@ -364,7 +482,7 @@ async function runProviderSelection() {
|
|
|
364
482
|
/**
|
|
365
483
|
* Delegate to existing provider setup commands
|
|
366
484
|
*/
|
|
367
|
-
async function delegateToProviderSetup(providerId) {
|
|
485
|
+
export async function delegateToProviderSetup(providerId) {
|
|
368
486
|
const setupArgs = {
|
|
369
487
|
nonInteractive: false,
|
|
370
488
|
"non-interactive": false,
|
|
@@ -400,8 +518,14 @@ async function delegateToProviderSetup(providerId) {
|
|
|
400
518
|
case "openrouter":
|
|
401
519
|
await handleOpenRouterSetup();
|
|
402
520
|
break;
|
|
403
|
-
default:
|
|
404
|
-
|
|
521
|
+
default: {
|
|
522
|
+
const genericConfig = EXTRA_PROVIDER_CONFIGS[providerId];
|
|
523
|
+
if (!genericConfig) {
|
|
524
|
+
throw new Error(`Unknown provider: ${providerId}`);
|
|
525
|
+
}
|
|
526
|
+
printGenericProviderSetup(providerId, genericConfig);
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
405
529
|
}
|
|
406
530
|
// After successful setup, show completion message
|
|
407
531
|
await showSetupCompletion(providerId);
|