@juspay/neurolink 5.1.0 → 5.2.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.
Files changed (166) hide show
  1. package/CHANGELOG.md +15 -9
  2. package/README.md +123 -126
  3. package/dist/agent/direct-tools.d.ts +6 -6
  4. package/dist/cli/commands/config.d.ts +3 -3
  5. package/dist/cli/commands/mcp.js +8 -7
  6. package/dist/cli/factories/command-factory.d.ts +4 -0
  7. package/dist/cli/factories/command-factory.js +57 -3
  8. package/dist/cli/index.js +87 -140
  9. package/dist/core/base-provider.d.ts +423 -0
  10. package/dist/core/base-provider.js +365 -0
  11. package/dist/core/constants.d.ts +1 -1
  12. package/dist/core/constants.js +1 -1
  13. package/dist/core/dynamic-models.d.ts +6 -6
  14. package/dist/core/evaluation.d.ts +19 -80
  15. package/dist/core/evaluation.js +185 -484
  16. package/dist/core/factory.d.ts +3 -3
  17. package/dist/core/factory.js +31 -91
  18. package/dist/core/service-registry.d.ts +47 -0
  19. package/dist/core/service-registry.js +112 -0
  20. package/dist/core/types.d.ts +8 -1
  21. package/dist/factories/compatibility-factory.js +1 -1
  22. package/dist/factories/provider-factory.d.ts +72 -0
  23. package/dist/factories/provider-factory.js +144 -0
  24. package/dist/factories/provider-registry.d.ts +38 -0
  25. package/dist/factories/provider-registry.js +107 -0
  26. package/dist/index.d.ts +4 -3
  27. package/dist/index.js +2 -4
  28. package/dist/lib/agent/direct-tools.d.ts +6 -6
  29. package/dist/lib/core/base-provider.d.ts +423 -0
  30. package/dist/lib/core/base-provider.js +365 -0
  31. package/dist/lib/core/constants.d.ts +1 -1
  32. package/dist/lib/core/constants.js +1 -1
  33. package/dist/lib/core/dynamic-models.d.ts +6 -6
  34. package/dist/lib/core/evaluation.d.ts +19 -80
  35. package/dist/lib/core/evaluation.js +185 -484
  36. package/dist/lib/core/factory.d.ts +3 -3
  37. package/dist/lib/core/factory.js +30 -91
  38. package/dist/lib/core/service-registry.d.ts +47 -0
  39. package/dist/lib/core/service-registry.js +112 -0
  40. package/dist/lib/core/types.d.ts +8 -1
  41. package/dist/lib/factories/compatibility-factory.js +1 -1
  42. package/dist/lib/factories/provider-factory.d.ts +72 -0
  43. package/dist/lib/factories/provider-factory.js +144 -0
  44. package/dist/lib/factories/provider-registry.d.ts +38 -0
  45. package/dist/lib/factories/provider-registry.js +107 -0
  46. package/dist/lib/index.d.ts +4 -3
  47. package/dist/lib/index.js +2 -4
  48. package/dist/lib/mcp/config.js +28 -3
  49. package/dist/lib/mcp/function-calling.js +1 -1
  50. package/dist/lib/mcp/initialize-tools.d.ts +1 -1
  51. package/dist/lib/mcp/initialize-tools.js +45 -1
  52. package/dist/lib/mcp/initialize.js +16 -6
  53. package/dist/lib/mcp/servers/agent/direct-tools-server.d.ts +8 -0
  54. package/dist/lib/mcp/servers/agent/direct-tools-server.js +109 -0
  55. package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +3 -1
  56. package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  57. package/dist/lib/mcp/unified-registry.d.ts +4 -0
  58. package/dist/lib/mcp/unified-registry.js +42 -9
  59. package/dist/lib/neurolink.d.ts +156 -117
  60. package/dist/lib/neurolink.js +619 -404
  61. package/dist/lib/providers/amazon-bedrock.d.ts +32 -0
  62. package/dist/lib/providers/amazon-bedrock.js +143 -0
  63. package/dist/lib/providers/analytics-helper.js +7 -4
  64. package/dist/lib/providers/anthropic-baseprovider.d.ts +23 -0
  65. package/dist/lib/providers/anthropic-baseprovider.js +114 -0
  66. package/dist/lib/providers/anthropic.d.ts +19 -43
  67. package/dist/lib/providers/anthropic.js +82 -306
  68. package/dist/lib/providers/azure-openai.d.ts +20 -0
  69. package/dist/lib/providers/azure-openai.js +89 -0
  70. package/dist/lib/providers/google-ai-studio.d.ts +23 -0
  71. package/dist/lib/providers/google-ai-studio.js +107 -0
  72. package/dist/lib/providers/google-vertex.d.ts +47 -0
  73. package/dist/lib/providers/google-vertex.js +205 -0
  74. package/dist/lib/providers/huggingFace.d.ts +32 -25
  75. package/dist/lib/providers/huggingFace.js +97 -431
  76. package/dist/lib/providers/index.d.ts +9 -9
  77. package/dist/lib/providers/index.js +9 -9
  78. package/dist/lib/providers/mcp-provider.js +4 -0
  79. package/dist/lib/providers/mistral.d.ts +42 -0
  80. package/dist/lib/providers/mistral.js +160 -0
  81. package/dist/lib/providers/ollama.d.ts +52 -36
  82. package/dist/lib/providers/ollama.js +297 -520
  83. package/dist/lib/providers/openAI.d.ts +19 -18
  84. package/dist/lib/providers/openAI.js +76 -275
  85. package/dist/lib/sdk/tool-extension.d.ts +181 -0
  86. package/dist/lib/sdk/tool-extension.js +283 -0
  87. package/dist/lib/sdk/tool-registration.d.ts +95 -0
  88. package/dist/lib/sdk/tool-registration.js +167 -0
  89. package/dist/lib/types/generate-types.d.ts +1 -0
  90. package/dist/lib/types/mcp-types.d.ts +116 -0
  91. package/dist/lib/types/mcp-types.js +5 -0
  92. package/dist/lib/types/stream-types.d.ts +30 -18
  93. package/dist/lib/types/universal-provider-options.d.ts +87 -0
  94. package/dist/lib/types/universal-provider-options.js +53 -0
  95. package/dist/mcp/config.js +28 -3
  96. package/dist/mcp/function-calling.js +1 -1
  97. package/dist/mcp/initialize-tools.d.ts +1 -1
  98. package/dist/mcp/initialize-tools.js +45 -1
  99. package/dist/mcp/initialize.js +16 -6
  100. package/dist/mcp/servers/agent/direct-tools-server.d.ts +8 -0
  101. package/dist/mcp/servers/agent/direct-tools-server.js +109 -0
  102. package/dist/mcp/servers/ai-providers/ai-core-server.js +3 -1
  103. package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +2 -2
  104. package/dist/mcp/unified-registry.d.ts +4 -0
  105. package/dist/mcp/unified-registry.js +42 -9
  106. package/dist/neurolink.d.ts +156 -117
  107. package/dist/neurolink.js +619 -404
  108. package/dist/providers/amazon-bedrock.d.ts +32 -0
  109. package/dist/providers/amazon-bedrock.js +143 -0
  110. package/dist/providers/analytics-helper.js +7 -4
  111. package/dist/providers/anthropic-baseprovider.d.ts +23 -0
  112. package/dist/providers/anthropic-baseprovider.js +114 -0
  113. package/dist/providers/anthropic.d.ts +19 -43
  114. package/dist/providers/anthropic.js +81 -305
  115. package/dist/providers/azure-openai.d.ts +20 -0
  116. package/dist/providers/azure-openai.js +89 -0
  117. package/dist/providers/google-ai-studio.d.ts +23 -0
  118. package/dist/providers/google-ai-studio.js +108 -0
  119. package/dist/providers/google-vertex.d.ts +47 -0
  120. package/dist/providers/google-vertex.js +205 -0
  121. package/dist/providers/huggingFace.d.ts +32 -25
  122. package/dist/providers/huggingFace.js +96 -430
  123. package/dist/providers/index.d.ts +9 -9
  124. package/dist/providers/index.js +9 -9
  125. package/dist/providers/mcp-provider.js +4 -0
  126. package/dist/providers/mistral.d.ts +42 -0
  127. package/dist/providers/mistral.js +160 -0
  128. package/dist/providers/ollama.d.ts +52 -36
  129. package/dist/providers/ollama.js +297 -519
  130. package/dist/providers/openAI.d.ts +19 -18
  131. package/dist/providers/openAI.js +76 -276
  132. package/dist/sdk/tool-extension.d.ts +181 -0
  133. package/dist/sdk/tool-extension.js +283 -0
  134. package/dist/sdk/tool-registration.d.ts +95 -0
  135. package/dist/sdk/tool-registration.js +168 -0
  136. package/dist/types/generate-types.d.ts +1 -0
  137. package/dist/types/mcp-types.d.ts +116 -0
  138. package/dist/types/mcp-types.js +5 -0
  139. package/dist/types/stream-types.d.ts +30 -18
  140. package/dist/types/universal-provider-options.d.ts +87 -0
  141. package/dist/types/universal-provider-options.js +53 -0
  142. package/package.json +15 -10
  143. package/dist/lib/providers/agent-enhanced-provider.d.ts +0 -93
  144. package/dist/lib/providers/agent-enhanced-provider.js +0 -605
  145. package/dist/lib/providers/amazonBedrock.d.ts +0 -28
  146. package/dist/lib/providers/amazonBedrock.js +0 -364
  147. package/dist/lib/providers/azureOpenAI.d.ts +0 -42
  148. package/dist/lib/providers/azureOpenAI.js +0 -347
  149. package/dist/lib/providers/googleAIStudio.d.ts +0 -42
  150. package/dist/lib/providers/googleAIStudio.js +0 -364
  151. package/dist/lib/providers/googleVertexAI.d.ts +0 -34
  152. package/dist/lib/providers/googleVertexAI.js +0 -547
  153. package/dist/lib/providers/mistralAI.d.ts +0 -37
  154. package/dist/lib/providers/mistralAI.js +0 -325
  155. package/dist/providers/agent-enhanced-provider.d.ts +0 -93
  156. package/dist/providers/agent-enhanced-provider.js +0 -606
  157. package/dist/providers/amazonBedrock.d.ts +0 -28
  158. package/dist/providers/amazonBedrock.js +0 -364
  159. package/dist/providers/azureOpenAI.d.ts +0 -42
  160. package/dist/providers/azureOpenAI.js +0 -348
  161. package/dist/providers/googleAIStudio.d.ts +0 -42
  162. package/dist/providers/googleAIStudio.js +0 -364
  163. package/dist/providers/googleVertexAI.d.ts +0 -34
  164. package/dist/providers/googleVertexAI.js +0 -547
  165. package/dist/providers/mistralAI.d.ts +0 -37
  166. package/dist/providers/mistralAI.js +0 -325
