@juspay/neurolink 8.32.0 → 8.34.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 (39) hide show
  1. package/CHANGELOG.md +13 -1
  2. package/README.md +284 -75
  3. package/dist/action/actionExecutor.d.ts +29 -0
  4. package/dist/action/actionExecutor.js +290 -0
  5. package/dist/action/actionInputs.d.ts +25 -0
  6. package/dist/action/actionInputs.js +293 -0
  7. package/dist/action/githubIntegration.d.ts +21 -0
  8. package/dist/action/githubIntegration.js +187 -0
  9. package/dist/action/index.d.ts +8 -0
  10. package/dist/action/index.js +11 -0
  11. package/dist/index.d.ts +145 -13
  12. package/dist/index.js +145 -13
  13. package/dist/lib/action/actionExecutor.d.ts +29 -0
  14. package/dist/lib/action/actionExecutor.js +291 -0
  15. package/dist/lib/action/actionInputs.d.ts +25 -0
  16. package/dist/lib/action/actionInputs.js +294 -0
  17. package/dist/lib/action/githubIntegration.d.ts +21 -0
  18. package/dist/lib/action/githubIntegration.js +188 -0
  19. package/dist/lib/action/index.d.ts +8 -0
  20. package/dist/lib/action/index.js +12 -0
  21. package/dist/lib/index.d.ts +145 -13
  22. package/dist/lib/index.js +145 -13
  23. package/dist/lib/mcp/externalServerManager.js +41 -7
  24. package/dist/lib/neurolink.d.ts +172 -0
  25. package/dist/lib/neurolink.js +172 -0
  26. package/dist/lib/types/actionTypes.d.ts +205 -0
  27. package/dist/lib/types/actionTypes.js +7 -0
  28. package/dist/lib/types/index.d.ts +1 -0
  29. package/dist/lib/utils/errorHandling.d.ts +8 -0
  30. package/dist/lib/utils/errorHandling.js +29 -0
  31. package/dist/mcp/externalServerManager.js +41 -7
  32. package/dist/neurolink.d.ts +172 -0
  33. package/dist/neurolink.js +172 -0
  34. package/dist/types/actionTypes.d.ts +205 -0
  35. package/dist/types/actionTypes.js +6 -0
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/utils/errorHandling.d.ts +8 -0
  38. package/dist/utils/errorHandling.js +29 -0
  39. package/package.json +11 -3
@@ -89,6 +89,14 @@ export declare class ErrorFactory {
89
89
  * Create a memory exhaustion error
90
90
  */
91
91
  static memoryExhausted(toolName: string, memoryUsageMB: number): NeuroLinkError;
92
+ /**
93
+ * Create a missing configuration error (e.g., missing API key)
94
+ */
95
+ static missingConfiguration(configName: string, context?: Record<string, unknown>): NeuroLinkError;
96
+ /**
97
+ * Create an invalid configuration error (e.g., NaN for numeric values)
98
+ */
99
+ static invalidConfiguration(configName: string, reason: string, context?: Record<string, unknown>): NeuroLinkError;
92
100
  /**
93
101
  * Create an invalid video resolution error
94
102
  */
@@ -180,6 +180,35 @@ export class ErrorFactory {
180
180
  });
181
181
  }
182
182
  // ============================================================================
183
+ // CONFIGURATION ERRORS
184
+ // ============================================================================
185
+ /**
186
+ * Create a missing configuration error (e.g., missing API key)
187
+ */
188
+ static missingConfiguration(configName, context) {
189
+ return new NeuroLinkError({
190
+ code: ERROR_CODES.MISSING_CONFIGURATION,
191
+ message: `Missing required configuration: ${configName}`,
192
+ category: ErrorCategory.VALIDATION,
193
+ severity: ErrorSeverity.HIGH,
194
+ retriable: false,
195
+ context: context || {},
196
+ });
197
+ }
198
+ /**
199
+ * Create an invalid configuration error (e.g., NaN for numeric values)
200
+ */
201
+ static invalidConfiguration(configName, reason, context) {
202
+ return new NeuroLinkError({
203
+ code: ERROR_CODES.INVALID_CONFIGURATION,
204
+ message: `Invalid configuration for '${configName}': ${reason}`,
205
+ category: ErrorCategory.VALIDATION,
206
+ severity: ErrorSeverity.HIGH,
207
+ retriable: false,
208
+ context: context || {},
209
+ });
210
+ }
211
+ // ============================================================================
183
212
  // VIDEO VALIDATION ERRORS
