Skip to main content

chat_completions

Creates, updates, deletes, gets or lists a chat_completions resource.

Overview

Namechat_completions
TypeResource
Idcloudflare.aisearch.chat_completions

Fields

The following fields are returned by SELECT queries:

SELECT not supported for this resource, use SHOW METHODS to view available operations for the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
chat_completions_by_accountinsertid, account_id, messagesPerforms a chat completion request against an AI Search instance, using indexed content as context for generating responses.
chat_completionsinsertaccount_id, name, messages, ai_search_optionsPerforms a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
idstringResource ID.
namestringResource name.

INSERT examples

Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.

INSERT INTO cloudflare.aisearch.chat_completions (
ai_search_options,
messages,
model,
stream,
id,
account_id
)
SELECT
'{{ ai_search_options }}',
'{{ messages }}' /* required */,
'{{ model }}',
{{ stream }},
'{{ id }}',
'{{ account_id }}'
RETURNING
id,
choices,
chunks,
model,
object
;