NeuroLink API Reference v9.62.0
NeuroLink API Reference / GenerateOptions
GenerateOptions =
object
Defined in: types/generate.ts:36
Generate function options type - Primary method for content generation Supports multimodal content while maintaining backward compatibility
input:
object
Defined in: types/generate.ts:37
text:
string
optionalimages?: (Buffer|string|ImageWithAltText)[]
Images to include in the request. Supports simple image data (Buffer, string) or objects with alt text for accessibility.
images: [imageBuffer, "https://example.com/image.jpg"];images: [
{ data: imageBuffer, altText: "Product screenshot showing main dashboard" },
{ data: "https://example.com/chart.png", altText: "Sales chart for Q3 2024" },
];
optionalcsvFiles?: (Buffer|string)[]
optionalpdfFiles?: (Buffer|string)[]
optionalvideoFiles?: (Buffer|string)[]
optionalfiles?: (Buffer|string|FileWithMetadata)[]
optionalcontent?:Content[]
optionalsegments?:DirectorSegment[]
Director Mode segments. When provided, Director Mode is activated automatically. Each segment contains its own prompt and image. Must contain 2-10 segments.
optionaloutput?:object
Defined in: types/generate.ts:91
Output configuration options
optionalformat?:"text"|"structured"|"json"
Output format for text generation
optionalmode?:"text"|"video"|"ppt"
Output mode - determines the type of content generated
- "text": Standard text generation (default)
- "video": Video generation using models like Veo 3.1
- "ppt": PowerPoint presentation generation
optionalvideo?:VideoOutputOptions
Video generation configuration (used when mode is "video") Requires an input image and text prompt
optionalppt?:PPTOutputOptions
PowerPoint generation configuration (used when mode is "ppt") Generates slides based on text prompt
optionaldirector?:DirectorModeOptions
Director Mode configuration (only used when input.segments is provided) Controls transition prompts, durations, and concurrency.
output: {
format: "text";
}output: {
mode: "video",
video: {
resolution: "1080p",
length: 8,
aspectRatio: "16:9",
audio: true
}
}
optionalcsvOptions?:object
Defined in: types/generate.ts:119
optionalmaxRows?:number
optionalformatStyle?:"raw"|"markdown"|"json"
optionalincludeHeaders?:boolean
optionalvideoOptions?:object
Defined in: types/generate.ts:126
optionalframes?:number
optionalquality?:number
optionalformat?:"jpeg"|"png"
optionaltranscribeAudio?:boolean
optionaltts?:TTSOptions
Defined in: types/generate.ts:165
Text-to-Speech (TTS) configuration
Enable audio generation from the text response. The generated audio will be
returned in the result's audio field as a TTSResult object.
const result = await neurolink.generate({
input: { text: "Tell me a story" },
provider: "google-ai",
tts: { enabled: true, voice: "en-US-Neural2-C" },
});
console.log(result.audio?.buffer); // Audio Bufferconst result = await neurolink.generate({
input: { text: "Speak slowly and clearly" },
provider: "google-ai",
tts: {
enabled: true,
voice: "en-US-Neural2-D",
speed: 0.8,
pitch: 2.0,
format: "mp3",
quality: "standard",
},
});
optionalstt?:STTOptions&object
Defined in: types/generate.ts:184
Speech-to-Text (STT) configuration
Enable audio transcription. When enabled, the audio provided via stt.audio
will be transcribed to text and used as the prompt.
optionalprovider?:string
optionalaudio?:Buffer|ArrayBuffer
const neurolink = new NeuroLink();
const result = await neurolink.generate({
input: { text: "" },
provider: "openai",
stt: {
enabled: true,
provider: "whisper",
language: "en-US",
audio: audioBuffer,
},
});
// STT transcribes the audio, result.transcription contains the transcription
optionalthinkingConfig?:object
Defined in: types/generate.ts:226
Thinking/reasoning configuration for extended thinking models
Enables extended thinking capabilities for supported models.
Gemini 3 Models (gemini-3.1-pro-preview, gemini-3-flash-preview):
Use thinkingLevel to control reasoning depth:
minimal- Near-zero thinking (Flash only)low- Fast reasoning for simple tasksmedium- Balanced reasoning/latencyhigh- Maximum reasoning depth (default for Pro)
Anthropic Claude (claude-3-7-sonnet, etc.):
Use budgetTokens to set token budget for thinking.
optionalenabled?:boolean
optionaltype?:"enabled"|"disabled"
optionalbudgetTokens?:number
Token budget for thinking (Anthropic models)
optionalthinkingLevel?:"minimal"|"low"|"medium"|"high"
Thinking level for Gemini 3 models: minimal, low, medium, high
const result = await neurolink.generate({
input: { text: "Solve this complex problem..." },
provider: "google-ai",
model: "gemini-3.1-pro-preview",
thinkingConfig: {
thinkingLevel: "high",
},
});const result = await neurolink.generate({
input: { text: "Solve this complex math problem..." },
provider: "anthropic",
model: "claude-3-7-sonnet-20250219",
thinkingConfig: {
enabled: true,
budgetTokens: 10000,
},
});
optionalprovider?:AIProviderName|string
Defined in: types/generate.ts:236
optionalmodel?:string
Defined in: types/generate.ts:237
optionalregion?:string
Defined in: types/generate.ts:238
optionaltemperature?:number
Defined in: types/generate.ts:239
optionalmaxTokens?:number
Defined in: types/generate.ts:240
optionalsystemPrompt?:string
Defined in: types/generate.ts:241
optionalschema?:ValidationSchema
Defined in: types/generate.ts:274
Zod schema for structured output validation
Google Gemini Limitation
Google Vertex AI and Google AI Studio cannot combine function calling with
structured output. You MUST use disableTools: true when using schemas with
Google providers.
Error without disableTools: "Function calling with a response mime type: 'application/json' is unsupported"
This is a documented Google API limitation, not a NeuroLink bug. All frameworks (LangChain, Vercel AI SDK, Agno, Instructor) use this approach.
// ✅ Correct for Google providers
const result = await neurolink.generate({
schema: MySchema,
provider: "vertex",
disableTools: true, // Required for Google
});
// ✅ No restriction for other providers
const result = await neurolink.generate({
schema: MySchema,
provider: "openai", // Works without disableTools
});https://ai.google.dev/gemini-api/docs/function-calling
optionaltools?:Record<string,Tool>
Defined in: types/generate.ts:275
optionalenabledToolNames?:string[]
Defined in: types/generate.ts:289
Filter available tools by name. Only tools with names in this array will be made available. Used by dynamic arguments to dynamically select which tools to enable.
await neurolink.generate({
input: { text: "Search for information" },
enabledToolNames: ["websearchGrounding", "readFile"],
});
optionaltimeout?:number|string
Defined in: types/generate.ts:290
optionalabortSignal?:AbortSignal
Defined in: types/generate.ts:292
AbortSignal for external cancellation of the AI call
optionaldisableTools?:boolean
Defined in: types/generate.ts:310
Disable tool execution (including built-in tools)
For Google Gemini providers when using schemas Google Vertex AI and Google AI Studio require this flag when using structured output (schemas) due to Google API limitations.
// Required for Google providers with schemas
await neurolink.generate({
schema: MySchema,
provider: "vertex",
disableTools: true,
});
optionaltoolFilter?:string[]
Defined in: types/generate.ts:313
Include only these tools by name (whitelist). If set, only matching tools are available.
optionalexcludeTools?:string[]
Defined in: types/generate.ts:316
Exclude these tools by name (blacklist). Applied after toolFilter.
optionalskipToolPromptInjection?:boolean
Defined in: types/generate.ts:324
Skip injecting tool schemas into the system prompt.
When true, tools are ONLY passed natively via the provider's tools parameter,
avoiding duplicate tool definitions (~30K tokens savings per call).
Default: false (backward compatible — tool schemas are injected into system prompt).
optionaldisableToolCache?:boolean
Defined in: types/generate.ts:327
Disable tool result caching for this request (overrides global mcp.cache.enabled)
optionalmaxSteps?:number
Defined in: types/generate.ts:330
Maximum number of tool execution steps (default: 200)
optionaltoolChoice?:ToolChoice<Record<string,Tool>>
Defined in: types/generate.ts:345
Tool choice configuration for the generation. Controls whether and which tools the model must call.
"auto"(default): the model can choose whether and which tools to call"none": no tool calls allowed"required": the model must call at least one tool{ type: "tool", toolName: string }: the model must call the specified tool
Note: When used without prepareStep, this applies to every step in the
maxSteps loop. Using "required" or { type: "tool" } without prepareStep
will cause infinite tool calls until maxSteps is exhausted.
optionalprepareStep?: (options) =>PromiseLike<{model?:LanguageModel;toolChoice?:ToolChoice<Record<string,Tool>>;experimental_activeTools?:string[]; } |undefined>
Defined in: types/generate.ts:370
Optional callback that runs before each step in a multi-step generation.
Allows dynamically changing toolChoice and available tools per step.
This is the recommended way to enforce specific tool calls on certain steps while allowing the model freedom on others.
Maps to Vercel AI SDK's experimental_prepareStep.
StepResult<Record<string, Tool>>[]
number
number
LanguageModel
PromiseLike<{ model?: LanguageModel; toolChoice?: ToolChoice<Record<string, Tool>>; experimental_activeTools?: string[]; } | undefined>
prepareStep: ({ stepNumber, steps }) => {
if (stepNumber === 0) {
return {
toolChoice: { type: "tool", toolName: "myTool" },
};
}
return { toolChoice: "auto" };
};https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text#parameters
optionalenableEvaluation?:boolean
Defined in: types/generate.ts:385
optionalenableAnalytics?:boolean
Defined in: types/generate.ts:386
optionalcontext?:StandardRecord
Defined in: types/generate.ts:387
optionalevaluationDomain?:string
Defined in: types/generate.ts:390
optionaltoolUsageContext?:string
Defined in: types/generate.ts:391
optionalconversationHistory?:object[]
Defined in: types/generate.ts:398
role:
string
content:
string
Use conversationMessages instead. This field uses a simple {role, content} shape
that is not consumed by buildMessagesArray() — messages passed here will NOT reach the AI model
as proper conversation turns. conversationMessages uses the full ChatMessage type and is
correctly wired through the entire generate pipeline.
optionalconversationMessages?:ChatMessage[]
Defined in: types/generate.ts:406
Previous conversation as a ChatMessage array. Messages are injected as proper multi-turn conversation history before the current prompt, so the AI model sees them as real prior exchanges (not text dumped into the prompt). Used by task continuation mode and available to external callers.
optionalfactoryConfig?:object
Defined in: types/generate.ts:409
optionaldomainType?:string
optionaldomainConfig?:StandardRecord
optionalenhancementType?:"domain-configuration"|"streaming-optimization"|"mcp-integration"|"legacy-migration"|"context-conversion"
optionalpreserveLegacyFields?:boolean
optionalvalidateDomainData?:boolean
optionalstreaming?:object
Defined in: types/generate.ts:423
optionalenabled?:boolean
optionalchunkSize?:number
optionalbufferSize?:number
optionalenableProgress?:boolean
optionalfallbackToGenerate?:boolean
optionalworkflow?:string
Defined in: types/generate.ts:432
optionalworkflowConfig?:WorkflowConfig
Defined in: types/generate.ts:433
optionalrag?:RAGConfig
Defined in: types/generate.ts:467
RAG (Retrieval-Augmented Generation) configuration.
When provided, NeuroLink automatically loads the specified files, chunks them, generates embeddings, and creates a search tool that the AI model can invoke on demand to find relevant context before answering.
const result = await neurolink.generate({
input: { text: "What is RAG?" },
provider: "vertex",
rag: {
files: ["./docs/guide.md"],
},
});const result = await neurolink.generate({
input: { text: "Explain chunking strategies" },
provider: "vertex",
rag: {
files: ["./docs/guide.md", "./docs/api.md"],
strategy: "markdown",
chunkSize: 512,
topK: 5,
},
});
optionalmaxBudgetUsd?:number
Defined in: types/generate.ts:482
Maximum budget in USD for this session. When the accumulated cost of all generate() calls on this NeuroLink instance exceeds this value, subsequent calls will throw a budget-exceeded error before making the API request.
const result = await neurolink.generate({
input: { text: "Summarize this" },
maxBudgetUsd: 1.0,
});
optionalrequestId?:string
Defined in: types/generate.ts:489
Optional request identifier for observability and log correlation. When provided, this ID is forwarded to spans, logs, and telemetry so callers can correlate generation traces back to their own request lifecycle.
optionalmiddleware?:MiddlewareFactoryOptions
Defined in: types/generate.ts:504
Per-call middleware configuration.
optionalonFinish?:OnFinishCallback
Defined in: types/generate.ts:507
Callback invoked when generation completes successfully.
optionalonError?:OnErrorCallback
Defined in: types/generate.ts:510
Callback invoked when generation encounters an error.
optionalrequestContext?:Record<string,unknown>
Defined in: types/generate.ts:513
Pre-validated user context for the request
optionalauth?:object
Defined in: types/generate.ts:516
Raw auth token — validated by configured auth provider
token:
string
optionalcredentials?:NeurolinkCredentials
Defined in: types/generate.ts:523
Per-provider credential overrides for this request.
Overrides instance-level credentials set in new NeuroLink({ credentials }).
Unset providers fall through to instance credentials, then environment variables.
optionalproviderFallback?: (error) =>Promise<{provider?:string;model?:string; } |null>
Defined in: types/generate.ts:529
Curator P2-3: per-call fallback callback. Overrides any
instance-level providerFallback set on new NeuroLink({...}).
unknown
Promise<{ provider?: string; model?: string; } | null>
optionalmodelChain?:string[]
Defined in: types/generate.ts:537
Curator P2-3: per-call ordered model chain. Overrides any
instance-level modelChain. Tried in order on model-access-denied.
optionalmemory?:object
Defined in: types/generate.ts:547
Per-call memory control.
Override the global memory SDK behavior for this specific call.
All flags default to true when the global memory SDK is enabled.
If the global memory SDK is disabled, these flags have no effect.
optionalenabled?:boolean
Master toggle for this call. When false, both read and write are skipped. Defaults to true.
optionalread?:boolean
Whether to read condensed memory and prepend to prompt. Defaults to true.
optionalwrite?:boolean
Whether to write (add/condense) the conversation into memory after completion. Defaults to true.
optionaladditionalUsers?:AdditionalMemoryUser[]
Additional users whose memory should be retrieved/stored alongside the primary user. Each entry can override the condensation prompt and maxWords for that user. Primary user is still determined by context.userId.