cloudflare
Version:
The official TypeScript library for the Cloudflare API
143 lines • 5.91 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as JobsAPI from "./jobs.mjs";
import { BaseJobs, Jobs, } from "./jobs.mjs";
import { V4PagePaginationArray, } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseInstances = /* @__PURE__ */ (() => {
class BaseInstances extends APIResource {
/**
* Create a new AI Search instance with the given configuration. If type is omitted
* or null, a non-blank HTTP(S) source infers web-crawler and an existing R2 bucket
* source infers r2. A missing or blank source without a type creates a managed
* upload-only instance. Search for Agents instances require the default namespace.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/ai-search/instances`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update an AI Search instance. Submitting Search for Agents metadata requires the
* default namespace; omitting or removing it is allowed elsewhere. Submit Search
* for Agents metadata and restrictive or unknown public endpoint changes or custom
* domains in separate PUT requests, even when resubmitting unchanged metadata.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
update(id, params, options) {
const { account_id, ...body } = params;
return this._client.put(path `/accounts/${account_id}/ai-search/instances/${id}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List all AI Search instances in the account.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/ai-search/instances`, (V4PagePaginationArray), { query, ...options });
}
/**
* Permanently delete an AI Search instance and all its indexed data.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
delete(id, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/ai-search/instances/${id}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Performs a chat completion request against an AI Search instance, using indexed
* content as context for generating responses.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
chatCompletions(id, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/ai-search/instances/${id}/chat/completions`, {
body,
...options,
});
}
/**
* Retrieve the configuration and status of an AI Search instance.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
read(id, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/ai-search/instances/${id}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Executes a semantic search query against an AI Search instance to find relevant
* indexed content.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
search(id, params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/ai-search/instances/${id}/search`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Retrieve usage and indexing statistics for an AI Search instance.
*
* Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances
* (and descendant paths) instead.
*
* @deprecated
*/
stats(id, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/ai-search/instances/${id}/stats`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseInstances._key = Object.freeze([
'aiSearch',
'instances',
]);
return BaseInstances;
})();
export var Instances = /* @__PURE__ */ (() => {
class Instances extends BaseInstances {
constructor() {
super(...arguments);
this.jobs = new JobsAPI.Jobs(this._client);
}
}
Instances.Jobs = Jobs;
Instances.BaseJobs = BaseJobs;
return Instances;
})();
//# sourceMappingURL=instances.mjs.map