AbstractGenerate chat completions across multiple instances within the bound namespace (streaming). Fans out to the specified instance_ids, merges context, and generates a response.
Chat completions request with stream: true and required ai_search_options.instance_ids.
ReadableStream of server-sent events.
Generate chat completions across multiple instances within the bound namespace. Fans out to the specified instance_ids, merges context, and generates a response.
Chat completions request with required ai_search_options.instance_ids.
Chat completion response with choices, chunks tagged by instance_id, and optional partial-failure errors.
Create a new instance within the bound namespace.
Instance configuration. Only id is required — omit type and source to create with built-in storage.
Instance service for the newly created instance.
Delete an instance from the bound namespace.
Instance name to delete.
Get an instance by name within the bound namespace.
Instance name.
Instance service for search, chat, update, stats, items, and jobs.
List instances in the bound namespace.
Optionalparams: AiSearchListInstancesParamsOptional pagination, search, and ordering parameters.
Array of instance metadata with pagination info.
Search across multiple instances within the bound namespace. Fans out to the specified instance_ids and merges results.
Search request with required ai_search_options.instance_ids.
Search response with chunks tagged by instance_id and optional partial-failure errors.
Namespace-level AI Search service.
Used as the type of
env.AI_SEARCH(namespace binding viaai_search_namespaces). Scoped to a single namespace. Provides dynamic instance access, creation, deletion, and multi-instance search/chat operations.Example