@@ -1,348 +0,0 @@
1
- /**
2
- * Azure OpenAI Provider
3
- *
4
- * Enterprise-grade OpenAI integration through Microsoft Azure.
5
- * Supports all OpenAI models with enhanced security and compliance.
6
- */
7
- import { AIProviderName } from "../core/types.js";
8
- import { logger } from "../utils/logger.js";
9
- import { createTimeoutController, TimeoutError, getDefaultTimeout, } from "../utils/timeout.js";
10
- import { DEFAULT_MAX_TOKENS } from "../core/constants.js";
11
- import { evaluateResponse } from "../core/evaluation.js";
12
- import { createAnalytics } from "../core/analytics.js";
13
- export class AzureOpenAIProvider {
14
- name = AIProviderName.AZURE;
15
- apiKey;
16
- endpoint;
17
- deploymentId;
18
- apiVersion;
19
- constructor() {
20
- this.apiKey = this.getApiKey();
21
- this.endpoint = this.getEndpoint();
22
- this.deploymentId = this.getDeploymentId();
23
- this.apiVersion =
24
- process.env.AZURE_OPENAI_API_VERSION || "2024-02-15-preview";
25
- logger.debug(`[AzureOpenAIProvider] Initialized with endpoint: ${this.endpoint}, deployment: ${this.deploymentId}`);
26
- }
27
- getApiKey() {
28
- const apiKey = process.env.AZURE_OPENAI_API_KEY;
29
- if (!apiKey) {
30
- throw new Error("AZURE_OPENAI_API_KEY environment variable is required");
31
- }
32
- return apiKey;
33
- }
34
- getEndpoint() {
35
- const endpoint = process.env.AZURE_OPENAI_ENDPOINT;
36
- if (!endpoint) {
37
- throw new Error("AZURE_OPENAI_ENDPOINT environment variable is required");
38
- }
39
- return endpoint.replace(/\/$/, ""); // Remove trailing slash
40
- }
41
- getDeploymentId() {
42
- const deploymentId = process.env.AZURE_OPENAI_DEPLOYMENT_ID;
43
- if (!deploymentId) {
44
- throw new Error("AZURE_OPENAI_DEPLOYMENT_ID environment variable is required");
45
- }
46
- return deploymentId;
47
- }
48
- getApiUrl(stream = false) {
49
- return `${this.endpoint}/openai/deployments/${this.deploymentId}/chat/completions?api-version=${this.apiVersion}`;
50
- }
51
- async makeRequest(body, stream = false, signal) {
52
- const url = this.getApiUrl(stream);
53
- const headers = {
54
- "Content-Type": "application/json",
55
- "api-key": this.apiKey,
56
- };
57
- logger.debug(`[AzureOpenAIProvider.makeRequest] ${stream ? "Streaming" : "Non-streaming"} request to deployment: ${this.deploymentId}`);
58
- logger.debug(`[AzureOpenAIProvider.makeRequest] Max tokens: ${body.max_tokens || "default"}, Temperature: ${body.temperature || "default"}`);
59
- const response = await fetch(url, {
60
- method: "POST",
61
- headers,
62
- body: JSON.stringify(body),
63
- signal, // Add abort signal for timeout support
64
- });
65
- if (!response.ok) {
66
- const errorText = await response.text();
67
- logger.error(`[AzureOpenAIProvider.makeRequest] API error ${response.status}: ${errorText}`);
68
- throw new Error(`Azure OpenAI API error ${response.status}: ${errorText}`);
69
- }
70
- return response;
71
- }
72
- /**
73
- * PRIMARY METHOD: Stream content using AI (recommended for new code)
74
- * Future-ready for multi-modal capabilities with current text focus
75
- */
76
- async stream(optionsOrPrompt, analysisSchema) {
77
- const functionTag = "AzureOpenAIProvider.stream";
78
- const startTime = Date.now();
79
- // Parse parameters - support both string and options object
80
- const options = typeof optionsOrPrompt === "string"
81
- ? { input: { text: optionsOrPrompt } }
82
- : optionsOrPrompt;
83
- // Validate input
84
- if (!options?.input?.text ||
85
- typeof options.input.text !== "string" ||
86
- options.input.text.trim() === "") {
87
- throw new Error("Stream options must include input.text as a non-empty string");
88
- }
89
- // Convert StreamOptions for internal use
90
- const convertedOptions = {
91
- prompt: options.input.text,
92
- provider: options.provider,
93
- model: options.model,
94
- temperature: options.temperature,
95
- maxTokens: options.maxTokens,
96
- systemPrompt: options.systemPrompt,
97
- timeout: options.timeout,
98
- };
99
- // Prepare Azure OpenAI messages
100
- const messages = [];
101
- if (convertedOptions.systemPrompt) {
102
- messages.push({
103
- role: "system",
104
- content: convertedOptions.systemPrompt,
105
- });
106
- }
107
- messages.push({
108
- role: "user",
109
- content: convertedOptions.prompt,
110
- });
111
- const requestBody = {
112
- messages,
113
- temperature: convertedOptions.temperature ?? 0.7,
114
- max_tokens: convertedOptions.maxTokens ?? DEFAULT_MAX_TOKENS,
115
- stream: true,
116
- };
117
- // Create timeout controller if timeout is specified
118
- const timeoutController = createTimeoutController(convertedOptions.timeout, this.name, "stream");
119
- try {
120
- const response = await this.makeRequest(requestBody, true, timeoutController?.controller.signal);
121
- // Clean up timeout if successful
122
- timeoutController?.cleanup();
123
- // Return an async iterable for streaming chunks
124
- const streamIterable = this.createAsyncIterable(response.body, timeoutController?.controller.signal);
125
- // Compose the StreamResult object
126
- return {
127
- stream: streamIterable,
128
- provider: this.name,
129
- model: convertedOptions.model,
130
- };
131
- }
132
- catch (error) {
133
- timeoutController?.cleanup();
134
- throw error;
135
- }
136
- }
137
- async generate(optionsOrPrompt, schema) {
138
- const functionTag = "AzureOpenAIProvider.generate";
139
- const provider = "azure";
140
- const startTime = Date.now();
141
- logger.debug(`[${functionTag}] Starting text generation`);
142
- // Parse parameters with backward compatibility
143
- const options = typeof optionsOrPrompt === "string"
144
- ? { prompt: optionsOrPrompt }
145
- : optionsOrPrompt;
146
- const { prompt, temperature = 0.7, maxTokens = DEFAULT_MAX_TOKENS, systemPrompt = "You are a helpful AI assistant.", timeout = getDefaultTimeout(provider, "generate"), } = options;
147
- logger.debug(`[${functionTag}] Prompt: "${prompt.substring(0, 100)}...", Temperature: ${temperature}, Max tokens: ${maxTokens}, Timeout: ${timeout}`);
148
- const messages = [];
149
- if (systemPrompt) {
150
- messages.push({
151
- role: "system",
152
- content: systemPrompt,
153
- });
154
- }
155
- messages.push({
156
- role: "user",
157
- content: prompt,
158
- });
159
- const requestBody = {
160
- messages,
161
- temperature,
162
- max_tokens: maxTokens,
163
- };
164
- // Create timeout controller if timeout is specified
165
- const timeoutController = createTimeoutController(timeout, provider, "generate");
166
- try {
167
- const response = await this.makeRequest(requestBody, false, timeoutController?.controller.signal);
168
- const data = await response.json();
169
- // Clean up timeout if successful
170
- timeoutController?.cleanup();
171
- logger.debug(`[${functionTag}] Success. Generated ${data.usage.completion_tokens} tokens`);
172
- const content = data.choices[0]?.message?.content || "";
173
- const result = {
174
- content,
175
- provider: this.name,
176
- model: data.model,
177
- usage: {
178
- promptTokens: data.usage.prompt_tokens,
179
- completionTokens: data.usage.completion_tokens,
180
- totalTokens: data.usage.total_tokens,
181
- },
182
- finishReason: data.choices[0]?.finish_reason || "stop",
183
- };
184
- // Add analytics if enabled
185
- if (options.enableAnalytics) {
186
- result.analytics = {
187
- provider: this.name,
188
- model: data.model,
189
- tokens: result.usage,
190
- responseTime: Date.now() - startTime,
191
- context: options.context,
192
- };
193
- }
194
- // Add evaluation if enabled
195
- if (options.enableEvaluation) {
196
- result.evaluation = await evaluateResponse(options.prompt, content, options.context);
197
- }
198
- return result;
199
- }
200
- catch (error) {
201
- // Always cleanup timeout
202
- timeoutController?.cleanup();
203
- // Log timeout errors specifically
204
- if (error instanceof TimeoutError) {
205
- logger.error(`[${functionTag}] Timeout error`, {
206
- provider,
207
- timeout: error.timeout,
208
- message: error.message,
209
- });
210
- }
211
- else if (error?.name === "AbortError") {
212
- // Convert AbortError to TimeoutError
213
- const timeoutError = new TimeoutError(`${provider} generate operation timed out after ${timeout}`, timeoutController?.timeoutMs || 0, provider, "generate");
214
- logger.error(`[${functionTag}] Timeout error`, {
215
- provider,
216
- timeout: timeoutController?.timeoutMs,
217
- message: timeoutError.message,
218
- });
219
- throw timeoutError;
220
- }
221
- else {
222
- logger.error(`[${functionTag}] Error:`, error);
223
- }
224
- throw error;
225
- }
226
- }
227
- async *createAsyncIterable(body, signal) {
228
- const reader = body.getReader();
229
- const decoder = new TextDecoder();
230
- let buffer = "";
231
- try {
232
- while (true) {
233
- // Check if aborted
234
- if (signal?.aborted) {
235
- throw new Error("AbortError");
236
- }
237
- const { done, value } = await reader.read();
238
- if (done) {
239
- break;
240
- }
241
- buffer += decoder.decode(value, { stream: true });
242
- const lines = buffer.split("\n");
243
- buffer = lines.pop() || "";
244
- for (const line of lines) {
245
- if (line.trim() === "") {
246
- continue;
247
- }
248
- if (line.startsWith("data: ")) {
249
- const data = line.slice(6);
250
- if (data.trim() === "[DONE]") {
251
- continue;
252
- }
253
- try {
254
- const chunk = JSON.parse(data);
255
- // Extract text content from chunk
256
- if (chunk.choices?.[0]?.delta?.content) {
257
- yield { content: chunk.choices[0].delta.content };
258
- }
259
- }
260
- catch (parseError) {
261
- logger.warn("[AzureOpenAIProvider.createAsyncIterable] Failed to parse chunk:", parseError);
262
- continue;
263
- }
264
- }
265
- }
266
- }
267
- }
268
- finally {
269
- reader.releaseLock();
270
- }
271
- }
272
- async testConnection() {
273
- logger.debug("[AzureOpenAIProvider.testConnection] Testing connection to Azure OpenAI");
274
- const startTime = Date.now();
275
- try {
276
- await this.generate({
277
- prompt: "Hello",
278
- maxTokens: 5,
279
- });
280
- const responseTime = Date.now() - startTime;
281
- logger.debug(`[AzureOpenAIProvider.testConnection] Connection test successful (${responseTime}ms)`);
282
- return {
283
- success: true,
284
- responseTime,
285
- };
286
- }
287
- catch (error) {
288
- const responseTime = Date.now() - startTime;
289
- logger.error(`[AzureOpenAIProvider.testConnection] Connection test failed (${responseTime}ms):`, error);
290
- return {
291
- success: false,
292
- error: error instanceof Error ? error.message : "Unknown error",
293
- responseTime,
294
- };
295
- }
296
- }
297
- isConfigured() {
298
- try {
299
- this.getApiKey();
300
- this.getEndpoint();
301
- this.getDeploymentId();
302
- return true;
303
- }
304
- catch {
305
- return false;
306
- }
307
- }
308
- getRequiredConfig() {
309
- return [
310
- "AZURE_OPENAI_API_KEY",
311
- "AZURE_OPENAI_ENDPOINT",
312
- "AZURE_OPENAI_DEPLOYMENT_ID",
313
- ];
314
- }
315
- getOptionalConfig() {
316
- return ["AZURE_OPENAI_API_VERSION"];
317
- }
318
- getModels() {
319
- return [
320
- "gpt-4",
321
- "gpt-4-turbo",
322
- "gpt-4-32k",
323
- "gpt-35-turbo",
324
- "gpt-35-turbo-16k",
325
- ];
326
- }
327
- supportsStreaming() {
328
- return true;
329
- }
330
- supportsSchema() {
331
- return true; // Azure OpenAI supports JSON mode and function calling
332
- }
333
- getCapabilities() {
334
- return [
335
- "text-generation",
336
- "streaming",
337
- "conversation",
338
- "system-prompts",
339
- "json-mode",
340
- "function-calling",
341
- "enterprise-security",
342
- "content-filtering",
343
- ];
344
- }
345
- async gen(optionsOrPrompt, analysisSchema) {
346
- return this.generate(optionsOrPrompt, analysisSchema);
347
- }
348
- }
@@ -1,42 +0,0 @@
1
- import type { ZodType, ZodTypeDef } from "zod";
2
- import { type Schema, type LanguageModelV1 } from "ai";
3
- import type { GenerateResult } from "../types/generate-types.js";
4
- import type { StreamOptions, StreamResult } from "../types/stream-types.js";
5
- import type { AIProvider, TextGenerationOptions, EnhancedGenerateResult } from "../core/types.js";
6
- export declare class GoogleAIStudio implements AIProvider {
7
- private modelName;
8
- /**
9
- * Initializes a new instance of GoogleAIStudio
10
- * @param modelName - Optional model name to override the default from config
11
- */
12
- constructor(modelName?: string | null);
13
- /**
14
- * Gets the appropriate model instance
15
- * Made public to support FunctionCallingProvider integration
16
- */
17
- getModel(): LanguageModelV1;
18
- /**
19
- * Expose model property for FunctionCallingProvider
20
- * This allows the enhanced provider to access the underlying model
21
- */
22
- get model(): LanguageModelV1;
23
- /**
24
- * PRIMARY METHOD: Stream content using AI (recommended for new code)
25
- * Future-ready for multi-modal capabilities with current text focus
26
- */
27
- stream(optionsOrPrompt: StreamOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<StreamResult>;
28
- /**
29
- * Processes text using non-streaming approach with optional schema validation
30
- * @param prompt - The input text prompt to analyze
31
- * @param analysisSchema - Optional Zod schema or Schema object for output validation
32
- * @returns Promise resolving to GenerateResult or null if operation fails
33
- */
34
- generate(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<GenerateResult>;
35
- /**
36
- * Short alias for generate() - CLI-SDK consistency
37
- * @param optionsOrPrompt - TextGenerationOptions object or prompt string
38
- * @param analysisSchema - Optional schema for output validation
39
- * @returns Promise resolving to GenerateResult or null
40
- */
41
- gen(optionsOrPrompt: TextGenerationOptions | string, analysisSchema?: ZodType<unknown, ZodTypeDef, unknown> | Schema<unknown>): Promise<EnhancedGenerateResult | null>;
42
- }