Interface: StreamObjectOptions<T>
Defined in: packages/agentos/src/api/streamObject.ts:49
Options for a streamObject call.
Shares the same shape as GenerateObjectOptions from generateObject.
At minimum, schema and either prompt or messages must be supplied.
Example
const opts: StreamObjectOptions<typeof mySchema> = {
schema: z.object({ name: z.string(), items: z.array(z.string()) }),
prompt: 'List 3 fruits with a person name',
};
Type Parameters
T
T extends ZodType
The Zod schema type defining the expected output shape.
Properties
apiKey?
optionalapiKey:string
Defined in: packages/agentos/src/api/streamObject.ts:108
Override the API key.
baseUrl?
optionalbaseUrl:string
Defined in: packages/agentos/src/api/streamObject.ts:111
Override the provider base URL.
maxRetries?
optionalmaxRetries:number
Defined in: packages/agentos/src/api/streamObject.ts:105
Number of retries on validation failure. Unlike generateObject, streaming retries are not currently supported (the stream is consumed once). This field is accepted for API symmetry but is unused; validation errors on the final object throw immediately.
Default
0
maxTokens?
optionalmaxTokens:number
Defined in: packages/agentos/src/api/streamObject.ts:95
Hard cap on output tokens.
messages?
optionalmessages:Message[]
Defined in: packages/agentos/src/api/streamObject.ts:89
Full conversation history.
model?
optionalmodel:string
Defined in: packages/agentos/src/api/streamObject.ts:63
Model identifier. Accepts "provider:model" or plain model name with provider.
Example
`"openai:gpt-4o"`, `"gpt-4o-mini"`
prompt?
optionalprompt:string
Defined in: packages/agentos/src/api/streamObject.ts:83
User prompt.
provider?
optionalprovider:string
Defined in: packages/agentos/src/api/streamObject.ts:56
Provider name. When supplied without model, the default text model for
the provider is resolved automatically.
Example
`"openai"`, `"anthropic"`, `"ollama"`
schema
schema:
T
Defined in: packages/agentos/src/api/streamObject.ts:66
Zod schema defining the expected output shape.
schemaDescription?
optionalschemaDescription:string
Defined in: packages/agentos/src/api/streamObject.ts:80
Description of the schema, injected into the system prompt.
Example
`"A shopping list with a person's name and items."`
schemaName?
optionalschemaName:string
Defined in: packages/agentos/src/api/streamObject.ts:73
Human-readable name for the schema, injected into the system prompt.
Example
`"ShoppingList"`
system?
optionalsystem:string
Defined in: packages/agentos/src/api/streamObject.ts:86
System prompt. Schema instructions are appended automatically.
temperature?
optionaltemperature:number
Defined in: packages/agentos/src/api/streamObject.ts:92
Sampling temperature forwarded to the provider.