---
title: Multi-Instance Chat Completions
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[AI Search](https://developers.cloudflare.com/api/go/resources/ai_search)

[Namespaces](https://developers.cloudflare.com/api/go/resources/ai_search/subresources/namespaces)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Multi-Instance Chat Completions

client.AISearch.Namespaces.ChatCompletions(ctx, name, params) (\*[NamespaceChatCompletionsResponse](<https://developers.cloudflare.com/api/go/resources/ai_search#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/ai-search/namespaces/{name}/chat/completions

Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

name string

[Link to this property](<#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20name%20%3E%20(schema)>)

<details>

<summary>

params NamespaceChatCompletionsParams

</summary>

AccountID param.Field\[string]

Path param

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

<details>

<summary>

AISearchOptions param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/ai_search/subresources/namespaces/methods/chat_completions#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)">NamespaceChatCompletionsParamsAISearchOptions</a>]

Body param

</summary>

InstanceIDs \[]string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20instance_ids">Link to this property</a>

<details>

<summary>

Cache NamespaceChatCompletionsParamsAISearchOptionsCacheOptional

</summary>

<details>

<summary>

CacheThreshold NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThresholdOptional

</summary>

One of the following:

const NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThresholdSuperStrictMatch NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThreshold = "super\_strict\_match"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20cache_threshold%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThresholdCloseEnough NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThreshold = "close\_enough"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20cache_threshold%20%3E%20(member)%201">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThresholdFlexibleFriend NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThreshold = "flexible\_friend"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20cache_threshold%20%3E%20(member)%202">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThresholdAnythingGoes NamespaceChatCompletionsParamsAISearchOptionsCacheCacheThreshold = "anything\_goes"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20cache_threshold%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20cache_threshold">Link to this property</a>

Enabled boolOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache%20%3E%20(property)%20enabled">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20cache">Link to this property</a>

<details>

<summary>

CustomMetadata map\[string, NamespaceChatCompletionsParamsAISearchOptionsCustomMetadataUnion]Optional

Metadata added to AI Gateway logs for requests triggered by this operation. Accepts up to 2 string, number, or boolean entries. Keys ‘ai-search’, ‘task’, ‘origin’, and keys beginning with ‘cf.’ are reserved.

</summary>

One of the following:

UnionString

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20custom_metadata%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

UnionFloat

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20custom_metadata%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

UnionBool

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20custom_metadata%20%3E%20(items)%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20custom_metadata">Link to this property</a>

<details>

<summary>

QueryRewrite NamespaceChatCompletionsParamsAISearchOptionsQueryRewriteOptional

</summary>

Enabled boolOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20query_rewrite%20%3E%20(property)%20enabled">Link to this property</a>

Model stringOptional

A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20query_rewrite%20%3E%20(property)%20model">Link to this property</a>

RewritePrompt stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20query_rewrite%20%3E%20(property)%20rewrite_prompt">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20query_rewrite">Link to this property</a>

<details>

<summary>

Reranking NamespaceChatCompletionsParamsAISearchOptionsRerankingOptional

</summary>

Enabled boolOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20reranking%20%3E%20(property)%20enabled">Link to this property</a>

MatchThreshold float64Optional

maximum1

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20reranking%20%3E%20(property)%20match_threshold">Link to this property</a>

Model stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20reranking%20%3E%20(property)%20model">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20reranking">Link to this property</a>

<details>

<summary>

Retrieval NamespaceChatCompletionsParamsAISearchOptionsRetrievalOptional

</summary>

<details>

<summary>

BoostBy \[]NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByOptional

Metadata fields to boost search results by. Overrides the instance-level boost\_by config. Direction defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields. Fields must match ‘timestamp’ or a defined custom\_metadata field.

</summary>

Field string

Metadata field name to boost by. Use ‘timestamp’ for document freshness, or any custom\_metadata field. Numeric and datetime fields support all four directions (asc, desc, exists, not\_exists); text/boolean fields only support exists/not\_exists.

maxLength64

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20field">Link to this property</a>

<details>

<summary>

Direction NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirectionOptional

Boost direction. ‘desc’ = higher values rank higher (e.g. newer timestamps). ‘asc’ = lower values rank higher. ‘exists’ = boost chunks that have the field. ‘not\_exists’ = boost chunks that lack the field. Optional — defaults to ‘asc’ for numeric/datetime fields, ‘exists’ for text/boolean fields.

</summary>

One of the following:

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirectionAsc NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirection = "asc"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20direction%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirectionDesc NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirection = "desc"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20direction%20%3E%20(member)%201">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirectionExists NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirection = "exists"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20direction%20%3E%20(member)%202">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirectionNotExists NamespaceChatCompletionsParamsAISearchOptionsRetrievalBoostByDirection = "not\_exists"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20direction%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by%20%3E%20(items)%20%3E%20(property)%20direction">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20boost_by">Link to this property</a>

ContextExpansion int64Optional

maximum3

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20context_expansion">Link to this property</a>

Filters map\[string, unknown]Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20filters">Link to this property</a>

<details>

<summary>

FusionMethod NamespaceChatCompletionsParamsAISearchOptionsRetrievalFusionMethodOptional

</summary>

One of the following:

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalFusionMethodMax NamespaceChatCompletionsParamsAISearchOptionsRetrievalFusionMethod = "max"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20fusion_method%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalFusionMethodRrf NamespaceChatCompletionsParamsAISearchOptionsRetrievalFusionMethod = "rrf"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20fusion_method%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20fusion_method">Link to this property</a>

<details>

<summary>

KeywordMatchMode NamespaceChatCompletionsParamsAISearchOptionsRetrievalKeywordMatchModeOptional

Controls which documents are candidates for BM25 scoring. ‘and’ restricts candidates to documents containing all query terms; ‘or’ includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval\_options.keyword\_match\_mode, then to ‘and’.

</summary>

One of the following:

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalKeywordMatchModeAnd NamespaceChatCompletionsParamsAISearchOptionsRetrievalKeywordMatchMode = "and"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20keyword_match_mode%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalKeywordMatchModeOr NamespaceChatCompletionsParamsAISearchOptionsRetrievalKeywordMatchMode = "or"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20keyword_match_mode%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20keyword_match_mode">Link to this property</a>

MatchThreshold float64Optional

maximum1

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20match_threshold">Link to this property</a>

MaxNumResults int64Optional

maximum50

minimum1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20max_num_results">Link to this property</a>

<details>

<summary>

RetrievalType NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalTypeOptional

</summary>

One of the following:

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalTypeVector NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalType = "vector"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20retrieval_type%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalTypeKeyword NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalType = "keyword"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20retrieval_type%20%3E%20(member)%201">Link to this property</a>

const NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalTypeHybrid NamespaceChatCompletionsParamsAISearchOptionsRetrievalRetrievalType = "hybrid"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20retrieval_type%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20retrieval_type">Link to this property</a>

ReturnOnFailure boolOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval%20%3E%20(property)%20return_on_failure">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options%20%3E%20(schema)%20%3E%20(property)%20retrieval">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20ai_search_options">Link to this property</a>

<details>

<summary>

Messages param.Field\[\[]NamespaceChatCompletionsParamsMessage]

Body param

</summary>

<details>

<summary>

Content NamespaceChatCompletionsParamsMessagesContentUnion

</summary>

One of the following:

UnionString

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsParamsMessagesContentArray \[]NamespaceChatCompletionsParamsMessagesContentArray

</summary>

One of the following:

<details>

<summary>

type NamespaceChatCompletionsParamsMessagesContentArrayObject struct{…}

</summary>

Text string

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20text">Link to this property</a>

Type NamespaceChatCompletionsParamsMessagesContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsParamsMessagesContentArrayObject struct{…}

</summary>

<details>

<summary>

ImageURL NamespaceChatCompletionsParamsMessagesContentArrayObjectImageURL

</summary>

URL string

maxLength20971520

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20image_url%20%3E%20(property)%20url">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20image_url">Link to this property</a>

Type NamespaceChatCompletionsParamsMessagesContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsParamsMessagesContentArrayObject struct{…}

</summary>

<details>

<summary>

File NamespaceChatCompletionsParamsMessagesContentArrayObjectFile

</summary>

Filename string

maxLength255

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20filename">Link to this property</a>

FileData stringOptional

maxLength13981144

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20file_data">Link to this property</a>

FileID stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20file_id">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file">Link to this property</a>

Type NamespaceChatCompletionsParamsMessagesContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%201">Link to this property</a>

UnionString

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20content">Link to this property</a>

<details>

<summary>

Role NamespaceChatCompletionsParamsMessagesRole

</summary>

One of the following:

const NamespaceChatCompletionsParamsMessagesRoleSystem NamespaceChatCompletionsParamsMessagesRole = "system"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsParamsMessagesRoleDeveloper NamespaceChatCompletionsParamsMessagesRole = "developer"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role%20%3E%20(member)%201">Link to this property</a>

const NamespaceChatCompletionsParamsMessagesRoleUser NamespaceChatCompletionsParamsMessagesRole = "user"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role%20%3E%20(member)%202">Link to this property</a>

const NamespaceChatCompletionsParamsMessagesRoleAssistant NamespaceChatCompletionsParamsMessagesRole = "assistant"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role%20%3E%20(member)%203">Link to this property</a>

const NamespaceChatCompletionsParamsMessagesRoleTool NamespaceChatCompletionsParamsMessagesRole = "tool"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages%20%3E%20(schema)%20%3E%20(items)%20%3E%20(property)%20role">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20messages">Link to this property</a>

Model param.Field\[string]Optional

Body param: A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20model">Link to this property</a>

Stream param.Field\[bool]Optional

Body param

<a href="#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default%20%3E%20(param)%20stream">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_search.namespaces%20%3E%20(method)%20chat_completions%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type NamespaceChatCompletionsResponse struct{…}

</summary>

<details>

<summary>

Choices \[]NamespaceChatCompletionsResponseChoice

</summary>

<details>

<summary>

Message NamespaceChatCompletionsResponseChoicesMessage

</summary>

<details>

<summary>

Content NamespaceChatCompletionsResponseChoicesMessageContentUnion

</summary>

One of the following:

UnionString

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsResponseChoicesMessageContentArray \[]NamespaceChatCompletionsResponseChoicesMessageContentArrayItem

</summary>

One of the following:

<details>

<summary>

type NamespaceChatCompletionsResponseChoicesMessageContentArrayObject struct{…}

</summary>

Text string

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20text">Link to this property</a>

Type NamespaceChatCompletionsResponseChoicesMessageContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsResponseChoicesMessageContentArrayObject struct{…}

</summary>

<details>

<summary>

ImageURL NamespaceChatCompletionsResponseChoicesMessageContentArrayObjectImageURL

</summary>

URL string

maxLength20971520

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20image_url%20%3E%20(property)%20url">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20image_url">Link to this property</a>

Type NamespaceChatCompletionsResponseChoicesMessageContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

<details>

<summary>

type NamespaceChatCompletionsResponseChoicesMessageContentArrayObject struct{…}

</summary>

<details>

<summary>

File NamespaceChatCompletionsResponseChoicesMessageContentArrayObjectFile

</summary>

Filename string

maxLength255

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20filename">Link to this property</a>

FileData stringOptional

maxLength13981144

minLength1

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20file_data">Link to this property</a>

FileID stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file%20%3E%20(property)%20file_id">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20file">Link to this property</a>

Type NamespaceChatCompletionsResponseChoicesMessageContentArrayObjectType

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202%20%3E%20(property)%20type">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201%20%3E%20(items)%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%201">Link to this property</a>

UnionString

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20content">Link to this property</a>

<details>

<summary>

Role NamespaceChatCompletionsResponseChoicesMessageRole

</summary>

One of the following:

const NamespaceChatCompletionsResponseChoicesMessageRoleSystem NamespaceChatCompletionsResponseChoicesMessageRole = "system"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsResponseChoicesMessageRoleDeveloper NamespaceChatCompletionsResponseChoicesMessageRole = "developer"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role%20%3E%20(member)%201">Link to this property</a>

const NamespaceChatCompletionsResponseChoicesMessageRoleUser NamespaceChatCompletionsResponseChoicesMessageRole = "user"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role%20%3E%20(member)%202">Link to this property</a>

const NamespaceChatCompletionsResponseChoicesMessageRoleAssistant NamespaceChatCompletionsResponseChoicesMessageRole = "assistant"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role%20%3E%20(member)%203">Link to this property</a>

const NamespaceChatCompletionsResponseChoicesMessageRoleTool NamespaceChatCompletionsResponseChoicesMessageRole = "tool"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role%20%3E%20(member)%204">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message%20%3E%20(property)%20role">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20message">Link to this property</a>

Index int64Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices%20%3E%20(items)%20%3E%20(property)%20index">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20choices">Link to this property</a>

<details>

<summary>

Chunks \[]NamespaceChatCompletionsResponseChunk

</summary>

ID string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20id">Link to this property</a>

InstanceID string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20instance_id">Link to this property</a>

Score float64

maximum1

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20score">Link to this property</a>

Text string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20text">Link to this property</a>

Type string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20type">Link to this property</a>

<details>

<summary>

Item NamespaceChatCompletionsResponseChunksItemOptional

</summary>

Key string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20item%20%3E%20(property)%20key">Link to this property</a>

Metadata map\[string, unknown]Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20item%20%3E%20(property)%20metadata">Link to this property</a>

Timestamp float64Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20item%20%3E%20(property)%20timestamp">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20item">Link to this property</a>

<details>

<summary>

ScoringDetails NamespaceChatCompletionsResponseChunksScoringDetailsOptional

</summary>

<details>

<summary>

FusionMethod NamespaceChatCompletionsResponseChunksScoringDetailsFusionMethodOptional

</summary>

One of the following:

const NamespaceChatCompletionsResponseChunksScoringDetailsFusionMethodRrf NamespaceChatCompletionsResponseChunksScoringDetailsFusionMethod = "rrf"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20fusion_method%20%3E%20(member)%200">Link to this property</a>

const NamespaceChatCompletionsResponseChunksScoringDetailsFusionMethodMax NamespaceChatCompletionsResponseChunksScoringDetailsFusionMethod = "max"

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20fusion_method%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20fusion_method">Link to this property</a>

KeywordRank float64Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20keyword_rank">Link to this property</a>

KeywordScore float64Optional

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20keyword_score">Link to this property</a>

RerankingScore float64Optional

maximum1

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20reranking_score">Link to this property</a>

VectorRank float64Optional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20vector_rank">Link to this property</a>

VectorScore float64Optional

maximum1

minimum0

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details%20%3E%20(property)%20vector_score">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks%20%3E%20(items)%20%3E%20(property)%20scoring_details">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20chunks">Link to this property</a>

ID stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20id">Link to this property</a>

<details>

<summary>

Errors \[]NamespaceChatCompletionsResponseErrorOptional

</summary>

InstanceID string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20instance_id">Link to this property</a>

Message string

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20errors%20%3E%20(items)%20%3E%20(property)%20message">Link to this property</a>

</details>

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20errors">Link to this property</a>

Model stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20model">Link to this property</a>

Object stringOptional

<a href="#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)%20%3E%20(property)%20object">Link to this property</a>

</details>

[Link to this property](<#(resource)%20ai_search.namespaces%20%3E%20(model)%20NamespaceChatCompletionsResponse%20%3E%20(schema)>)

### Multi-Instance Chat Completions

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/ai_search"
  "github.com/cloudflare/cloudflare-go/option"
  "github.com/cloudflare/cloudflare-go/shared"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  response, err := client.AISearch.Namespaces.ChatCompletions(
    context.TODO(),
    "my-namespace",
    ai_search.NamespaceChatCompletionsParams{
      AccountID: cloudflare.F("c3dc5f0b34a14ff8e1b3ec04895e1b22"),
      AISearchOptions: cloudflare.F(ai_search.NamespaceChatCompletionsParamsAISearchOptions{
        InstanceIDs: cloudflare.F([]string{"my-ai-search"}),
      }),
      Messages: cloudflare.F([]ai_search.NamespaceChatCompletionsParamsMessage{ai_search.NamespaceChatCompletionsParamsMessage{
        Content: cloudflare.F[ai_search.NamespaceChatCompletionsParamsMessagesContentUnion](shared.UnionString("string")),
        Role: cloudflare.F(ai_search.NamespaceChatCompletionsParamsMessagesRoleSystem),
      }}),
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.ID)
}
```

200 example

```
{
  "choices": [
    {
      "message": {
        "content": "string",
        "role": "system"
      },
      "index": 0
    }
  ],
  "chunks": [
    {
      "id": "id",
      "instance_id": "instance_id",
      "score": 0,
      "text": "text",
      "type": "type",
      "item": {
        "key": "key",
        "metadata": {
          "foo": "bar"
        },
        "timestamp": 0
      },
      "scoring_details": {
        "fusion_method": "rrf",
        "keyword_rank": 0,
        "keyword_score": 0,
        "reranking_score": 0,
        "vector_rank": 0,
        "vector_score": 0
      }
    }
  ],
  "id": "id",
  "errors": [
    {
      "instance_id": "instance_id",
      "message": "message"
    }
  ],
  "model": "model",
  "object": "object"
}
```

##### Returns Examples

200 example

```
{
  "choices": [
    {
      "message": {
        "content": "string",
        "role": "system"
      },
      "index": 0
    }
  ],
  "chunks": [
    {
      "id": "id",
      "instance_id": "instance_id",
      "score": 0,
      "text": "text",
      "type": "type",
      "item": {
        "key": "key",
        "metadata": {
          "foo": "bar"
        },
        "timestamp": 0
      },
      "scoring_details": {
        "fusion_method": "rrf",
        "keyword_rank": 0,
        "keyword_score": 0,
        "reranking_score": 0,
        "vector_rank": 0,
        "vector_score": 0
      }
    }
  ],
  "id": "id",
  "errors": [
    {
      "instance_id": "instance_id",
      "message": "message"
    }
  ],
  "model": "model",
  "object": "object"
}
```