LLMGenerationOptions
Defined in: core/options.ts:3
Properties
Section titled “Properties”extra?
Section titled “extra?”
optionalextra:Record<string,unknown>
Defined in: core/options.ts:12
maxTokens?
Section titled “maxTokens?”
optionalmaxTokens:number
Defined in: core/options.ts:6
messages
Section titled “messages”messages:
LLMMessage[]
Defined in: core/options.ts:5
metadata?
Section titled “metadata?”
optionalmetadata:Record<string,unknown>
Defined in: core/options.ts:11
model:
string
Defined in: core/options.ts:4
responseFormat?
Section titled “responseFormat?”
optionalresponseFormat:"text"
Defined in: core/options.ts:10
signal?
Section titled “signal?”
optionalsignal:AbortSignal
Defined in: core/options.ts:47
Optional abort signal for cancelling the request mid-flight.
When the signal is aborted, the provider will attempt to cancel
the underlying HTTP request and the stream will terminate with
an abort error. Use isAbortError() from @/core/errors to
detect cancellation in error handling.
Example
Section titled “Example”const controller = new AbortController();
const stream = client.stream({ model: "claude-3-5-sonnet-20241022", messages: [{ role: "user", content: "Tell me a long story" }], signal: controller.signal,});
// Cancel after 5 secondssetTimeout(() => controller.abort(), 5000);
try { for await (const chunk of stream) { process.stdout.write(chunk.text); }} catch (error) { if (isAbortError(error)) { console.log("\nRequest was cancelled"); } else { throw error; }}stopSequences?
Section titled “stopSequences?”
optionalstopSequences:string[]
Defined in: core/options.ts:9
temperature?
Section titled “temperature?”
optionaltemperature:number
Defined in: core/options.ts:7
optionaltopP:number
Defined in: core/options.ts:8