184
213
  // ============================================================================
185
214
  /**
@@ -14,6 +14,36 @@ import { toolRegistry } from "./toolRegistry.js";
14
14
  import { HITLUserRejectedError, HITLTimeoutError } from "../hitl/hitlErrors.js";
15
15
  import { detectCategory } from "../utils/mcpDefaults.js";
16
16
  import { isObject, isNonNullObject } from "../utils/typeUtils.js";
17
+ /**
18
+ * Recursively substitute environment variables in strings
19
+ * Replaces ${VAR_NAME} with the value from process.env.VAR_NAME
20
+ * @param value - Value to process (string, object, array, or primitive)
21
+ * @returns Processed value with environment variables substituted
22
+ */
23
+ function substituteEnvVariables(value) {
24
+ if (typeof value === "string") {
25
+ // Replace ${VAR_NAME} with process.env.VAR_NAME
26
+ return value.replace(/\$\{([^}]+)\}/g, (match, varName) => {
27
+ const envValue = process.env[varName.trim()];
28
+ if (envValue === undefined) {
29
+ mcpLogger.warn(`[ExternalServerManager] Environment variable ${varName} is not defined, using empty string`);
30
+ return "";
31
+ }
32
+ return envValue;
33
+ });
34
+ }
35
+ if (Array.isArray(value)) {
36
+ return value.map((item) => substituteEnvVariables(item));
37
+ }
38
+ if (isNonNullObject(value)) {
39
+ const result = {};
40
+ for (const [key, val] of Object.entries(value)) {
41
+ result[key] = substituteEnvVariables(val);
42
+ }
43
+ return result;
44
+ }
45
+ return value;
46
+ }
17
47
  /**
18
48
  * Type guard to validate if an object can be safely used as Record<string, JsonValue>
19
49
  */
