@juspay/neurolink 9.68.8 → 9.68.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/browser/neurolink.min.js +370 -379
- package/dist/lib/providers/huggingFace.d.ts +24 -72
- package/dist/lib/providers/huggingFace.js +46 -294
- package/dist/lib/providers/lmStudio.d.ts +12 -17
- package/dist/lib/providers/lmStudio.js +31 -201
- package/dist/providers/huggingFace.d.ts +24 -72
- package/dist/providers/huggingFace.js +46 -294
- package/dist/providers/lmStudio.d.ts +12 -17
- package/dist/providers/lmStudio.js +31 -201
- package/package.json +1 -1
|
@@ -1,311 +1,77 @@
|
|
|
1
|
-
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
|
-
import { BaseProvider } from "../core/baseProvider.js";
|
|
3
|
-
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
4
|
-
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
5
1
|
import { AuthenticationError, InvalidModelError, NetworkError, ProviderError, RateLimitError, } from "../types/index.js";
|
|
6
|
-
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
7
2
|
import { logger } from "../utils/logger.js";
|
|
8
|
-
import { buildNoOutputSentinel, detectPostStreamNoOutput, stampNoOutputSpan, } from "../utils/noOutputSentinel.js";
|
|
9
3
|
import { createHuggingFaceConfig, getProviderModel, validateApiKey, } from "../utils/providerConfig.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Configuration helpers - now using consolidated utility
|
|
16
|
-
const getHuggingFaceApiKey = () => {
|
|
17
|
-
return validateApiKey(createHuggingFaceConfig());
|
|
18
|
-
};
|
|
19
|
-
const getDefaultHuggingFaceModel = () => {
|
|
20
|
-
return getProviderModel("HUGGINGFACE_MODEL", "microsoft/DialoGPT-medium");
|
|
21
|
-
};
|
|
22
|
-
// Note: hasNeurolinkCredentials["huggingFace"] now directly imported from consolidated utility
|
|
4
|
+
import { TimeoutError } from "../utils/timeout.js";
|
|
5
|
+
import { OpenAIChatCompletionsProvider } from "./openaiChatCompletionsBase.js";
|
|
6
|
+
const HUGGINGFACE_DEFAULT_BASE_URL = "https://router.huggingface.co/v1";
|
|
7
|
+
const getHuggingFaceApiKey = () => validateApiKey(createHuggingFaceConfig());
|
|
8
|
+
const getDefaultHuggingFaceModel = () => getProviderModel("HUGGINGFACE_MODEL", "microsoft/DialoGPT-medium");
|
|
23
9
|
/**
|
|
24
|
-
* HuggingFace Provider
|
|
25
|
-
*
|
|
10
|
+
* HuggingFace Provider — direct HTTP, no AI SDK.
|
|
11
|
+
*
|
|
12
|
+
* OpenAI-compatible chat completions at router.huggingface.co/v1 (unified
|
|
13
|
+
* router endpoint, 2025). Supports the full HuggingFace model hub including
|
|
14
|
+
* Llama 3.x, Qwen 2.5, Mistral, DeepSeek, and tool-calling capable variants.
|
|
15
|
+
* All request/stream/tool-loop orchestration lives in
|
|
16
|
+
* `OpenAIChatCompletionsProvider`; this class only declares configuration
|
|
17
|
+
* and provider-specific error mapping.
|
|
18
|
+
*
|
|
19
|
+
* @see https://huggingface.co/docs/api-inference/index
|
|
26
20
|
*/
|
|
27
|
-
export class HuggingFaceProvider extends
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
// Initialize model
|
|
40
|
-
this.model = huggingface(this.modelName);
|
|
21
|
+
export class HuggingFaceProvider extends OpenAIChatCompletionsProvider {
|
|
22
|
+
constructor(modelName, sdk, credentials) {
|
|
23
|
+
const apiKey = credentials?.apiKey?.trim()
|
|
24
|
+
? credentials.apiKey.trim()
|
|
25
|
+
: getHuggingFaceApiKey();
|
|
26
|
+
// Treat blank/whitespace overrides as unset so an empty
|
|
27
|
+
// `credentials.baseURL` or `HUGGINGFACE_BASE_URL=` cannot override the
|
|
28
|
+
// default with "" (mirrors the apiKey precedence above).
|
|
29
|
+
const baseURL = credentials?.baseURL?.trim() ||
|
|
30
|
+
process.env.HUGGINGFACE_BASE_URL?.trim() ||
|
|
31
|
+
HUGGINGFACE_DEFAULT_BASE_URL;
|
|
32
|
+
super("huggingface", modelName, sdk, { baseURL, apiKey });
|
|
41
33
|
logger.debug("HuggingFaceProvider initialized", {
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
modelName: this.modelName,
|
|
35
|
+
providerName: this.providerName,
|
|
36
|
+
baseURL: this.config.baseURL,
|
|
44
37
|
});
|
|
45
38
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
getProviderName() {
|
|
40
|
+
return "huggingface";
|
|
41
|
+
}
|
|
42
|
+
getDefaultModel() {
|
|
43
|
+
return getDefaultHuggingFaceModel();
|
|
44
|
+
}
|
|
45
|
+
getFallbackModelName() {
|
|
46
|
+
return "meta-llama/Llama-3.1-8B-Instruct";
|
|
47
|
+
}
|
|
49
48
|
/**
|
|
50
|
-
* HuggingFace
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* - nvidia/Llama-3.1-Nemotron-Ultra-253B-v1 - Optimized for tool calling
|
|
57
|
-
* - NousResearch/Hermes-3-Llama-3.2-3B - Function calling trained
|
|
58
|
-
* - codellama/CodeLlama-34b-Instruct-hf - Code-focused tool calling
|
|
59
|
-
* - mistralai/Mistral-7B-Instruct-v0.3 - Basic tool support
|
|
60
|
-
*
|
|
61
|
-
* **Unsupported Models (Tool Calling Disabled):**
|
|
62
|
-
* - microsoft/DialoGPT-* - Treats tools as conversation context
|
|
63
|
-
* - gpt2, bert, roberta variants - No tool calling training
|
|
64
|
-
* - Most pre-2024 models - Limited function calling capabilities
|
|
65
|
-
*
|
|
66
|
-
* **Implementation Details:**
|
|
67
|
-
* - Intelligent model detection based on known capabilities
|
|
68
|
-
* - Custom tool schema formatting for HuggingFace models
|
|
69
|
-
* - Enhanced response parsing for function call extraction
|
|
70
|
-
* - Graceful fallback for unsupported models
|
|
71
|
-
*
|
|
72
|
-
* @returns true for supported models, false for unsupported models
|
|
49
|
+
* HuggingFace serves a huge variety of models, many of which reject the
|
|
50
|
+
* OpenAI `tools` field. The base reports supportsTools() === true
|
|
51
|
+
* unconditionally, which would merge tools into requests for models
|
|
52
|
+
* (including the default DialoGPT-medium) that don't accept them. Preserve
|
|
53
|
+
* the pre-migration allowlist: only known tool-calling-capable model
|
|
54
|
+
* families opt in; everything else runs tool-free.
|
|
73
55
|
*/
|
|
74
56
|
supportsTools() {
|
|
75
57
|
const modelName = this.modelName.toLowerCase();
|
|
76
|
-
// Check if model is in the list of known tool-calling capable models
|
|
77
58
|
const toolCapableModels = [
|
|
78
|
-
// Llama 3.1 series (post-trained for tool calling)
|
|
79
59
|
"llama-3.1-8b-instruct",
|
|
80
60
|
"llama-3.1-70b-instruct",
|
|
81
61
|
"llama-3.1-405b-instruct",
|
|
82
62
|
"llama-3.1-nemotron-ultra",
|
|
83
|
-
// Hermes series (function calling trained)
|
|
84
63
|
"hermes-3-llama-3.2",
|
|
85
64
|
"hermes-2-pro",
|
|
86
|
-
// Code Llama (code-focused tool calling)
|
|
87
65
|
"codellama-34b-instruct",
|
|
88
66
|
"codellama-13b-instruct",
|
|
89
|
-
// Mistral series (basic tool support)
|
|
90
67
|
"mistral-7b-instruct-v0.3",
|
|
91
68
|
"mistral-8x7b-instruct",
|
|
92
|
-
// Other known tool-capable models
|
|
93
69
|
"nous-hermes",
|
|
94
70
|
"openchat",
|
|
95
71
|
"wizardcoder",
|
|
96
72
|
];
|
|
97
|
-
|
|
98
|
-
const isToolCapable = toolCapableModels.some((capableModel) => modelName.includes(capableModel));
|
|
99
|
-
if (isToolCapable) {
|
|
100
|
-
logger.debug("HuggingFace tool calling enabled", {
|
|
101
|
-
model: this.modelName,
|
|
102
|
-
reason: "Model supports function calling",
|
|
103
|
-
});
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
// Log why tools are disabled for transparency
|
|
107
|
-
logger.debug("HuggingFace tool calling disabled", {
|
|
108
|
-
model: this.modelName,
|
|
109
|
-
reason: "Model not in tool-capable list",
|
|
110
|
-
suggestion: "Consider using Llama-3.1-* or Hermes-3-* models for tool calling",
|
|
111
|
-
});
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
115
|
-
async executeStream(options, analysisSchema) {
|
|
116
|
-
this.validateStreamOptions(options);
|
|
117
|
-
const timeout = this.getTimeout(options);
|
|
118
|
-
const timeoutController = createTimeoutController(timeout, this.providerName, "stream");
|
|
119
|
-
try {
|
|
120
|
-
// Get tools - options.tools is pre-merged by BaseProvider.stream()
|
|
121
|
-
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
122
|
-
const allTools = shouldUseTools
|
|
123
|
-
? options.tools || (await this.getAllTools())
|
|
124
|
-
: {};
|
|
125
|
-
// Enhanced tool handling for HuggingFace models
|
|
126
|
-
const streamOptions = this.prepareStreamOptions(options, analysisSchema);
|
|
127
|
-
// Build message array from options with multimodal support
|
|
128
|
-
// Using protected helper from BaseProvider to eliminate code duplication
|
|
129
|
-
// Pass the enhanced system prompt (with tool-calling instructions) so it
|
|
130
|
-
// actually reaches the model instead of being silently discarded.
|
|
131
|
-
const messagesOptions = streamOptions.system
|
|
132
|
-
? { ...options, systemPrompt: streamOptions.system }
|
|
133
|
-
: options;
|
|
134
|
-
const messages = await this.buildMessagesForStream(messagesOptions);
|
|
135
|
-
// Reviewer follow-up: capture upstream provider errors via onError
|
|
136
|
-
// so the post-stream NoOutput detect can propagate the real cause
|
|
137
|
-
// into the sentinel's providerError / modelResponseRaw.
|
|
138
|
-
let capturedProviderError;
|
|
139
|
-
const result = await streamText({
|
|
140
|
-
model: this.model,
|
|
141
|
-
messages: messages,
|
|
142
|
-
temperature: options.temperature,
|
|
143
|
-
maxOutputTokens: options.maxTokens, // No default limit - unlimited unless specified
|
|
144
|
-
stopWhen: stepCountIs(options.maxSteps || DEFAULT_MAX_STEPS),
|
|
145
|
-
tools: (shouldUseTools
|
|
146
|
-
? streamOptions.tools || allTools
|
|
147
|
-
: {}),
|
|
148
|
-
toolChoice: resolveToolChoice(options, (shouldUseTools ? streamOptions.tools || allTools : {}), shouldUseTools),
|
|
149
|
-
abortSignal: composeAbortSignals(options.abortSignal, timeoutController?.controller.signal),
|
|
150
|
-
experimental_telemetry: this.telemetryHandler.getTelemetryConfig(options),
|
|
151
|
-
experimental_repairToolCall: this.getToolCallRepairFn(options),
|
|
152
|
-
onError: (event) => {
|
|
153
|
-
capturedProviderError = event.error;
|
|
154
|
-
logger.error("HuggingFace: Stream error", {
|
|
155
|
-
error: event.error instanceof Error
|
|
156
|
-
? event.error.message
|
|
157
|
-
: String(event.error),
|
|
158
|
-
});
|
|
159
|
-
},
|
|
160
|
-
onStepFinish: ({ toolCalls, toolResults }) => {
|
|
161
|
-
emitToolEndFromStepFinish(this.neurolink?.getEventEmitter(), toolResults);
|
|
162
|
-
this.handleToolExecutionStorage(toolCalls, toolResults, options, new Date()).catch((error) => {
|
|
163
|
-
logger.warn("[HuggingFaceProvider] Failed to store tool executions", {
|
|
164
|
-
provider: this.providerName,
|
|
165
|
-
error: error instanceof Error ? error.message : String(error),
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
},
|
|
169
|
-
});
|
|
170
|
-
timeoutController?.cleanup();
|
|
171
|
-
// Transform stream to match StreamResult interface with enhanced tool call parsing
|
|
172
|
-
const transformedStream = async function* () {
|
|
173
|
-
let chunkCount = 0;
|
|
174
|
-
try {
|
|
175
|
-
for await (const chunk of result.textStream) {
|
|
176
|
-
chunkCount++;
|
|
177
|
-
yield { content: chunk };
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (streamError) {
|
|
181
|
-
if (NoOutputGeneratedError.isInstance(streamError)) {
|
|
182
|
-
logger.warn("HuggingFace: Stream produced no output (NoOutputGeneratedError) — caught from textStream");
|
|
183
|
-
const sentinel = await buildNoOutputSentinel(streamError, result, capturedProviderError);
|
|
184
|
-
stampNoOutputSpan(sentinel);
|
|
185
|
-
yield sentinel;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
throw streamError;
|
|
189
|
-
}
|
|
190
|
-
// Curator P3-6 (round-2 fix): production trigger comes through
|
|
191
|
-
// the result.finishReason rejection, not textStream throws.
|
|
192
|
-
if (chunkCount === 0) {
|
|
193
|
-
const detected = await detectPostStreamNoOutput(result, capturedProviderError);
|
|
194
|
-
if (detected) {
|
|
195
|
-
logger.warn("HuggingFace: Stream produced no output (NoOutputGeneratedError) — caught from finishReason rejection");
|
|
196
|
-
stampNoOutputSpan(detected.sentinel);
|
|
197
|
-
yield detected.sentinel;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
stream: transformedStream(),
|
|
203
|
-
provider: this.providerName,
|
|
204
|
-
model: this.modelName,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
timeoutController?.cleanup();
|
|
209
|
-
throw this.handleProviderError(error);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Prepare stream options with HuggingFace-specific enhancements
|
|
214
|
-
* Handles tool calling optimizations and model-specific formatting
|
|
215
|
-
*/
|
|
216
|
-
prepareStreamOptions(options, _analysisSchema) {
|
|
217
|
-
const modelSupportsTools = this.supportsTools();
|
|
218
|
-
// If model doesn't support tools, disable them completely
|
|
219
|
-
if (!modelSupportsTools) {
|
|
220
|
-
return {
|
|
221
|
-
prompt: options.input.text ?? "",
|
|
222
|
-
system: options.systemPrompt,
|
|
223
|
-
tools: undefined,
|
|
224
|
-
toolChoice: undefined,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
// For tool-capable models, enhance the prompt with tool calling instructions
|
|
228
|
-
const enhancedSystemPrompt = this.enhanceSystemPromptForTools(options.systemPrompt, options.tools);
|
|
229
|
-
// Format tools using HuggingFace-compatible schema if tools are provided
|
|
230
|
-
const formattedTools = options.tools
|
|
231
|
-
? this.formatToolsForHuggingFace(options.tools)
|
|
232
|
-
: undefined;
|
|
233
|
-
return {
|
|
234
|
-
prompt: options.input.text ?? "",
|
|
235
|
-
system: enhancedSystemPrompt,
|
|
236
|
-
tools: formattedTools,
|
|
237
|
-
toolChoice: formattedTools ? (options.toolChoice ?? "auto") : undefined,
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Enhance system prompt with tool calling instructions for HuggingFace models
|
|
242
|
-
* Many HF models benefit from explicit tool calling guidance
|
|
243
|
-
*/
|
|
244
|
-
enhanceSystemPromptForTools(originalSystemPrompt, tools) {
|
|
245
|
-
if (!tools || !this.supportsTools()) {
|
|
246
|
-
return originalSystemPrompt || "";
|
|
247
|
-
}
|
|
248
|
-
const toolInstructions = `
|
|
249
|
-
You have access to function tools. When you need to use a tool to answer the user's request:
|
|
250
|
-
1. Identify the appropriate tool from the available functions
|
|
251
|
-
2. Call the function with the correct parameters in JSON format
|
|
252
|
-
3. Use the function results to provide a comprehensive answer
|
|
253
|
-
|
|
254
|
-
Available tools will be provided in the function calling format. Use them when they can help answer the user's question.
|
|
255
|
-
`;
|
|
256
|
-
return originalSystemPrompt
|
|
257
|
-
? `${originalSystemPrompt}\n\n${toolInstructions}`
|
|
258
|
-
: toolInstructions;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Format tools for HuggingFace model compatibility
|
|
262
|
-
* Some models require specific tool schema formatting
|
|
263
|
-
*/
|
|
264
|
-
formatToolsForHuggingFace(tools) {
|
|
265
|
-
// For now, pass through tools as-is since we're using OpenAI-compatible endpoint
|
|
266
|
-
// Future enhancement: Add model-specific tool formatting if needed
|
|
267
|
-
return tools;
|
|
73
|
+
return toolCapableModels.some((capable) => modelName.includes(capable));
|
|
268
74
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Get recommendations for tool-calling capable HuggingFace models
|
|
271
|
-
* Provides guidance for users who want to use function calling
|
|
272
|
-
*/
|
|
273
|
-
static getToolCallingRecommendations() {
|
|
274
|
-
return {
|
|
275
|
-
recommended: [
|
|
276
|
-
"meta-llama/Llama-3.1-8B-Instruct",
|
|
277
|
-
"meta-llama/Llama-3.1-70B-Instruct",
|
|
278
|
-
"nvidia/Llama-3.1-Nemotron-Ultra-253B-v1",
|
|
279
|
-
"NousResearch/Hermes-3-Llama-3.2-3B",
|
|
280
|
-
"codellama/CodeLlama-34b-Instruct-hf",
|
|
281
|
-
],
|
|
282
|
-
performance: {
|
|
283
|
-
"meta-llama/Llama-3.1-8B-Instruct": { speed: 3, quality: 2, cost: 3 },
|
|
284
|
-
"meta-llama/Llama-3.1-70B-Instruct": { speed: 2, quality: 3, cost: 2 },
|
|
285
|
-
"nvidia/Llama-3.1-Nemotron-Ultra-253B-v1": {
|
|
286
|
-
speed: 2,
|
|
287
|
-
quality: 3,
|
|
288
|
-
cost: 1,
|
|
289
|
-
},
|
|
290
|
-
"NousResearch/Hermes-3-Llama-3.2-3B": { speed: 3, quality: 2, cost: 3 },
|
|
291
|
-
"codellama/CodeLlama-34b-Instruct-hf": {
|
|
292
|
-
speed: 2,
|
|
293
|
-
quality: 3,
|
|
294
|
-
cost: 2,
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
notes: {
|
|
298
|
-
"meta-llama/Llama-3.1-8B-Instruct": "Best balance of speed and tool calling capability",
|
|
299
|
-
"meta-llama/Llama-3.1-70B-Instruct": "High-quality tool calling, slower inference",
|
|
300
|
-
"nvidia/Llama-3.1-Nemotron-Ultra-253B-v1": "Optimized for tool calling, requires more resources",
|
|
301
|
-
"NousResearch/Hermes-3-Llama-3.2-3B": "Lightweight with good tool calling support",
|
|
302
|
-
"codellama/CodeLlama-34b-Instruct-hf": "Excellent for code-related tool calling",
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Enhanced error handling with HuggingFace-specific guidance
|
|
308
|
-
*/
|
|
309
75
|
formatProviderError(error) {
|
|
310
76
|
if (error instanceof TimeoutError) {
|
|
311
77
|
return new NetworkError(`Request timed out: ${error.message}`, "huggingface");
|
|
@@ -330,18 +96,4 @@ Available tools will be provided in the function calling format. Use them when t
|
|
|
330
96
|
}
|
|
331
97
|
return new ProviderError(`HuggingFace Provider Error: ${message}`, "huggingface");
|
|
332
98
|
}
|
|
333
|
-
getProviderName() {
|
|
334
|
-
return "huggingface";
|
|
335
|
-
}
|
|
336
|
-
getDefaultModel() {
|
|
337
|
-
return getDefaultHuggingFaceModel();
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Returns the Vercel AI SDK model instance for HuggingFace
|
|
341
|
-
*/
|
|
342
|
-
getAISDKModel() {
|
|
343
|
-
return this.model;
|
|
344
|
-
}
|
|
345
99
|
}
|
|
346
|
-
// Export for factory registration
|
|
347
|
-
export default HuggingFaceProvider;
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import type { AIProviderName } from "../constants/enums.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import type { LanguageModel } from "../types/index.js";
|
|
2
|
+
import type { NeurolinkCredentials } from "../types/index.js";
|
|
3
|
+
import { OpenAIChatCompletionsProvider } from "./openaiChatCompletionsBase.js";
|
|
5
4
|
/**
|
|
6
|
-
* LM Studio Provider
|
|
5
|
+
* LM Studio Provider — direct HTTP, no AI SDK.
|
|
6
|
+
*
|
|
7
7
|
* Wraps the LM Studio local server (https://lmstudio.ai/) which exposes an
|
|
8
8
|
* OpenAI-compatible API at http://localhost:1234/v1 by default.
|
|
9
|
-
* Auto-discovers the loaded model via /v1/models if no model specified.
|
|
9
|
+
* Auto-discovers the loaded model via /v1/models if no model is specified.
|
|
10
|
+
* All request/stream/tool-loop orchestration lives in
|
|
11
|
+
* `OpenAIChatCompletionsProvider`; this class only declares configuration
|
|
12
|
+
* and provider-specific error mapping.
|
|
13
|
+
*
|
|
14
|
+
* @see https://lmstudio.ai/
|
|
10
15
|
*/
|
|
11
|
-
export declare class LMStudioProvider extends
|
|
12
|
-
private model?;
|
|
13
|
-
private readonly requestedModelName?;
|
|
14
|
-
private baseURL;
|
|
15
|
-
private apiKey;
|
|
16
|
-
private discoveredModel?;
|
|
17
|
-
private lmstudioClient;
|
|
16
|
+
export declare class LMStudioProvider extends OpenAIChatCompletionsProvider {
|
|
18
17
|
constructor(modelName?: string, sdk?: unknown, _region?: string, credentials?: NeurolinkCredentials["lmStudio"]);
|
|
19
|
-
private getAvailableModels;
|
|
20
|
-
protected getAISDKModel(signal?: AbortSignal): Promise<LanguageModel>;
|
|
21
|
-
protected executeStream(options: StreamOptions, _analysisSchema?: ValidationSchema): Promise<StreamResult>;
|
|
22
|
-
private executeStreamInner;
|
|
23
18
|
protected getProviderName(): AIProviderName;
|
|
24
19
|
protected getDefaultModel(): string;
|
|
20
|
+
protected getFallbackModelName(): string;
|
|
25
21
|
protected formatProviderError(error: unknown): Error;
|
|
26
22
|
validateConfiguration(): Promise<boolean>;
|
|
27
23
|
getConfiguration(): {
|
|
@@ -31,4 +27,3 @@ export declare class LMStudioProvider extends BaseProvider {
|
|
|
31
27
|
baseURL: string;
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
|
-
export default LMStudioProvider;
|