@pinecone-database/pinecone
Version:
This is the official Node.js SDK for [Pinecone](https://www.pinecone.io), written in TypeScript.
196 lines • 10.6 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/**
* Pinecone Assistant Control Plane API
* Pinecone Assistant Engine is a context engine to store and retrieve relevant knowledge from millions of documents at scale. This API supports creating and managing assistants.
*
* The version of the OpenAPI document: 2025-04
* Contact: support@pinecone.io
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManageAssistantsApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
*
*/
class ManageAssistantsApi extends runtime.BaseAPI {
/**
* Create an assistant. This is where you specify the underlying training model, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an assistant](https://docs.pinecone.io/guides/assistant/create-assistant)
* Create an assistant
*/
async createAssistantRaw(requestParameters, initOverrides) {
if (requestParameters.createAssistantRequest === null || requestParameters.createAssistantRequest === undefined) {
throw new runtime.RequiredError('createAssistantRequest', 'Required parameter requestParameters.createAssistantRequest was null or undefined when calling createAssistant.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication
}
const response = await this.request({
path: `/assistants`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.CreateAssistantRequestToJSON)(requestParameters.createAssistantRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AssistantFromJSON)(jsonValue));
}
/**
* Create an assistant. This is where you specify the underlying training model, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an assistant](https://docs.pinecone.io/guides/assistant/create-assistant)
* Create an assistant
*/
async createAssistant(requestParameters, initOverrides) {
const response = await this.createAssistantRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Delete an existing assistant. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#delete-an-assistant)
* Delete an assistant
*/
async deleteAssistantRaw(requestParameters, initOverrides) {
if (requestParameters.assistantName === null || requestParameters.assistantName === undefined) {
throw new runtime.RequiredError('assistantName', 'Required parameter requestParameters.assistantName was null or undefined when calling deleteAssistant.');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication
}
const response = await this.request({
path: `/assistants/{assistant_name}`.replace(`{${"assistant_name"}}`, encodeURIComponent(String(requestParameters.assistantName))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Delete an existing assistant. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#delete-an-assistant)
* Delete an assistant
*/
async deleteAssistant(requestParameters, initOverrides) {
await this.deleteAssistantRaw(requestParameters, initOverrides);
}
/**
* Get the status of an assistant. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#get-the-status-of-an-assistant)
* Check assistant status
*/
async getAssistantRaw(requestParameters, initOverrides) {
if (requestParameters.assistantName === null || requestParameters.assistantName === undefined) {
throw new runtime.RequiredError('assistantName', 'Required parameter requestParameters.assistantName was null or undefined when calling getAssistant.');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication
}
const response = await this.request({
path: `/assistants/{assistant_name}`.replace(`{${"assistant_name"}}`, encodeURIComponent(String(requestParameters.assistantName))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.AssistantFromJSON)(jsonValue));
}
/**
* Get the status of an assistant. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#get-the-status-of-an-assistant)
* Check assistant status
*/
async getAssistant(requestParameters, initOverrides) {
const response = await this.getAssistantRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* List of all assistants in a project. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#list-assistants-for-a-project).
* List assistants
*/
async listAssistantsRaw(initOverrides) {
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication
}
const response = await this.request({
path: `/assistants`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ListAssistants200ResponseFromJSON)(jsonValue));
}
/**
* List of all assistants in a project. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#list-assistants-for-a-project).
* List assistants
*/
async listAssistants(initOverrides) {
const response = await this.listAssistantsRaw(initOverrides);
return await response.value();
}
/**
* Update an existing assistant. You can modify the assistant\'s instructions. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#add-instructions-to-an-assistant).
* Update an assistant
*/
async updateAssistantRaw(requestParameters, initOverrides) {
if (requestParameters.assistantName === null || requestParameters.assistantName === undefined) {
throw new runtime.RequiredError('assistantName', 'Required parameter requestParameters.assistantName was null or undefined when calling updateAssistant.');
}
if (requestParameters.updateAssistantRequest === null || requestParameters.updateAssistantRequest === undefined) {
throw new runtime.RequiredError('updateAssistantRequest', 'Required parameter requestParameters.updateAssistantRequest was null or undefined when calling updateAssistant.');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication
}
const response = await this.request({
path: `/assistants/{assistant_name}`.replace(`{${"assistant_name"}}`, encodeURIComponent(String(requestParameters.assistantName))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.UpdateAssistantRequestToJSON)(requestParameters.updateAssistantRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UpdateAssistant200ResponseFromJSON)(jsonValue));
}
/**
* Update an existing assistant. You can modify the assistant\'s instructions. For guidance and examples, see [Manage assistants](https://docs.pinecone.io/guides/assistant/manage-assistants#add-instructions-to-an-assistant).
* Update an assistant
*/
async updateAssistant(requestParameters, initOverrides) {
const response = await this.updateAssistantRaw(requestParameters, initOverrides);
return await response.value();
}
}
exports.ManageAssistantsApi = ManageAssistantsApi;
//# sourceMappingURL=ManageAssistantsApi.js.map
;