@@ -211,7 +241,7 @@ export class ExternalServerManager extends EventEmitter {
211
241
  ? serverConfig.args
212
242
  : [],
213
243
  env: isNonNullObject(serverConfig.env)
214
- ? serverConfig.env
244
+ ? substituteEnvVariables(serverConfig.env)
215
245
  : {},
216
246
  timeout: typeof serverConfig.timeout === "number"
217
247
  ? serverConfig.timeout
@@ -233,7 +263,7 @@ export class ExternalServerManager extends EventEmitter {
233
263
  : undefined,
234
264
  // HTTP transport-specific fields
235
265
  headers: isNonNullObject(serverConfig.headers)
236
- ? serverConfig.headers
266
+ ? substituteEnvVariables(serverConfig.headers)
237
267
  : undefined,
238
268
  httpOptions: isNonNullObject(serverConfig.httpOptions)
239
269
  ? serverConfig.httpOptions
@@ -342,7 +372,7 @@ export class ExternalServerManager extends EventEmitter {
342
372
  ? serverConfig.args
343
373
  : [],
344
374
  env: isNonNullObject(serverConfig.env)
345
- ? serverConfig.env
375
+ ? substituteEnvVariables(serverConfig.env)
346
376
  : {},
347
377
  timeout: typeof serverConfig.timeout === "number"
348
378
  ? serverConfig.timeout
@@ -364,7 +394,7 @@ export class ExternalServerManager extends EventEmitter {
364
394
  : undefined,
365
395
  // HTTP transport-specific fields
366
396
  headers: isNonNullObject(serverConfig.headers)
367
- ? serverConfig.headers
397
+ ? substituteEnvVariables(serverConfig.headers)
368
398
  : undefined,
369
399
  httpOptions: isNonNullObject(serverConfig.httpOptions)
370
400
  ? serverConfig.httpOptions
@@ -1108,7 +1138,7 @@ export class ExternalServerManager extends EventEmitter {
1108
1138
  }
1109
1139
  try {
1110
1140
  mcpLogger.debug(`[ExternalServerManager] Discovering tools for server: ${serverId}`);
1111
- const discoveryResult = await this.toolDiscovery.discoverTools(serverId, instance.client, this.config.defaultTimeout);
1141
+ const discoveryResult = await this.toolDiscovery.discoverTools(serverId, instance.client, instance.config.timeout || this.config.defaultTimeout);
1112
1142
  if (discoveryResult.success) {
1113
1143
  instance.toolsMap.clear();
1114
1144
  instance.toolsArray = undefined;
@@ -1164,7 +1194,9 @@ export class ExternalServerManager extends EventEmitter {
1164
1194
  registrations.push(toolRegistry.registerTool(toolId, toolInfo, {
1165
1195
  execute: async (params, _context) => {
1166
1196
  // Execute tool via ExternalServerManager for proper lifecycle management
1167
- return await this.executeTool(serverId, toolName, params, { timeout: this.config.defaultTimeout });
1197
+ return await this.executeTool(serverId, toolName, params, {
1198
+ timeout: instance.config.timeout || this.config.defaultTimeout,
1199
+ });
1168
1200
  },
1169
1201
  }));
1170
1202
  mcpLogger.debug(`[ExternalServerManager] Registered tool with main registry: ${toolId}`);
@@ -1277,7 +1309,9 @@ export class ExternalServerManager extends EventEmitter {
1277
1309
  }
1278
1310
  // Execute tool through discovery service (with potentially modified parameters)
1279
1311
  const result = await this.toolDiscovery.executeTool(toolName, serverId, instance.client, finalParameters, {
1280
- timeout: options?.timeout || this.config.defaultTimeout,
1312
+ timeout: options?.timeout ||
1313
+ instance.config.timeout ||
1314
+ this.config.defaultTimeout,
1281
1315
  });
1282
1316
  const duration = Date.now() - startTime;
1283
1317
  // Update metrics
@@ -20,6 +20,78 @@ import { RedisConversationMemoryManager } from "./core/redisConversationMemoryMa
20
20
  import type { ExternalMCPServerInstance, ExternalMCPOperationResult, ExternalMCPToolInfo } from "./types/externalMcp.js";
21
21
  import type { ObservabilityConfig } from "./types/observability.js";
22
22
  import type { NeurolinkConstructorConfig } from "./types/configTypes.js";
23
+ /**
24
+ * NeuroLink - Universal AI Development Platform
25
+ *
26
+ * Main SDK class providing unified access to 13+ AI providers with enterprise features:
27
+ * - Multi-provider support (OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, etc.)
28
+ * - MCP (Model Context Protocol) tool integration with 58+ external servers
29
+ * - Human-in-the-Loop (HITL) security workflows for regulated industries
30
+ * - Redis-based conversation memory and persistence
31
+ * - Enterprise middleware system for monitoring and control
32
+ * - Automatic provider fallback and retry logic
33
+ * - Streaming with real-time token delivery
34
+ * - Multimodal support (text, images, PDFs, CSV)
35
+ *
36
+ * @category Core
37
+ *
38
+ * @example Basic usage
39
+ * ```typescript
40
+ * import { NeuroLink } from '@juspay/neurolink';
41
+ *
42
+ * const neurolink = new NeuroLink();
43
+ *
44
+ * const result = await neurolink.generate({
45
+ * input: { text: 'Explain quantum computing' },
46
+ * provider: 'vertex',
47
+ * model: 'gemini-3-flash'
48
+ * });
49
+ *
50
+ * console.log(result.content);
51
+ * ```
52
+ *
53
+ * @example With HITL security
54
+ * ```typescript
55
+ * const neurolink = new NeuroLink({
56
+ * hitl: {
57
+ * enabled: true,
58
+ * requireApproval: ['writeFile', 'executeCode'],
59
+ * confidenceThreshold: 0.85
60
+ * }
61
+ * });
62
+ * ```
63
+ *
64
+ * @example With Redis memory
65
+ * ```typescript
66
+ * const neurolink = new NeuroLink({
67
+ * conversationMemory: {
68
+ * enabled: true,
69
+ * redis: {
70
+ * url: 'redis://localhost:6379'
71
+ * }
72
+ * }
73
+ * });
74
+ * ```
75
+ *
76
+ * @example With MCP tools
77
+ * ```typescript
78
+ * const neurolink = new NeuroLink();
79
+ *
80
+ * // Discover available tools
81
+ * const tools = await neurolink.getAvailableTools();
82
+ *
83
+ * // Use tools in generation
84
+ * const result = await neurolink.generate({
85
+ * input: { text: 'Read the README.md file' },
86
+ * tools: ['readFile']
87
+ * });
88
+ * ```
89
+ *
90
+ * @see {@link GenerateOptions} for generation options
91
+ * @see {@link StreamOptions} for streaming options
92
+ * @see {@link NeurolinkConstructorConfig} for configuration options
93
+ * @since 1.0.0
94
+ */
23
95
  export declare class NeuroLink {
24
96
  private mcpInitialized;
25
97
  private emitter;
@@ -281,6 +353,106 @@ export declare class NeuroLink {
281
353
  * Gracefully shutdown NeuroLink and all MCP connections
282
354
  */
283
355
  shutdown(): Promise<void>;
356
+ /**
357
+ * Generate AI response with comprehensive feature support.
358
+ *
359
+ * Primary method for AI generation with support for all NeuroLink features:
360
+ * - Multi-provider support (13+ providers)
361
+ * - MCP tool integration
362
+ * - Structured JSON output with Zod schemas
363
+ * - Conversation memory (Redis or in-memory)
364
+ * - HITL security workflows
365
+ * - Middleware execution
366
+ * - Multimodal inputs (images, PDFs, CSV)
367
+ *
368
+ * @category Generation
369
+ *
370
+ * @param optionsOrPrompt - Generation options or simple text prompt
371
+ * @param optionsOrPrompt.input - Input text and optional files
372
+ * @param optionsOrPrompt.provider - AI provider name (e.g., 'vertex', 'openai', 'anthropic')
373
+ * @param optionsOrPrompt.model - Model name to use
374
+ * @param optionsOrPrompt.tools - MCP tools to enable for this generation
375
+ * @param optionsOrPrompt.schema - Zod schema for structured output validation
376
+ * @param optionsOrPrompt.temperature - Sampling temperature (0-2, default: 1.0)
377
+ * @param optionsOrPrompt.maxTokens - Maximum tokens to generate
378
+ * @param optionsOrPrompt.thinkingConfig - Extended thinking configuration (thinkingLevel: 'minimal'|'low'|'medium'|'high')
379
+ * @param optionsOrPrompt.context - Context with conversationId and userId for memory
380
+ * @returns Promise resolving to generation result with content and metadata
381
+ *
382
+ * @example Basic text generation
383
+ * ```typescript
384
+ * const result = await neurolink.generate({
385
+ * input: { text: 'Explain quantum computing' }
386
+ * });
387
+ * console.log(result.content);
388
+ * ```
389
+ *
390
+ * @example With specific provider
391
+ * ```typescript
392
+ * const result = await neurolink.generate({
393
+ * input: { text: 'Write a poem' },
394
+ * provider: 'anthropic',
395
+ * model: 'claude-3-opus'
396
+ * });
397
+ * ```
398
+ *
399
+ * @example With MCP tools
400
+ * ```typescript
401
+ * const result = await neurolink.generate({
402
+ * input: { text: 'Read README.md and summarize it' },
403
+ * tools: ['readFile']
404
+ * });
405
+ * ```
406
+ *
407
+ * @example With structured output
408
+ * ```typescript
409
+ * import { z } from 'zod';
410
+ *
411
+ * const schema = z.object({
412
+ * name: z.string(),
413
+ * age: z.number(),
414
+ * city: z.string()
415
+ * });
416
+ *
417
+ * const result = await neurolink.generate({
418
+ * input: { text: 'Extract person info: John is 30 years old from NYC' },
419
+ * schema: schema
420
+ * });
421
+ * // result.structuredData is type-safe!
422
+ * ```
423
+ *
424
+ * @example With conversation memory
425
+ * ```typescript
426
+ * const result = await neurolink.generate({
427
+ * input: { text: 'What did we discuss earlier?' },
428
+ * context: {
429
+ * conversationId: 'conv-123',
430
+ * userId: 'user-456'
431
+ * }
432
+ * });
433
+ * ```
434
+ *
435
+ * @example With multimodal input
436
+ * ```typescript
437
+ * const result = await neurolink.generate({
438
+ * input: {
439
+ * text: 'Describe this image',
440
+ * images: ['/path/to/image.jpg']
441
+ * },
442
+ * provider: 'vertex'
443
+ * });
444
+ * ```
445
+ *
446
+ * @throws {Error} When input text is missing or invalid
447
+ * @throws {Error} When all providers fail to generate content
448
+ * @throws {Error} When structured output validation fails
449
+ * @throws {Error} When HITL approval is denied
450
+ *
451
+ * @see {@link GenerateOptions} for all available options
452
+ * @see {@link GenerateResult} for result structure
453
+ * @see {@link stream} for streaming generation
454
+ * @since 1.0.0
455
+ */
284
456
  generate(optionsOrPrompt: GenerateOptions | string): Promise<GenerateResult>;
285
457
  /**
286
458
  * BACKWARD COMPATIBILITY: Legacy generateText method
package/dist/neurolink.js CHANGED
@@ -46,6 +46,78 @@ import { ModelRouter } from "./utils/modelRouter.js";
46
46
  import { BinaryTaskClassifier } from "./utils/taskClassifier.js";
47
47
  import { initializeOpenTelemetry, shutdownOpenTelemetry, flushOpenTelemetry, getLangfuseHealthStatus, setLangfuseContext, } from "./services/server/ai/observability/instrumentation.js";
48
48
  import { initializeMem0 } from "./memory/mem0Initializer.js";
49
+ /**
50
+ * NeuroLink - Universal AI Development Platform
51
+ *
52
+ * Main SDK class providing unified access to 13+ AI providers with enterprise features:
53
+ * - Multi-provider support (OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, etc.)
54
+ * - MCP (Model Context Protocol) tool integration with 58+ external servers
55
+ * - Human-in-the-Loop (HITL) security workflows for regulated industries
56
+ * - Redis-based conversation memory and persistence
57
+ * - Enterprise middleware system for monitoring and control
58
+ * - Automatic provider fallback and retry logic
59
+ * - Streaming with real-time token delivery
60
+ * - Multimodal support (text, images, PDFs, CSV)
61
+ *
62
+ * @category Core
63
+ *
64
+ * @example Basic usage
65
+ * ```typescript
66
+ * import { NeuroLink } from '@juspay/neurolink';
67
+ *
68
+ * const neurolink = new NeuroLink();
69
+ *
70
+ * const result = await neurolink.generate({
71
+ * input: { text: 'Explain quantum computing' },
72
+ * provider: 'vertex',
73
+ * model: 'gemini-3-flash'
74
+ * });
75
+ *
76
+ * console.log(result.content);
77
+ * ```
78
+ *
79
+ * @example With HITL security
80
+ * ```typescript
81
+ * const neurolink = new NeuroLink({
82
+ * hitl: {
83
+ * enabled: true,
84
+ * requireApproval: ['writeFile', 'executeCode'],
85
+ * confidenceThreshold: 0.85
86
+ * }
87
+ * });
88
+ * ```
89
+ *
90
+ * @example With Redis memory
91
+ * ```typescript
92
+ * const neurolink = new NeuroLink({
93
+ * conversationMemory: {
94
+ * enabled: true,
95
+ * redis: {
96
+ * url: 'redis://localhost:6379'
97
+ * }
98
+ * }
99
+ * });
100
+ * ```
101
+ *
102
+ * @example With MCP tools
103
+ * ```typescript
104
+ * const neurolink = new NeuroLink();
105
+ *
106
+ * // Discover available tools
107
+ * const tools = await neurolink.getAvailableTools();
108
+ *
109
+ * // Use tools in generation
110
+ * const result = await neurolink.generate({
111
+ * input: { text: 'Read the README.md file' },
112
+ * tools: ['readFile']
113
+ * });
114
+ * ```
115
+ *
116
+ * @see {@link GenerateOptions} for generation options
117
+ * @see {@link StreamOptions} for streaming options
118
+ * @see {@link NeurolinkConstructorConfig} for configuration options
119
+ * @since 1.0.0
120
+ */
49
121
  export class NeuroLink {
50
122
  mcpInitialized = false;
51
123
  emitter = new EventEmitter();
@@ -1191,6 +1263,106 @@ Current user's request: ${currentInput}`;
1191
1263
  throw error;
1192
1264
  }
1193
1265
  }
1266
+ /**
1267
+ * Generate AI response with comprehensive feature support.
1268
+ *
1269
+ * Primary method for AI generation with support for all NeuroLink features:
1270
+ * - Multi-provider support (13+ providers)
1271
+ * - MCP tool integration
1272
+ * - Structured JSON output with Zod schemas
1273
+ * - Conversation memory (Redis or in-memory)
1274
+ * - HITL security workflows
1275
+ * - Middleware execution
1276
+ * - Multimodal inputs (images, PDFs, CSV)
1277
+ *
1278
+ * @category Generation
1279
+ *
1280
+ * @param optionsOrPrompt - Generation options or simple text prompt
1281
+ * @param optionsOrPrompt.input - Input text and optional files
1282
+ * @param optionsOrPrompt.provider - AI provider name (e.g., 'vertex', 'openai', 'anthropic')
1283
+ * @param optionsOrPrompt.model - Model name to use
1284
+ * @param optionsOrPrompt.tools - MCP tools to enable for this generation
1285
+ * @param optionsOrPrompt.schema - Zod schema for structured output validation
1286
+ * @param optionsOrPrompt.temperature - Sampling temperature (0-2, default: 1.0)
1287
+ * @param optionsOrPrompt.maxTokens - Maximum tokens to generate
1288
+ * @param optionsOrPrompt.thinkingConfig - Extended thinking configuration (thinkingLevel: 'minimal'|'low'|'medium'|'high')
1289
+ * @param optionsOrPrompt.context - Context with conversationId and userId for memory
1290
+ * @returns Promise resolving to generation result with content and metadata
1291
+ *
1292
+ * @example Basic text generation
1293
+ * ```typescript
1294
+ * const result = await neurolink.generate({
1295
+ * input: { text: 'Explain quantum computing' }
1296
+ * });
1297
+ * console.log(result.content);
1298
+ * ```
1299
+ *
1300
+ * @example With specific provider
1301
+ * ```typescript
1302
+ * const result = await neurolink.generate({
1303
+ * input: { text: 'Write a poem' },
1304
+ * provider: 'anthropic',
1305
+ * model: 'claude-3-opus'
1306
+ * });
1307
+ * ```
1308
+ *
1309
+ * @example With MCP tools
1310
+ * ```typescript
1311
+ * const result = await neurolink.generate({
1312
+ * input: { text: 'Read README.md and summarize it' },
1313
+ * tools: ['readFile']
1314
+ * });
1315
+ * ```
1316
+ *
1317
+ * @example With structured output
1318
+ * ```typescript
1319
+ * import { z } from 'zod';
1320
+ *
1321
+ * const schema = z.object({
1322
+ * name: z.string(),
1323
+ * age: z.number(),
1324
+ * city: z.string()
1325
+ * });
1326
+ *
1327
+ * const result = await neurolink.generate({
1328
+ * input: { text: 'Extract person info: John is 30 years old from NYC' },
1329
+ * schema: schema
1330
+ * });
1331
+ * // result.structuredData is type-safe!
1332
+ * ```
1333
+ *
1334
+ * @example With conversation memory
1335
+ * ```typescript
1336
+ * const result = await neurolink.generate({
1337
+ * input: { text: 'What did we discuss earlier?' },
1338
+ * context: {
1339
+ * conversationId: 'conv-123',
1340
+ * userId: 'user-456'
1341
+ * }
1342
+ * });
1343
+ * ```
1344
+ *
1345
+ * @example With multimodal input
1346
+ * ```typescript
1347
+ * const result = await neurolink.generate({
1348
+ * input: {
1349
+ * text: 'Describe this image',
1350
+ * images: ['/path/to/image.jpg']
1351
+ * },
1352
+ * provider: 'vertex'
1353
+ * });
1354
+ * ```
1355
+ *
1356
+ * @throws {Error} When input text is missing or invalid
1357
+ * @throws {Error} When all providers fail to generate content
1358
+ * @throws {Error} When structured output validation fails
1359
+ * @throws {Error} When HITL approval is denied
1360
+ *
1361
+ * @see {@link GenerateOptions} for all available options
1362
+ * @see {@link GenerateResult} for result structure
1363
+ * @see {@link stream} for streaming generation
1364
+ * @since 1.0.0
1365
+ */
1194
1366
  async generate(optionsOrPrompt) {
1195
1367
  const originalPrompt = this._extractOriginalPrompt(optionsOrPrompt);
1196
1368
  // Convert string prompt to full options