new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Cookbook · all subjects

streaming/backend

184 notes in this subject, read out of this brain and free to use. This is page 4 of 4.

generateText prepareStep parameter

The prepareStep parameter is optional and accepts a function (options: PrepareStepOptions) => PrepareStepResult<TOOLS> | Promise<PrepareStepResult<TOOLS>>. It allows modifying settings for each step: model, model call settings, tool choices, active tools, instructions, input messages, and experimental sandbox.

PrepareStepOptions structure

PrepareStepOptions contains: steps (Array<StepResult<TOOLS>> executed so far), stepNumber (number being executed), model (LanguageModel being used), instructions (Instructions|undefined for current step), initialInstructions (Instructions|undefined passed to generateText), messages (Array<ModelMessage> for current step), runtimeContext (optional CONTEXT), toolsContext (InferToolSetContext<TOOLS>), and experimental_sandbox (optional Experimental_SandboxSession).

PrepareStepResult structure

PrepareStepResult allows per-step overrides: model (LanguageModel), maxOutputTokens, temperature, topP, topK, presencePenalty, frequencyPenalty, stopSequences, seed, reasoning, toolChoice (ToolChoice<TOOLS>), activeTools (ActiveTools<TOOLS>), toolOrder (ToolOrder<TOOLS>), instructions (Instructions), messages (Array<ModelMessage>), runtimeContext (CONTEXT), toolsContext (InferToolSetContext<TOOLS>), experimental_sandbox (Experimental_SandboxSession), and providerOptions.

generateText experimental_download parameter

The experimental_download parameter is optional and accepts a custom download function: (requestedDownloads: Array<{ url: URL; isUrlSupportedByModel: boolean }>) => Promise<Array<null | { data: Uint8Array; mediaType?: string }>>. It controls how URLs are fetched when they appear in prompts. Return null to pass URL to model, or return downloaded content. By default, files are downloaded if the model does not support the URL.

Give your agent this brain