Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Class References
Function References
Interface References
Type Alias References
Variable References

createChatOptions

Function: createChatOptions()

ts
function createChatOptions<TAdapter, TSchema, TStream>(options): TextActivityOptions<TAdapter, TSchema, TStream>;
function createChatOptions<TAdapter, TSchema, TStream>(options): TextActivityOptions<TAdapter, TSchema, TStream>;

Defined in: packages/typescript/ai/src/activities/chat/index.ts:213

Create typed options for the chat() function without executing. This is useful for pre-defining configurations with full type inference.

Type Parameters

TAdapter

TAdapter extends AnyTextAdapter

TSchema

TSchema extends SchemaInput | undefined = undefined

TStream

TStream extends boolean = true

Parameters

options

TextActivityOptions<TAdapter, TSchema, TStream>

Returns

TextActivityOptions<TAdapter, TSchema, TStream>

Example

ts
const chatOptions = createChatOptions({
  adapter: anthropicText('claude-sonnet-4-5'),
})

const stream = chat({ ...chatOptions, messages })
const chatOptions = createChatOptions({
  adapter: anthropicText('claude-sonnet-4-5'),
})

const stream = chat({ ...chatOptions, messages })