diff --git a/.eslintrc.json b/.eslintrc.json index 4a280aea..e7d792de 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "es2021": true, "node": true }, - "ignorePatterns": ["dist", "src/pinecone-generated-ts-fetch", "src/v0"], + "ignorePatterns": ["dist", "src/pinecone-generated-ts-fetch"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", diff --git a/.prettierignore b/.prettierignore index c67c9e76..f542d5b9 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,3 @@ dist node_modules -src/pinecone-generated-ts-fetch -src/v0 \ No newline at end of file +src/pinecone-generated-ts-fetch \ No newline at end of file diff --git a/README.md b/README.md index 6c5b2b99..03496f5f 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ This is the official Node.js client for [Pinecone](https://www.pinecone.io), wri ## Documentation - [**Reference Documentation**](https://sdk.pinecone.io/typescript/classes/Pinecone.html) -- If you are upgrading from a `v0.x` beta client, check out the [**v1 Migration Guide**](https://github.com/pinecone-io/pinecone-ts-client/blob/main/v1-migration.md). ### Example code @@ -629,7 +628,3 @@ If you do not specify a namespace, the records in the default namespace `''` wil If you are ready to take a JavaScript application to production where raw performance is the overriding concern, you can set the environment variable `PINECONE_DISABLE_RUNTIME_VALIDATIONS="true"` to disable runtime argument validation in the Pinecone client. Runtime validations are used to provide feedback when incorrect method options are provided, for example if you attempt to create an index without specifying a required dimension property. These runtime validations are most helpful for users who are not developing with Typescript or who are experimenting in a REPL or notebook-type setting. But once you've tested an application and have gained confidence things are working as expected, you can disable these checks to gain a small improvement in performance. This will have the most impact if your workload is upserting very large amounts of data. - -## Legacy exports - -For information about the legacy `PineconeClient` export, see the [old README](https://github.com/pinecone-io/pinecone-ts-client/blob/main/README.v0.md). diff --git a/README.v0.md b/README.v0.md deleted file mode 100644 index 71abc6ab..00000000 --- a/README.v0.md +++ /dev/null @@ -1,276 +0,0 @@ -# Pinecone Node.js Client (Legacy 0.x versions) - -> [!NOTE] -> A more up-to-date version of the Typescript client has been released and you are strongly encouraged to update and migrate to the new client export, `Pinecone`. This older version of the README is intended to serve as documentation for legacy usage of the `PineconeClient` export. - -> **_⚠️ Warning_** -> -> All 0.x versions of the Pinecone client should be regarded as a **public preview** -> ("Beta") client. Test thoroughly before using this client for production workloads. -> No SLAs or technical support commitments are provided for this client. Expect -> potential breaking changes in future releases. - -## Installation - -``` -npm i @pinecone-database/pinecone -``` - -## Usage - -Set the following environment variables: - -```bash -PINECONE_API_KEY=your_api_key -PINECONE_ENVIRONMENT=your_environment -``` - -## Initializing the client - -```typescript -import { PineconeClient } from '@pinecone-database/pinecone'; - -// Create a client -const client = new PineconeClient(); - -// Initialize the client -await client.init({ - apiKey: process.env.PINECONE_API_KEY, - environment: process.env.PINECONE_ENVIRONMENT, -}); -``` - -## Control plane operations - -The Pinecone control plane allows you to perform the following operations: - -1. Create, configure and delete indexes -2. Get information about an existing indexes -3. Create and delete collections -4. Select an index to operate on - -## Indexes - -### Create Index - -```ts -const createRequest: CreateRequest = { - name: indexName, - dimension: dimensions, - metric, -}; - -await client.createIndex({ createRequest }); -``` - -### Delete Index - -```ts -await client.deleteIndex({ indexName }); -``` - -### Describe Index - -```ts -const indexDescription = await client.describeIndex({ indexName }); -``` - -Example result: - -```json -{ - "database": { - "name": "my-index", - "metric": "cosine", - "dimension": 10, - "replicas": 1, - "shards": 1, - "pods": 1, - "pod_type": "p1.x1" - }, - "status": { - "waiting": [], - "crashed": [], - "host": "my-index-[project-id].svc.[environment].pinecone.io", - "port": 433, - "state": "Ready", - "ready": true - } -} -``` - -### List Indexes - -```ts -const list = await client.listIndexes(); -``` - -Example result: - -```json -["index1", "index2"] -``` - -### Select an index - -To operate on an index, you must select it. This is done by calling the `Index` method on the client. - -```ts -const index = client.Index(indexName); -``` - -## Collections - -### Create Collection - -```ts -const createCollectionRequest: CreateCollectionRequest = { - name: collection, - source: indexName, -}; -await client.createCollection({ createCollectionRequest }); -``` - -### Delete Collection - -```ts -await client.deleteCollection(collection); -``` - -### Describe Collection - -```ts -const describeCollection = await client.describeCollection({ collectionName }); -``` - -Example result: - -```json -{ - "name": "my-collection", - "status": "Ready", - "size": 3059815, - "dimension": 10 -} -``` - -### List Collections - -```ts -const list = await client.listCollections(); -``` - -Example result: - -```json -["collection1", "collection2"] -``` - -## Index operations - -The Pinecone index operations allow you to perform the following operations instances of `Vector`. - -A `Vector` is defined as follows: - -```ts -type Vector = { - id: string; - values: number[]; - metadata?: object; - sparseValues: { - indices: [15, 30, 11]; - values: [0.1, 0.2, 0.3]; - }; // optional sparse values -}; -``` - -After selecting an index to operate on, you can: - -### Upsert vectors - -```ts -const upsertRequest: UpsertRequest = { - vectors, - namespace, -}; -await index.upsert({ upsertRequest }); -``` - -### Query vectors - -```ts -const vector = [...] // a vector - -const queryRequest: QueryRequest = { - topK: 1, - vector, - namespace, - includeMetadata: true, - includeValues: true, -} -``` - -To query with a sparse vector: - -```ts -const queryRequest: QueryRequest = { - topK: 1, - vector, - namespace, - includeMetadata: true, - includeValues: true, - sparseVector: { - indices: [15, 30, 11], - values: [0.1, 0.2, 0.3], - }, -}; -``` - -To execute the query: - -```ts -const queryResponse = await index.query({ queryRequest }); -``` - -### Update a vector - -```ts -const updateRequest: UpdateRequest = { - id: vectorId, // the ID of the vector to update - values: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], // the new vector values - sparseValues: { - indices: [15, 30, 11], - values: [0.1, 0.2, 0.3], - }, // optional sparse values - metadata: metadata, // the new metadata - namespace, -}; -await index.update({ updateRequest }); -``` - -### Fetch vectors by their IDs - -```ts -const fetchResult = await index.fetch({ - ids: [vectorIDs], - namespace, -}); -``` - -### Delete vectors - -```ts -await index.delete1({ - ids: [vectorIDs], - namespace, -}); -``` - -### Delete all vectors in a namespace - -```ts -await index.delete1({ - deleteAll: true, - namespace, -}); -``` diff --git a/jest.config.js b/jest.config.js index 69aa574d..5c19dbef 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,7 +18,6 @@ module.exports = { collectCoverageFrom: [ '/src/**/*.ts', '!**/src/pinecone-generated-ts-fetch/**', - '!**/src/v0/**', '!**/node_modules/**', '!**/vendor/**', ], diff --git a/src/control/indexOperationsBuilder.ts b/src/control/indexOperationsBuilder.ts index fae1f399..044ad618 100644 --- a/src/control/indexOperationsBuilder.ts +++ b/src/control/indexOperationsBuilder.ts @@ -18,7 +18,7 @@ export const indexOperationsBuilder = ( apiKey, queryParamsStringify, headers: { - 'User-Agent': buildUserAgent(false), + 'User-Agent': buildUserAgent(), ...headers, }, fetchApi: getFetch(config), diff --git a/src/data/vectorOperationsProvider.ts b/src/data/vectorOperationsProvider.ts index 4b604137..b3b70618 100644 --- a/src/data/vectorOperationsProvider.ts +++ b/src/data/vectorOperationsProvider.ts @@ -51,7 +51,7 @@ export class VectorOperationsProvider { apiKey: this.config.apiKey, queryParamsStringify, headers: { - 'User-Agent': buildUserAgent(false), + 'User-Agent': buildUserAgent(), }, fetchApi: getFetch(this.config), middleware, diff --git a/src/index.ts b/src/index.ts index 00781e8b..af5b1162 100644 --- a/src/index.ts +++ b/src/index.ts @@ -52,19 +52,3 @@ export type { IndexList, IndexModel, } from './pinecone-generated-ts-fetch'; - -// Legacy exports for backwards compatibility -export { PineconeClient } from './v0'; -export { utils } from './v0/utils'; -export { - CreateCollectionRequest as CreateCollectionRequestV0, - CreateRequest, - DeleteRequest, - PatchRequest, - QueryRequest, - QueryVector, - ScoredVector, - UpdateRequest, - UpsertRequest, - Vector, -} from './v0/pinecone-generated-ts-fetch'; diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index ab1f4a30..9d79c8e9 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -1,7 +1,7 @@ import { isEdge } from './environment'; import * as packageInfo from '../version.json'; -export const buildUserAgent = (isLegacy: boolean) => { +export const buildUserAgent = () => { // We always want to include the package name and version // along with the langauge name to help distinguish these // requests from those emitted by other clients @@ -24,9 +24,5 @@ export const buildUserAgent = (isLegacy: boolean) => { userAgentParts.push(`node ${process.version}`); } - // Use this flag to identify whether they are using the v0 legacy - // client export called PineconeClient - userAgentParts.push(`legacyExport=${isLegacy}`); - return userAgentParts.join('; '); }; diff --git a/src/v0/index.ts b/src/v0/index.ts deleted file mode 100644 index 5f881511..00000000 --- a/src/v0/index.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { - Configuration, - ConfigurationParameters, - IndexOperationsApi, - ResponseError, - VectorOperationsApi, -} from './pinecone-generated-ts-fetch'; -import 'cross-fetch/polyfill'; -import { queryParamsStringify, buildUserAgent } from '../utils'; - - -type PineconeClientConfiguration = { - environment: string; - apiKey: string; -}; - -class PineconeError extends Error { - constructor(message: string) { - super(message); - this.name = 'PineconeError'; - Object.setPrototypeOf(this, new.target.prototype); - this.stack = ''; - } -} - -async function streamToArrayBuffer( - stream: ReadableStream -): Promise { - let result = new Uint8Array(0); - const reader = stream.getReader(); - while (true) { - // eslint-disable-line no-constant-condition - const { done, value } = await reader.read(); - if (done) { - break; - } - - if (value) { - const newResult = new Uint8Array(result.length + value.length); - newResult.set(result); - newResult.set(value, result.length); - result = newResult; - } - } - return result; -} - -async function handler(func: Function, args: any) { - try { - return await func(args); - } catch (e) { - const error = e as ResponseError; - if (error && error.response) { - const body = error.response?.body as ReadableStream; - const buffer = body && (await streamToArrayBuffer(body)); - const text = buffer && new TextDecoder().decode(buffer); - try { - // Handle "RAW" call errors - const json = text && JSON.parse(text); - return Promise.reject(new PineconeError(`${json?.message}`)); - } catch (e) { - return Promise.reject( - new PineconeError( - `PineconeClient: Error calling ${func.name.replace( - 'bound ', - '' - )}: ${text}` - ) - ); - } - } else { - return Promise.reject( - new PineconeError( - `PineconeClient: Error calling ${func.name.replace( - 'bound ', - '' - )}: ${error}` - ) - ); - } - } -} - -function exposeMethods(instance: any, target: PineconeClient) { - for (const prop of Object.keys(Object.getPrototypeOf(instance))) { - let descriptor = instance[prop]; - if ( - descriptor && - typeof descriptor === 'function' && - prop !== 'constructor' - ) { - // @ts-ignore - target[prop] = async (args?) => { - Object.defineProperty(descriptor, 'name', { value: prop }); - let boundFunction: Function = descriptor.bind(instance); - - return handler(boundFunction, args); - }; - } - } -} - -function attachHandler(instance: VectorOperationsApi): VectorOperationsApi { - for (const prop of Object.keys(Object.getPrototypeOf(instance))) { - let descriptor = instance[prop]; - if ( - descriptor && - typeof descriptor === 'function' && - prop !== 'constructor' - ) { - // @ts-ignore - instance[prop] = async (args?) => { - Object.defineProperty(descriptor, 'name', { value: prop }); - let boundFunction: Function = descriptor.bind(instance); - return handler(boundFunction, args); - }; - } - } - return instance; -} - -interface PineconeClient extends IndexOperationsApi {} - -/** - * @deprecated - * Deprecated in v1.0.0 - * - * Use {@link Pinecone} instead. - */ -class PineconeClient { - apiKey: string | null = null; - projectName: string | null = null; - environment: string | null = null; - - private async getProjectName(controllerPath: string, apiKey: string) { - const whoami = `${controllerPath}/actions/whoami`; - const request = { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - 'Api-Key': apiKey, - }, - }; - let response; - try { - response = await fetch(whoami, request); - if (response.status !== 200) { - const error = await response.text(); - const statusText = response.statusText; - throw new Error(`${statusText} - ${error}`); - } else { - const { project_name } = await response.json(); - return project_name; - } - } catch (error) { - throw new PineconeError(`Failed getting project name. ${error}`); - } - } - - public async init(configuration: PineconeClientConfiguration) { - const { environment, apiKey } = configuration; - - this.apiKey = apiKey; - this.environment = environment; - - const controllerPath = `https://controller.${environment}.pinecone.io`; - try { - this.projectName = await this.getProjectName(controllerPath, apiKey); - } catch (error) { - throw error; - } - - const controllerConfigurationParameters: ConfigurationParameters = { - basePath: controllerPath, - apiKey: apiKey, - queryParamsStringify, - headers: { - 'User-Agent': buildUserAgent(true), - } - }; - - const controllerConfiguration = new Configuration( - controllerConfigurationParameters - ); - const indexOperations = new IndexOperationsApi(controllerConfiguration); - exposeMethods(indexOperations, this as PineconeClient); - } - - public Index(index: string) { - if (!this.apiKey) - throw new Error('PineconeClient: API key not set. Call init() first.'); - if (!this.projectName) - throw new Error( - 'PineconeClient: Project name not set. Call init() first.' - ); - if (!this.environment) - throw new Error( - 'PineconeClient: Environment not set. Call init() first.' - ); - - const indexConfigurationParameters: ConfigurationParameters = { - basePath: `https://${index}-${this.projectName}.svc.${this.environment}.pinecone.io`, - apiKey: this.apiKey, - queryParamsStringify, - headers: { - 'User-Agent': buildUserAgent(true), - } - }; - - const indexConfiguration = new Configuration(indexConfigurationParameters); - const vectorOperations = new VectorOperationsApi(indexConfiguration); - return attachHandler(vectorOperations); - } -} - -export { PineconeClient }; diff --git a/src/v0/pinecone-generated-ts-fetch/.openapi-generator/FILES b/src/v0/pinecone-generated-ts-fetch/.openapi-generator/FILES deleted file mode 100644 index 56754e7c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/.openapi-generator/FILES +++ /dev/null @@ -1,36 +0,0 @@ -.openapi-generator-ignore -apis/IndexOperationsApi.ts -apis/VectorOperationsApi.ts -apis/index.ts -index.ts -models/ApproximatedConfig.ts -models/CollectionMeta.ts -models/CreateCollectionRequest.ts -models/CreateRequest.ts -models/CreateRequestIndexConfig.ts -models/DeleteRequest.ts -models/DescribeIndexStatsRequest.ts -models/DescribeIndexStatsResponse.ts -models/FetchResponse.ts -models/HnswConfig.ts -models/IndexMeta.ts -models/IndexMetaDatabase.ts -models/IndexMetaDatabaseIndexConfig.ts -models/IndexMetaDatabaseStatus.ts -models/NamespaceSummary.ts -models/PatchRequest.ts -models/ProtobufAny.ts -models/ProtobufNullValue.ts -models/QueryRequest.ts -models/QueryResponse.ts -models/QueryVector.ts -models/RpcStatus.ts -models/ScoredVector.ts -models/SingleQueryResults.ts -models/SparseValues.ts -models/UpdateRequest.ts -models/UpsertRequest.ts -models/UpsertResponse.ts -models/Vector.ts -models/index.ts -runtime.ts diff --git a/src/v0/pinecone-generated-ts-fetch/.openapi-generator/VERSION b/src/v0/pinecone-generated-ts-fetch/.openapi-generator/VERSION deleted file mode 100644 index c0be8a79..00000000 --- a/src/v0/pinecone-generated-ts-fetch/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -6.4.0 \ No newline at end of file diff --git a/src/v0/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts b/src/v0/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts deleted file mode 100644 index 59334efd..00000000 --- a/src/v0/pinecone-generated-ts-fetch/apis/IndexOperationsApi.ts +++ /dev/null @@ -1,370 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - - -import * as runtime from '../runtime'; -import type { - CollectionMeta, - CreateCollectionRequest, - CreateRequest, - IndexMeta, - PatchRequest, -} from '../models'; -import { - CollectionMetaFromJSON, - CollectionMetaToJSON, - CreateCollectionRequestFromJSON, - CreateCollectionRequestToJSON, - CreateRequestFromJSON, - CreateRequestToJSON, - IndexMetaFromJSON, - IndexMetaToJSON, - PatchRequestFromJSON, - PatchRequestToJSON, -} from '../models'; - -export interface ConfigureIndexRequest { - indexName: string; - patchRequest?: PatchRequest; -} - -export interface CreateCollectionOperationRequest { - createCollectionRequest?: CreateCollectionRequest; -} - -export interface CreateIndexRequest { - createRequest?: CreateRequest; -} - -export interface DeleteCollectionRequest { - collectionName: string; -} - -export interface DeleteIndexRequest { - indexName: string; -} - -export interface DescribeCollectionRequest { - collectionName: string; -} - -export interface DescribeIndexRequest { - indexName: string; -} - -/** - * - */ -export class IndexOperationsApi extends runtime.BaseAPI { - - /** - * This operation specifies the pod type and number of replicas for an index. - */ - async configureIndexRaw(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.indexName === null || requestParameters.indexName === undefined) { - throw new runtime.RequiredError('indexName', 'Required parameter requestParameters.indexName was null or undefined when calling configureIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/databases/{indexName}`.replace(`{${"indexName"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: PatchRequestToJSON(requestParameters.patchRequest), - }, initOverrides); - - return new runtime.TextApiResponse(response) as any; - } - - /** - * This operation specifies the pod type and number of replicas for an index. - */ - async configureIndex(requestParameters: ConfigureIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.configureIndexRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This operation creates a Pinecone collection. - */ - async createCollectionRaw(requestParameters: CreateCollectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/collections`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateCollectionRequestToJSON(requestParameters.createCollectionRequest), - }, initOverrides); - - return new runtime.TextApiResponse(response) as any; - } - - /** - * This operation creates a Pinecone collection. - */ - async createCollection(requestParameters: CreateCollectionOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createCollectionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. - */ - async createIndexRaw(requestParameters: CreateIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/databases`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateRequestToJSON(requestParameters.createRequest), - }, initOverrides); - - return new runtime.TextApiResponse(response) as any; - } - - /** - * This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. - */ - async createIndex(requestParameters: CreateIndexRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createIndexRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This operation deletes an existing collection. - */ - async deleteCollectionRaw(requestParameters: DeleteCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.collectionName === null || requestParameters.collectionName === undefined) { - throw new runtime.RequiredError('collectionName', 'Required parameter requestParameters.collectionName was null or undefined when calling deleteCollection.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections/{collectionName}`.replace(`{${"collectionName"}}`, encodeURIComponent(String(requestParameters.collectionName))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.TextApiResponse(response) as any; - } - - /** - * This operation deletes an existing collection. - */ - async deleteCollection(requestParameters: DeleteCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteCollectionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This operation deletes an existing index. - */ - async deleteIndexRaw(requestParameters: DeleteIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.indexName === null || requestParameters.indexName === undefined) { - throw new runtime.RequiredError('indexName', 'Required parameter requestParameters.indexName was null or undefined when calling deleteIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/databases/{indexName}`.replace(`{${"indexName"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.TextApiResponse(response) as any; - } - - /** - * This operation deletes an existing index. - */ - async deleteIndex(requestParameters: DeleteIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteIndexRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get a description of a collection. - */ - async describeCollectionRaw(requestParameters: DescribeCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.collectionName === null || requestParameters.collectionName === undefined) { - throw new runtime.RequiredError('collectionName', 'Required parameter requestParameters.collectionName was null or undefined when calling describeCollection.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections/{collectionName}`.replace(`{${"collectionName"}}`, encodeURIComponent(String(requestParameters.collectionName))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CollectionMetaFromJSON(jsonValue)); - } - - /** - * Get a description of a collection. - */ - async describeCollection(requestParameters: DescribeCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeCollectionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get a description of an index. - */ - async describeIndexRaw(requestParameters: DescribeIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.indexName === null || requestParameters.indexName === undefined) { - throw new runtime.RequiredError('indexName', 'Required parameter requestParameters.indexName was null or undefined when calling describeIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/databases/{indexName}`.replace(`{${"indexName"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => IndexMetaFromJSON(jsonValue)); - } - - /** - * Get a description of an index. - */ - async describeIndex(requestParameters: DescribeIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeIndexRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This operation returns a list of your Pinecone collections. - */ - async listCollectionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This operation returns a list of your Pinecone collections. - */ - async listCollections(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const response = await this.listCollectionsRaw(initOverrides); - return await response.value(); - } - - /** - * This operation returns a list of your Pinecone indexes. - */ - async listIndexesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/databases`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This operation returns a list of your Pinecone indexes. - */ - async listIndexes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const response = await this.listIndexesRaw(initOverrides); - return await response.value(); - } - -} diff --git a/src/v0/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts b/src/v0/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts deleted file mode 100644 index 057f8521..00000000 --- a/src/v0/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts +++ /dev/null @@ -1,403 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - - -import * as runtime from '../runtime'; -import type { - DeleteRequest, - DescribeIndexStatsRequest, - DescribeIndexStatsResponse, - FetchResponse, - QueryRequest, - QueryResponse, - RpcStatus, - UpdateRequest, - UpsertRequest, - UpsertResponse, -} from '../models'; -import { - DeleteRequestFromJSON, - DeleteRequestToJSON, - DescribeIndexStatsRequestFromJSON, - DescribeIndexStatsRequestToJSON, - DescribeIndexStatsResponseFromJSON, - DescribeIndexStatsResponseToJSON, - FetchResponseFromJSON, - FetchResponseToJSON, - QueryRequestFromJSON, - QueryRequestToJSON, - QueryResponseFromJSON, - QueryResponseToJSON, - RpcStatusFromJSON, - RpcStatusToJSON, - UpdateRequestFromJSON, - UpdateRequestToJSON, - UpsertRequestFromJSON, - UpsertRequestToJSON, - UpsertResponseFromJSON, - UpsertResponseToJSON, -} from '../models'; - -export interface DeleteOperationRequest { - deleteRequest: DeleteRequest; -} - -export interface Delete1Request { - ids?: Array; - deleteAll?: boolean; - namespace?: string; -} - -export interface DescribeIndexStatsOperationRequest { - describeIndexStatsRequest: DescribeIndexStatsRequest; -} - -export interface FetchRequest { - ids: Array; - namespace?: string; -} - -export interface QueryOperationRequest { - queryRequest: QueryRequest; -} - -export interface UpdateOperationRequest { - updateRequest: UpdateRequest; -} - -export interface UpsertOperationRequest { - upsertRequest: UpsertRequest; -} - -/** - * - */ -export class VectorOperationsApi extends runtime.BaseAPI { - - /** - * The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. - * Delete - */ - async _deleteRaw(requestParameters: DeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.deleteRequest === null || requestParameters.deleteRequest === undefined) { - throw new runtime.RequiredError('deleteRequest', 'Required parameter requestParameters.deleteRequest was null or undefined when calling _delete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/vectors/delete`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DeleteRequestToJSON(requestParameters.deleteRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. - * Delete - */ - async _delete(requestParameters: DeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this._deleteRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. - * Delete - */ - async delete1Raw(requestParameters: Delete1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids; - } - - if (requestParameters.deleteAll !== undefined) { - queryParameters['deleteAll'] = requestParameters.deleteAll; - } - - if (requestParameters.namespace !== undefined) { - queryParameters['namespace'] = requestParameters.namespace; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/delete`, - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. - * Delete - */ - async delete1(requestParameters: Delete1Request = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.delete1Raw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `DescribeIndexStats` operation returns statistics about the index\'s contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_index/). - * DescribeIndexStats - */ - async describeIndexStatsRaw(requestParameters: DescribeIndexStatsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.describeIndexStatsRequest === null || requestParameters.describeIndexStatsRequest === undefined) { - throw new runtime.RequiredError('describeIndexStatsRequest', 'Required parameter requestParameters.describeIndexStatsRequest was null or undefined when calling describeIndexStats.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/describe_index_stats`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DescribeIndexStatsRequestToJSON(requestParameters.describeIndexStatsRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DescribeIndexStatsResponseFromJSON(jsonValue)); - } - - /** - * The `DescribeIndexStats` operation returns statistics about the index\'s contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_index/). - * DescribeIndexStats - */ - async describeIndexStats(requestParameters: DescribeIndexStatsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeIndexStatsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `DescribeIndexStats` operation returns statistics about the index\'s contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_index/). - * DescribeIndexStats - */ - async describeIndexStats1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/describe_index_stats`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DescribeIndexStatsResponseFromJSON(jsonValue)); - } - - /** - * The `DescribeIndexStats` operation returns statistics about the index\'s contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_index/). - * DescribeIndexStats - */ - async describeIndexStats1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeIndexStats1Raw(initOverrides); - return await response.value(); - } - - /** - * The `Fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. - * Fetch - */ - async fetchRaw(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.ids === null || requestParameters.ids === undefined) { - throw new runtime.RequiredError('ids', 'Required parameter requestParameters.ids was null or undefined when calling fetch.'); - } - - const queryParameters: any = {}; - - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids; - } - - if (requestParameters.namespace !== undefined) { - queryParameters['namespace'] = requestParameters.namespace; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/fetch`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => FetchResponseFromJSON(jsonValue)); - } - - /** - * The `Fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. - * Fetch - */ - async fetch(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.fetchRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `Query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. - * Query - */ - async queryRaw(requestParameters: QueryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.queryRequest === null || requestParameters.queryRequest === undefined) { - throw new runtime.RequiredError('queryRequest', 'Required parameter requestParameters.queryRequest was null or undefined when calling query.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/query`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: QueryRequestToJSON(requestParameters.queryRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => QueryResponseFromJSON(jsonValue)); - } - - /** - * The `Query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. - * Query - */ - async query(requestParameters: QueryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `Update` operation updates vector in a namespace. If a value is included, it will overwrite the previous value. If a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value. - * Update - */ - async updateRaw(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updateRequest === null || requestParameters.updateRequest === undefined) { - throw new runtime.RequiredError('updateRequest', 'Required parameter requestParameters.updateRequest was null or undefined when calling update.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/vectors/update`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UpdateRequestToJSON(requestParameters.updateRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * The `Update` operation updates vector in a namespace. If a value is included, it will overwrite the previous value. If a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value. - * Update - */ - async update(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `Upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value. - * Upsert - */ - async upsertRaw(requestParameters: UpsertOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.upsertRequest === null || requestParameters.upsertRequest === undefined) { - throw new runtime.RequiredError('upsertRequest', 'Required parameter requestParameters.upsertRequest was null or undefined when calling upsert.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - 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: `/vectors/upsert`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UpsertRequestToJSON(requestParameters.upsertRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => UpsertResponseFromJSON(jsonValue)); - } - - /** - * The `Upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value. - * Upsert - */ - async upsert(requestParameters: UpsertOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.upsertRaw(requestParameters, initOverrides); - return await response.value(); - } - -} diff --git a/src/v0/pinecone-generated-ts-fetch/apis/index.ts b/src/v0/pinecone-generated-ts-fetch/apis/index.ts deleted file mode 100644 index b96ab834..00000000 --- a/src/v0/pinecone-generated-ts-fetch/apis/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './IndexOperationsApi'; -export * from './VectorOperationsApi'; diff --git a/src/v0/pinecone-generated-ts-fetch/index.ts b/src/v0/pinecone-generated-ts-fetch/index.ts deleted file mode 100644 index be9d1ede..00000000 --- a/src/v0/pinecone-generated-ts-fetch/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './apis'; -export * from './models'; diff --git a/src/v0/pinecone-generated-ts-fetch/models/ApproximatedConfig.ts b/src/v0/pinecone-generated-ts-fetch/models/ApproximatedConfig.ts deleted file mode 100644 index c535837a..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/ApproximatedConfig.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ApproximatedConfig - */ -export interface ApproximatedConfig { - /** - * - * @type {number} - * @memberof ApproximatedConfig - */ - kBits?: number; - /** - * - * @type {boolean} - * @memberof ApproximatedConfig - */ - hybrid?: boolean; -} - -/** - * Check if a given object implements the ApproximatedConfig interface. - */ -export function instanceOfApproximatedConfig(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function ApproximatedConfigFromJSON(json: any): ApproximatedConfig { - return ApproximatedConfigFromJSONTyped(json, false); -} - -export function ApproximatedConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApproximatedConfig { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'kBits': !exists(json, 'k_bits') ? undefined : json['k_bits'], - 'hybrid': !exists(json, 'hybrid') ? undefined : json['hybrid'], - }; -} - -export function ApproximatedConfigToJSON(value?: ApproximatedConfig | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'k_bits': value.kBits, - 'hybrid': value.hybrid, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/CollectionMeta.ts b/src/v0/pinecone-generated-ts-fetch/models/CollectionMeta.ts deleted file mode 100644 index aee5dbcc..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/CollectionMeta.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface CollectionMeta - */ -export interface CollectionMeta { - /** - * - * @type {string} - * @memberof CollectionMeta - */ - name?: string; - /** - * The size of the collection in bytes. - * @type {number} - * @memberof CollectionMeta - */ - size?: number; - /** - * The status of the collection. - * @type {string} - * @memberof CollectionMeta - */ - status?: string; -} - -/** - * Check if a given object implements the CollectionMeta interface. - */ -export function instanceOfCollectionMeta(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function CollectionMetaFromJSON(json: any): CollectionMeta { - return CollectionMetaFromJSONTyped(json, false); -} - -export function CollectionMetaFromJSONTyped(json: any, ignoreDiscriminator: boolean): CollectionMeta { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'size': !exists(json, 'size') ? undefined : json['size'], - 'status': !exists(json, 'status') ? undefined : json['status'], - }; -} - -export function CollectionMetaToJSON(value?: CollectionMeta | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'size': value.size, - 'status': value.status, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts deleted file mode 100644 index 99fb49b7..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @deprecated - * - * Deprecated in v1.0.0 along with {@link PineconeClient}. - * - */ -export interface CreateCollectionRequest { - /** - * The name of the collection to be created. - * @type {string} - * @memberof CreateCollectionRequest - */ - name: string; - /** - * The name of the source index to be used as the source for the collection. - * @type {string} - * @memberof CreateCollectionRequest - */ - source: string; -} - -/** - * Check if a given object implements the CreateCollectionRequest interface. - */ -export function instanceOfCreateCollectionRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "source" in value; - - return isInstance; -} - -export function CreateCollectionRequestFromJSON(json: any): CreateCollectionRequest { - return CreateCollectionRequestFromJSONTyped(json, false); -} - -export function CreateCollectionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCollectionRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'source': json['source'], - }; -} - -export function CreateCollectionRequestToJSON(value?: CreateCollectionRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'source': value.source, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/CreateRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/CreateRequest.ts deleted file mode 100644 index 93cfd32e..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/CreateRequest.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { CreateRequestIndexConfig } from './CreateRequestIndexConfig'; -import { - CreateRequestIndexConfigFromJSON, - CreateRequestIndexConfigFromJSONTyped, - CreateRequestIndexConfigToJSON, -} from './CreateRequestIndexConfig'; - -/** - * - * @export - * @interface CreateRequest - */ -export interface CreateRequest { - /** - * The name of the index to be created. The maximum length is 45 characters. - * @type {string} - * @memberof CreateRequest - */ - name: string; - /** - * The dimensions of the vectors to be inserted in the index - * @type {number} - * @memberof CreateRequest - */ - dimension: number; - /** - * The type of vector index. Pinecone supports 'approximated'. - * @type {string} - * @memberof CreateRequest - * @deprecated - */ - indexType?: string; - /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. - * @type {string} - * @memberof CreateRequest - */ - metric?: string; - /** - * The number of pods for the index to use,including replicas. - * @type {number} - * @memberof CreateRequest - */ - pods?: number; - /** - * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. - * @type {number} - * @memberof CreateRequest - */ - replicas?: number; - /** - * The number of shards to be used in the index. - * @type {number} - * @memberof CreateRequest - */ - shards?: number; - /** - * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. - * @type {string} - * @memberof CreateRequest - */ - podType?: string; - /** - * - * @type {CreateRequestIndexConfig} - * @memberof CreateRequest - * @deprecated - */ - indexConfig?: CreateRequestIndexConfig; - /** - * Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: - * ``` - * {"indexed": ["example_metadata_field"]} - * ``` - * @type {object} - * @memberof CreateRequest - */ - metadataConfig?: object | null; - /** - * The name of the collection to create an index from - * @type {string} - * @memberof CreateRequest - */ - sourceCollection?: string; -} - -/** - * Check if a given object implements the CreateRequest interface. - */ -export function instanceOfCreateRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "dimension" in value; - - return isInstance; -} - -export function CreateRequestFromJSON(json: any): CreateRequest { - return CreateRequestFromJSONTyped(json, false); -} - -export function CreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'dimension': json['dimension'], - 'indexType': !exists(json, 'index_type') ? undefined : json['index_type'], - 'metric': !exists(json, 'metric') ? undefined : json['metric'], - 'pods': !exists(json, 'pods') ? undefined : json['pods'], - 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], - 'shards': !exists(json, 'shards') ? undefined : json['shards'], - 'podType': !exists(json, 'pod_type') ? undefined : json['pod_type'], - 'indexConfig': !exists(json, 'index_config') ? undefined : CreateRequestIndexConfigFromJSON(json['index_config']), - 'metadataConfig': !exists(json, 'metadata_config') ? undefined : json['metadata_config'], - 'sourceCollection': !exists(json, 'source_collection') ? undefined : json['source_collection'], - }; -} - -export function CreateRequestToJSON(value?: CreateRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'dimension': value.dimension, - 'index_type': value.indexType, - 'metric': value.metric, - 'pods': value.pods, - 'replicas': value.replicas, - 'shards': value.shards, - 'pod_type': value.podType, - 'index_config': CreateRequestIndexConfigToJSON(value.indexConfig), - 'metadata_config': value.metadataConfig, - 'source_collection': value.sourceCollection, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/CreateRequestIndexConfig.ts b/src/v0/pinecone-generated-ts-fetch/models/CreateRequestIndexConfig.ts deleted file mode 100644 index c9909019..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/CreateRequestIndexConfig.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { - ApproximatedConfig, - instanceOfApproximatedConfig, - ApproximatedConfigFromJSON, - ApproximatedConfigFromJSONTyped, - ApproximatedConfigToJSON, -} from './ApproximatedConfig'; - -/** - * @type CreateRequestIndexConfig - * - * @export - */ -export type CreateRequestIndexConfig = ApproximatedConfig; - -export function CreateRequestIndexConfigFromJSON(json: any): CreateRequestIndexConfig { - return CreateRequestIndexConfigFromJSONTyped(json, false); -} - -export function CreateRequestIndexConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateRequestIndexConfig { - if ((json === undefined) || (json === null)) { - return json; - } - return { ...ApproximatedConfigFromJSONTyped(json, true) }; -} - -export function CreateRequestIndexConfigToJSON(value?: CreateRequestIndexConfig | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - - if (instanceOfApproximatedConfig(value)) { - return ApproximatedConfigToJSON(value as ApproximatedConfig); - } - - return {}; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/DeleteRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/DeleteRequest.ts deleted file mode 100644 index 41603479..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/DeleteRequest.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * The request for the `Delete` operation. - * @export - * @interface DeleteRequest - */ -export interface DeleteRequest { - /** - * Vectors to delete. - * @type {Array} - * @memberof DeleteRequest - */ - ids?: Array; - /** - * This indicates that all vectors in the index namespace should be deleted. - * @type {boolean} - * @memberof DeleteRequest - */ - deleteAll?: boolean; - /** - * The namespace to delete vectors from, if applicable. - * @type {string} - * @memberof DeleteRequest - */ - namespace?: string; - /** - * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive - * with specifying ids to delete in the ids param or using delete_all=True. - * See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof DeleteRequest - */ - filter?: object; -} - -/** - * Check if a given object implements the DeleteRequest interface. - */ -export function instanceOfDeleteRequest(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DeleteRequestFromJSON(json: any): DeleteRequest { - return DeleteRequestFromJSONTyped(json, false); -} - -export function DeleteRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeleteRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'ids': !exists(json, 'ids') ? undefined : json['ids'], - 'deleteAll': !exists(json, 'deleteAll') ? undefined : json['deleteAll'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function DeleteRequestToJSON(value?: DeleteRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ids': value.ids, - 'deleteAll': value.deleteAll, - 'namespace': value.namespace, - 'filter': value.filter, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts deleted file mode 100644 index 53888a01..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * The request for the `DescribeIndexStats` operation. - * @export - * @interface DescribeIndexStatsRequest - */ -export interface DescribeIndexStatsRequest { - /** - * If this parameter is present, the operation only returns statistics - * for vectors that satisfy the filter. - * See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof DescribeIndexStatsRequest - */ - filter?: object; -} - -/** - * Check if a given object implements the DescribeIndexStatsRequest interface. - */ -export function instanceOfDescribeIndexStatsRequest(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DescribeIndexStatsRequestFromJSON(json: any): DescribeIndexStatsRequest { - return DescribeIndexStatsRequestFromJSONTyped(json, false); -} - -export function DescribeIndexStatsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DescribeIndexStatsRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function DescribeIndexStatsRequestToJSON(value?: DescribeIndexStatsRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'filter': value.filter, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts b/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts deleted file mode 100644 index 6d83e6bf..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { NamespaceSummary } from './NamespaceSummary'; -import { - NamespaceSummaryFromJSON, - NamespaceSummaryFromJSONTyped, - NamespaceSummaryToJSON, -} from './NamespaceSummary'; - -/** - * The response for the `DescribeIndexStats` operation. - * @export - * @interface DescribeIndexStatsResponse - */ -export interface DescribeIndexStatsResponse { - /** - * A mapping for each namespace in the index from the namespace name to a - * summary of its contents. If a metadata filter expression is present, the - * summary will reflect only vectors matching that expression. - * @type {{ [key: string]: NamespaceSummary; }} - * @memberof DescribeIndexStatsResponse - */ - namespaces?: { [key: string]: NamespaceSummary; }; - /** - * The dimension of the indexed vectors. - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - dimension?: number; - /** - * The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - indexFullness?: number; - /** - * - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - totalVectorCount?: number; -} - -/** - * Check if a given object implements the DescribeIndexStatsResponse interface. - */ -export function instanceOfDescribeIndexStatsResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DescribeIndexStatsResponseFromJSON(json: any): DescribeIndexStatsResponse { - return DescribeIndexStatsResponseFromJSONTyped(json, false); -} - -export function DescribeIndexStatsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DescribeIndexStatsResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'namespaces': !exists(json, 'namespaces') ? undefined : (mapValues(json['namespaces'], NamespaceSummaryFromJSON)), - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], - 'indexFullness': !exists(json, 'indexFullness') ? undefined : json['indexFullness'], - 'totalVectorCount': !exists(json, 'totalVectorCount') ? undefined : json['totalVectorCount'], - }; -} - -export function DescribeIndexStatsResponseToJSON(value?: DescribeIndexStatsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'namespaces': value.namespaces === undefined ? undefined : (mapValues(value.namespaces, NamespaceSummaryToJSON)), - 'dimension': value.dimension, - 'indexFullness': value.indexFullness, - 'totalVectorCount': value.totalVectorCount, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/FetchResponse.ts b/src/v0/pinecone-generated-ts-fetch/models/FetchResponse.ts deleted file mode 100644 index d17e6a1c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/FetchResponse.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { Vector } from './Vector'; -import { - VectorFromJSON, - VectorFromJSONTyped, - VectorToJSON, -} from './Vector'; - -/** - * The response for the `Fetch` operation. - * @export - * @interface FetchResponse - */ -export interface FetchResponse { - /** - * - * @type {{ [key: string]: Vector; }} - * @memberof FetchResponse - */ - vectors?: { [key: string]: Vector; }; - /** - * The namespace of the vectors. - * @type {string} - * @memberof FetchResponse - */ - namespace?: string; -} - -/** - * Check if a given object implements the FetchResponse interface. - */ -export function instanceOfFetchResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function FetchResponseFromJSON(json: any): FetchResponse { - return FetchResponseFromJSONTyped(json, false); -} - -export function FetchResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FetchResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectors': !exists(json, 'vectors') ? undefined : (mapValues(json['vectors'], VectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function FetchResponseToJSON(value?: FetchResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectors': value.vectors === undefined ? undefined : (mapValues(value.vectors, VectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/HnswConfig.ts b/src/v0/pinecone-generated-ts-fetch/models/HnswConfig.ts deleted file mode 100644 index c6fbfba2..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/HnswConfig.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface HnswConfig - */ -export interface HnswConfig { - /** - * - * @type {number} - * @memberof HnswConfig - */ - efConstruction?: number; - /** - * - * @type {number} - * @memberof HnswConfig - */ - ef?: number; - /** - * - * @type {number} - * @memberof HnswConfig - */ - m?: number; - /** - * - * @type {number} - * @memberof HnswConfig - */ - maxElements?: number; -} - -/** - * Check if a given object implements the HnswConfig interface. - */ -export function instanceOfHnswConfig(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function HnswConfigFromJSON(json: any): HnswConfig { - return HnswConfigFromJSONTyped(json, false); -} - -export function HnswConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): HnswConfig { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'efConstruction': !exists(json, 'ef_construction') ? undefined : json['ef_construction'], - 'ef': !exists(json, 'ef') ? undefined : json['ef'], - 'm': !exists(json, 'M') ? undefined : json['M'], - 'maxElements': !exists(json, 'max_elements') ? undefined : json['max_elements'], - }; -} - -export function HnswConfigToJSON(value?: HnswConfig | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ef_construction': value.efConstruction, - 'ef': value.ef, - 'M': value.m, - 'max_elements': value.maxElements, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/IndexMeta.ts b/src/v0/pinecone-generated-ts-fetch/models/IndexMeta.ts deleted file mode 100644 index 5753ce48..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/IndexMeta.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { IndexMetaDatabase } from './IndexMetaDatabase'; -import { - IndexMetaDatabaseFromJSON, - IndexMetaDatabaseFromJSONTyped, - IndexMetaDatabaseToJSON, -} from './IndexMetaDatabase'; -import type { IndexMetaStatus } from './IndexMetaStatus'; -import { - IndexMetaStatusFromJSON, - IndexMetaStatusFromJSONTyped, - IndexMetaStatusToJSON, -} from './IndexMetaStatus'; - -/** - * - * @export - * @interface IndexMeta - */ -export interface IndexMeta { - /** - * - * @type {IndexMetaDatabase} - * @memberof IndexMeta - */ - database?: IndexMetaDatabase; - /** - * - * @type {IndexMetaStatus} - * @memberof IndexMeta - */ - status?: IndexMetaStatus; -} - -/** - * Check if a given object implements the IndexMeta interface. - */ -export function instanceOfIndexMeta(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function IndexMetaFromJSON(json: any): IndexMeta { - return IndexMetaFromJSONTyped(json, false); -} - -export function IndexMetaFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexMeta { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'database': !exists(json, 'database') ? undefined : IndexMetaDatabaseFromJSON(json['database']), - 'status': !exists(json, 'status') ? undefined : IndexMetaStatusFromJSON(json['status']), - }; -} - -export function IndexMetaToJSON(value?: IndexMeta | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'database': IndexMetaDatabaseToJSON(value.database), - 'status': IndexMetaStatusToJSON(value.status), - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts b/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts deleted file mode 100644 index 918e6e7c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabase.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { IndexMetaDatabaseIndexConfig } from './IndexMetaDatabaseIndexConfig'; -import { - IndexMetaDatabaseIndexConfigFromJSON, - IndexMetaDatabaseIndexConfigFromJSONTyped, - IndexMetaDatabaseIndexConfigToJSON, -} from './IndexMetaDatabaseIndexConfig'; - -/** - * - * @export - * @interface IndexMetaDatabase - */ -export interface IndexMetaDatabase { - /** - * - * @type {string} - * @memberof IndexMetaDatabase - */ - name?: string; - /** - * - * @type {string} - * @memberof IndexMetaDatabase - */ - dimension?: string; - /** - * - * @type {string} - * @memberof IndexMetaDatabase - * @deprecated - */ - indexType?: string; - /** - * - * @type {string} - * @memberof IndexMetaDatabase - */ - metric?: string; - /** - * - * @type {number} - * @memberof IndexMetaDatabase - */ - pods?: number; - /** - * - * @type {number} - * @memberof IndexMetaDatabase - */ - replicas?: number; - /** - * - * @type {number} - * @memberof IndexMetaDatabase - */ - shards?: number; - /** - * - * @type {string} - * @memberof IndexMetaDatabase - */ - podType?: string; - /** - * - * @type {IndexMetaDatabaseIndexConfig} - * @memberof IndexMetaDatabase - */ - indexConfig?: IndexMetaDatabaseIndexConfig; - /** - * - * @type {object} - * @memberof IndexMetaDatabase - */ - metadataConfig?: object; -} - -/** - * Check if a given object implements the IndexMetaDatabase interface. - */ -export function instanceOfIndexMetaDatabase(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function IndexMetaDatabaseFromJSON(json: any): IndexMetaDatabase { - return IndexMetaDatabaseFromJSONTyped(json, false); -} - -export function IndexMetaDatabaseFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexMetaDatabase { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': !exists(json, 'name') ? undefined : json['name'], - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], - 'indexType': !exists(json, 'index_type') ? undefined : json['index_type'], - 'metric': !exists(json, 'metric') ? undefined : json['metric'], - 'pods': !exists(json, 'pods') ? undefined : json['pods'], - 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], - 'shards': !exists(json, 'shards') ? undefined : json['shards'], - 'podType': !exists(json, 'pod_type') ? undefined : json['pod_type'], - 'indexConfig': !exists(json, 'index_config') ? undefined : IndexMetaDatabaseIndexConfigFromJSON(json['index_config']), - 'metadataConfig': !exists(json, 'metadata_config') ? undefined : json['metadata_config'], - }; -} - -export function IndexMetaDatabaseToJSON(value?: IndexMetaDatabase | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'dimension': value.dimension, - 'index_type': value.indexType, - 'metric': value.metric, - 'pods': value.pods, - 'replicas': value.replicas, - 'shards': value.shards, - 'pod_type': value.podType, - 'index_config': IndexMetaDatabaseIndexConfigToJSON(value.indexConfig), - 'metadata_config': value.metadataConfig, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseIndexConfig.ts b/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseIndexConfig.ts deleted file mode 100644 index e0ff087b..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseIndexConfig.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { - ApproximatedConfig, - instanceOfApproximatedConfig, - ApproximatedConfigFromJSON, - ApproximatedConfigFromJSONTyped, - ApproximatedConfigToJSON, -} from './ApproximatedConfig'; - -/** - * @type IndexMetaDatabaseIndexConfig - * - * @export - */ -export type IndexMetaDatabaseIndexConfig = ApproximatedConfig; - -export function IndexMetaDatabaseIndexConfigFromJSON(json: any): IndexMetaDatabaseIndexConfig { - return IndexMetaDatabaseIndexConfigFromJSONTyped(json, false); -} - -export function IndexMetaDatabaseIndexConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexMetaDatabaseIndexConfig { - if ((json === undefined) || (json === null)) { - return json; - } - return { ...ApproximatedConfigFromJSONTyped(json, true) }; -} - -export function IndexMetaDatabaseIndexConfigToJSON(value?: IndexMetaDatabaseIndexConfig | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - - if (instanceOfApproximatedConfig(value)) { - return ApproximatedConfigToJSON(value as ApproximatedConfig); - } - - return {}; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseStatus.ts b/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseStatus.ts deleted file mode 100644 index 2dc8907c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaDatabaseStatus.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface IndexMetaDatabaseStatus - */ -export interface IndexMetaDatabaseStatus { - /** - * - * @type {boolean} - * @memberof IndexMetaDatabaseStatus - */ - ready?: boolean; - /** - * - * @type {string} - * @memberof IndexMetaDatabaseStatus - */ - state?: IndexMetaDatabaseStatusStateEnum; -} - - -/** - * @export - */ -export const IndexMetaDatabaseStatusStateEnum = { - Initializing: 'Initializing', - ScalingUp: 'ScalingUp', - ScalingDown: 'ScalingDown', - Terminating: 'Terminating', - Ready: 'Ready' -} as const; -export type IndexMetaDatabaseStatusStateEnum = typeof IndexMetaDatabaseStatusStateEnum[keyof typeof IndexMetaDatabaseStatusStateEnum]; - - -/** - * Check if a given object implements the IndexMetaDatabaseStatus interface. - */ -export function instanceOfIndexMetaDatabaseStatus(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function IndexMetaDatabaseStatusFromJSON(json: any): IndexMetaDatabaseStatus { - return IndexMetaDatabaseStatusFromJSONTyped(json, false); -} - -export function IndexMetaDatabaseStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexMetaDatabaseStatus { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'ready': !exists(json, 'ready') ? undefined : json['ready'], - 'state': !exists(json, 'state') ? undefined : json['state'], - }; -} - -export function IndexMetaDatabaseStatusToJSON(value?: IndexMetaDatabaseStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ready': value.ready, - 'state': value.state, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts b/src/v0/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts deleted file mode 100644 index 3aaca07a..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/IndexMetaStatus.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface IndexMetaStatus - */ -export interface IndexMetaStatus { - /** - * - * @type {boolean} - * @memberof IndexMetaStatus - */ - ready?: boolean; - /** - * - * @type {string} - * @memberof IndexMetaStatus - */ - state?: IndexMetaStatusStateEnum; -} - - -/** - * @export - */ -export const IndexMetaStatusStateEnum = { - Initializing: 'Initializing', - ScalingUp: 'ScalingUp', - ScalingDown: 'ScalingDown', - Terminating: 'Terminating', - Ready: 'Ready' -} as const; -export type IndexMetaStatusStateEnum = typeof IndexMetaStatusStateEnum[keyof typeof IndexMetaStatusStateEnum]; - - -/** - * Check if a given object implements the IndexMetaStatus interface. - */ -export function instanceOfIndexMetaStatus(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function IndexMetaStatusFromJSON(json: any): IndexMetaStatus { - return IndexMetaStatusFromJSONTyped(json, false); -} - -export function IndexMetaStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexMetaStatus { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'ready': !exists(json, 'ready') ? undefined : json['ready'], - 'state': !exists(json, 'state') ? undefined : json['state'], - }; -} - -export function IndexMetaStatusToJSON(value?: IndexMetaStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ready': value.ready, - 'state': value.state, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/NamespaceSummary.ts b/src/v0/pinecone-generated-ts-fetch/models/NamespaceSummary.ts deleted file mode 100644 index fd585941..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/NamespaceSummary.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * A summary of the contents of a namespace. - * @export - * @interface NamespaceSummary - */ -export interface NamespaceSummary { - /** - * The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the - * underlying index and corresponding query results, etc. - * @type {number} - * @memberof NamespaceSummary - */ - vectorCount?: number; -} - -/** - * Check if a given object implements the NamespaceSummary interface. - */ -export function instanceOfNamespaceSummary(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function NamespaceSummaryFromJSON(json: any): NamespaceSummary { - return NamespaceSummaryFromJSONTyped(json, false); -} - -export function NamespaceSummaryFromJSONTyped(json: any, ignoreDiscriminator: boolean): NamespaceSummary { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectorCount': !exists(json, 'vectorCount') ? undefined : json['vectorCount'], - }; -} - -export function NamespaceSummaryToJSON(value?: NamespaceSummary | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectorCount': value.vectorCount, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/PatchRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/PatchRequest.ts deleted file mode 100644 index 35684c6f..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/PatchRequest.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface PatchRequest - */ -export interface PatchRequest { - /** - * The desired number of replicas for the index. - * @type {number} - * @memberof PatchRequest - */ - replicas?: number; - /** - * The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. - * @type {string} - * @memberof PatchRequest - */ - podType?: string; -} - -/** - * Check if a given object implements the PatchRequest interface. - */ -export function instanceOfPatchRequest(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function PatchRequestFromJSON(json: any): PatchRequest { - return PatchRequestFromJSONTyped(json, false); -} - -export function PatchRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], - 'podType': !exists(json, 'pod_type') ? undefined : json['pod_type'], - }; -} - -export function PatchRequestToJSON(value?: PatchRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'replicas': value.replicas, - 'pod_type': value.podType, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/ProtobufAny.ts b/src/v0/pinecone-generated-ts-fetch/models/ProtobufAny.ts deleted file mode 100644 index 04676590..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/ProtobufAny.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * - * @export - * @interface ProtobufAny - */ -export interface ProtobufAny { - /** - * - * @type {string} - * @memberof ProtobufAny - */ - typeUrl?: string; - /** - * - * @type {string} - * @memberof ProtobufAny - */ - value?: string; -} - -/** - * Check if a given object implements the ProtobufAny interface. - */ -export function instanceOfProtobufAny(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function ProtobufAnyFromJSON(json: any): ProtobufAny { - return ProtobufAnyFromJSONTyped(json, false); -} - -export function ProtobufAnyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProtobufAny { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'typeUrl': !exists(json, 'typeUrl') ? undefined : json['typeUrl'], - 'value': !exists(json, 'value') ? undefined : json['value'], - }; -} - -export function ProtobufAnyToJSON(value?: ProtobufAny | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'typeUrl': value.typeUrl, - 'value': value.value, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts b/src/v0/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts deleted file mode 100644 index 72d0ca1c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - - -/** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - * - * - NULL_VALUE: Null value. - * @export - */ -export const ProtobufNullValue = { - NullValue: 'NULL_VALUE' -} as const; -export type ProtobufNullValue = typeof ProtobufNullValue[keyof typeof ProtobufNullValue]; - - -export function ProtobufNullValueFromJSON(json: any): ProtobufNullValue { - return ProtobufNullValueFromJSONTyped(json, false); -} - -export function ProtobufNullValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProtobufNullValue { - return json as ProtobufNullValue; -} - -export function ProtobufNullValueToJSON(value?: ProtobufNullValue | null): any { - return value as any; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/QueryRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/QueryRequest.ts deleted file mode 100644 index 51541a5e..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/QueryRequest.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { QueryVector } from './QueryVector'; -import { - QueryVectorFromJSON, - QueryVectorFromJSONTyped, - QueryVectorToJSON, -} from './QueryVector'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * The request for the `Query` operation. - * @export - * @interface QueryRequest - */ -export interface QueryRequest { - /** - * The namespace to query. - * @type {string} - * @memberof QueryRequest - */ - namespace?: string; - /** - * The number of results to return for each query. - * @type {number} - * @memberof QueryRequest - */ - topK: number; - /** - * The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof QueryRequest - */ - filter?: object; - /** - * Indicates whether vector values are included in the response. - * @type {boolean} - * @memberof QueryRequest - */ - includeValues?: boolean; - /** - * Indicates whether metadata is included in the response as well as the ids. - * @type {boolean} - * @memberof QueryRequest - */ - includeMetadata?: boolean; - /** - * DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. - * @type {Array} - * @memberof QueryRequest - * @deprecated - */ - queries?: Array; - /** - * The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`. - * @type {Array} - * @memberof QueryRequest - */ - vector?: Array; - /** - * - * @type {SparseValues} - * @memberof QueryRequest - */ - sparseVector?: SparseValues; - /** - * The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. - * @type {string} - * @memberof QueryRequest - */ - id?: string; -} - -/** - * Check if a given object implements the QueryRequest interface. - */ -export function instanceOfQueryRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "topK" in value; - - return isInstance; -} - -export function QueryRequestFromJSON(json: any): QueryRequest { - return QueryRequestFromJSONTyped(json, false); -} - -export function QueryRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'topK': json['topK'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - 'includeValues': !exists(json, 'includeValues') ? undefined : json['includeValues'], - 'includeMetadata': !exists(json, 'includeMetadata') ? undefined : json['includeMetadata'], - 'queries': !exists(json, 'queries') ? undefined : ((json['queries'] as Array).map(QueryVectorFromJSON)), - 'vector': !exists(json, 'vector') ? undefined : json['vector'], - 'sparseVector': !exists(json, 'sparseVector') ? undefined : SparseValuesFromJSON(json['sparseVector']), - 'id': !exists(json, 'id') ? undefined : json['id'], - }; -} - -export function QueryRequestToJSON(value?: QueryRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'namespace': value.namespace, - 'topK': value.topK, - 'filter': value.filter, - 'includeValues': value.includeValues, - 'includeMetadata': value.includeMetadata, - 'queries': value.queries === undefined ? undefined : ((value.queries as Array).map(QueryVectorToJSON)), - 'vector': value.vector, - 'sparseVector': SparseValuesToJSON(value.sparseVector), - 'id': value.id, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/QueryResponse.ts b/src/v0/pinecone-generated-ts-fetch/models/QueryResponse.ts deleted file mode 100644 index 84fd8a22..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/QueryResponse.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { ScoredVector } from './ScoredVector'; -import { - ScoredVectorFromJSON, - ScoredVectorFromJSONTyped, - ScoredVectorToJSON, -} from './ScoredVector'; -import type { SingleQueryResults } from './SingleQueryResults'; -import { - SingleQueryResultsFromJSON, - SingleQueryResultsFromJSONTyped, - SingleQueryResultsToJSON, -} from './SingleQueryResults'; - -/** - * The response for the `Query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar. - * @export - * @interface QueryResponse - */ -export interface QueryResponse { - /** - * DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`. - * @type {Array} - * @memberof QueryResponse - * @deprecated - */ - results?: Array; - /** - * The matches for the vectors. - * @type {Array} - * @memberof QueryResponse - */ - matches?: Array; - /** - * The namespace for the vectors. - * @type {string} - * @memberof QueryResponse - */ - namespace?: string; -} - -/** - * Check if a given object implements the QueryResponse interface. - */ -export function instanceOfQueryResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function QueryResponseFromJSON(json: any): QueryResponse { - return QueryResponseFromJSONTyped(json, false); -} - -export function QueryResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'results': !exists(json, 'results') ? undefined : ((json['results'] as Array).map(SingleQueryResultsFromJSON)), - 'matches': !exists(json, 'matches') ? undefined : ((json['matches'] as Array).map(ScoredVectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function QueryResponseToJSON(value?: QueryResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'results': value.results === undefined ? undefined : ((value.results as Array).map(SingleQueryResultsToJSON)), - 'matches': value.matches === undefined ? undefined : ((value.matches as Array).map(ScoredVectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/QueryVector.ts b/src/v0/pinecone-generated-ts-fetch/models/QueryVector.ts deleted file mode 100644 index 07e1e126..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/QueryVector.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * A single query vector within a `QueryRequest`. - * @export - * @interface QueryVector - */ -export interface QueryVector { - /** - * The query vector values. This should be the same length as the dimension of the index being queried. - * @type {Array} - * @memberof QueryVector - */ - values: Array; - /** - * - * @type {SparseValues} - * @memberof QueryVector - */ - sparseValues?: SparseValues; - /** - * An override for the number of results to return for this query vector. - * @type {number} - * @memberof QueryVector - */ - topK?: number; - /** - * An override the namespace to search. - * @type {string} - * @memberof QueryVector - */ - namespace?: string; - /** - * An override for the metadata filter to apply. This replaces the request-level filter. - * @type {object} - * @memberof QueryVector - */ - filter?: object; -} - -/** - * Check if a given object implements the QueryVector interface. - */ -export function instanceOfQueryVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function QueryVectorFromJSON(json: any): QueryVector { - return QueryVectorFromJSONTyped(json, false); -} - -export function QueryVectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryVector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'values': json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'topK': !exists(json, 'topK') ? undefined : json['topK'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function QueryVectorToJSON(value?: QueryVector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'topK': value.topK, - 'namespace': value.namespace, - 'filter': value.filter, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/RpcStatus.ts b/src/v0/pinecone-generated-ts-fetch/models/RpcStatus.ts deleted file mode 100644 index 80a9462c..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/RpcStatus.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { ProtobufAny } from './ProtobufAny'; -import { - ProtobufAnyFromJSON, - ProtobufAnyFromJSONTyped, - ProtobufAnyToJSON, -} from './ProtobufAny'; - -/** - * - * @export - * @interface RpcStatus - */ -export interface RpcStatus { - /** - * - * @type {number} - * @memberof RpcStatus - */ - code?: number; - /** - * - * @type {string} - * @memberof RpcStatus - */ - message?: string; - /** - * - * @type {Array} - * @memberof RpcStatus - */ - details?: Array; -} - -/** - * Check if a given object implements the RpcStatus interface. - */ -export function instanceOfRpcStatus(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function RpcStatusFromJSON(json: any): RpcStatus { - return RpcStatusFromJSONTyped(json, false); -} - -export function RpcStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): RpcStatus { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'code': !exists(json, 'code') ? undefined : json['code'], - 'message': !exists(json, 'message') ? undefined : json['message'], - 'details': !exists(json, 'details') ? undefined : ((json['details'] as Array).map(ProtobufAnyFromJSON)), - }; -} - -export function RpcStatusToJSON(value?: RpcStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'code': value.code, - 'message': value.message, - 'details': value.details === undefined ? undefined : ((value.details as Array).map(ProtobufAnyToJSON)), - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/ScoredVector.ts b/src/v0/pinecone-generated-ts-fetch/models/ScoredVector.ts deleted file mode 100644 index 00f9ff0d..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/ScoredVector.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * - * @deprecated - * Deprecated in v1.0.0. - * - * Use {@link ScoredPineconeRecord} instead. - */ -export interface ScoredVector { - /** - * This is the vector's unique id. - * @type {string} - * @memberof ScoredVector - */ - id: string; - /** - * This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. - * @type {number} - * @memberof ScoredVector - */ - score?: number; - /** - * This is the vector data, if it is requested. - * @type {Array} - * @memberof ScoredVector - */ - values?: Array; - /** - * - * @type {SparseValues} - * @memberof ScoredVector - */ - sparseValues?: SparseValues; - /** - * This is the metadata, if it is requested. - * @type {object} - * @memberof ScoredVector - */ - metadata?: object; -} - -/** - * Check if a given object implements the ScoredVector interface. - */ -export function instanceOfScoredVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - - return isInstance; -} - -export function ScoredVectorFromJSON(json: any): ScoredVector { - return ScoredVectorFromJSONTyped(json, false); -} - -export function ScoredVectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ScoredVector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'score': !exists(json, 'score') ? undefined : json['score'], - 'values': !exists(json, 'values') ? undefined : json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function ScoredVectorToJSON(value?: ScoredVector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'score': value.score, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'metadata': value.metadata, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/SingleQueryResults.ts b/src/v0/pinecone-generated-ts-fetch/models/SingleQueryResults.ts deleted file mode 100644 index 091884a8..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/SingleQueryResults.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { ScoredVector } from './ScoredVector'; -import { - ScoredVectorFromJSON, - ScoredVectorFromJSONTyped, - ScoredVectorToJSON, -} from './ScoredVector'; - -/** - * - * @export - * @interface SingleQueryResults - */ -export interface SingleQueryResults { - /** - * The matches for the vectors. - * @type {Array} - * @memberof SingleQueryResults - */ - matches?: Array; - /** - * The namespace for the vectors. - * @type {string} - * @memberof SingleQueryResults - */ - namespace?: string; -} - -/** - * Check if a given object implements the SingleQueryResults interface. - */ -export function instanceOfSingleQueryResults(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function SingleQueryResultsFromJSON(json: any): SingleQueryResults { - return SingleQueryResultsFromJSONTyped(json, false); -} - -export function SingleQueryResultsFromJSONTyped(json: any, ignoreDiscriminator: boolean): SingleQueryResults { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'matches': !exists(json, 'matches') ? undefined : ((json['matches'] as Array).map(ScoredVectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function SingleQueryResultsToJSON(value?: SingleQueryResults | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'matches': value.matches === undefined ? undefined : ((value.matches as Array).map(ScoredVectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/SparseValues.ts b/src/v0/pinecone-generated-ts-fetch/models/SparseValues.ts deleted file mode 100644 index fbc32eac..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/SparseValues.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. - * @export - * @interface SparseValues - */ -export interface SparseValues { - /** - * The indices of the sparse data. - * @type {Array} - * @memberof SparseValues - */ - indices: Array; - /** - * The corresponding values of the sparse data, which must be with the same length as the indices. - * @type {Array} - * @memberof SparseValues - */ - values: Array; -} - -/** - * Check if a given object implements the SparseValues interface. - */ -export function instanceOfSparseValues(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "indices" in value; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function SparseValuesFromJSON(json: any): SparseValues { - return SparseValuesFromJSONTyped(json, false); -} - -export function SparseValuesFromJSONTyped(json: any, ignoreDiscriminator: boolean): SparseValues { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'indices': json['indices'], - 'values': json['values'], - }; -} - -export function SparseValuesToJSON(value?: SparseValues | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'indices': value.indices, - 'values': value.values, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/UpdateRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/UpdateRequest.ts deleted file mode 100644 index b9656214..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/UpdateRequest.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * The request for the `Upsert` operation. - * @export - * @interface UpdateRequest - */ -export interface UpdateRequest { - /** - * Vector's unique id. - * @type {string} - * @memberof UpdateRequest - */ - id: string; - /** - * Vector data. - * @type {Array} - * @memberof UpdateRequest - */ - values?: Array; - /** - * - * @type {SparseValues} - * @memberof UpdateRequest - */ - sparseValues?: SparseValues; - /** - * Metadata to *set* for the vector. - * @type {object} - * @memberof UpdateRequest - */ - setMetadata?: object; - /** - * Namespace name where to update the vector. - * @type {string} - * @memberof UpdateRequest - */ - namespace?: string; -} - -/** - * Check if a given object implements the UpdateRequest interface. - */ -export function instanceOfUpdateRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - - return isInstance; -} - -export function UpdateRequestFromJSON(json: any): UpdateRequest { - return UpdateRequestFromJSONTyped(json, false); -} - -export function UpdateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'values': !exists(json, 'values') ? undefined : json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'setMetadata': !exists(json, 'setMetadata') ? undefined : json['setMetadata'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function UpdateRequestToJSON(value?: UpdateRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'setMetadata': value.setMetadata, - 'namespace': value.namespace, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/UpsertRequest.ts b/src/v0/pinecone-generated-ts-fetch/models/UpsertRequest.ts deleted file mode 100644 index 2031e15f..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/UpsertRequest.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { Vector } from './Vector'; -import { - VectorFromJSON, - VectorFromJSONTyped, - VectorToJSON, -} from './Vector'; - -/** - * The request for the `Upsert` operation. - * @export - * @interface UpsertRequest - */ -export interface UpsertRequest { - /** - * An array containing the vectors to upsert. Recommended batch limit is 100 vectors. - * @type {Array} - * @memberof UpsertRequest - */ - vectors: Array; - /** - * This is the namespace name where you upsert vectors. - * @type {string} - * @memberof UpsertRequest - */ - namespace?: string; -} - -/** - * Check if a given object implements the UpsertRequest interface. - */ -export function instanceOfUpsertRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "vectors" in value; - - return isInstance; -} - -export function UpsertRequestFromJSON(json: any): UpsertRequest { - return UpsertRequestFromJSONTyped(json, false); -} - -export function UpsertRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpsertRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectors': ((json['vectors'] as Array).map(VectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function UpsertRequestToJSON(value?: UpsertRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectors': ((value.vectors as Array).map(VectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/UpsertResponse.ts b/src/v0/pinecone-generated-ts-fetch/models/UpsertResponse.ts deleted file mode 100644 index 5e86f487..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/UpsertResponse.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -/** - * The response for the `Upsert` operation. - * @export - * @interface UpsertResponse - */ -export interface UpsertResponse { - /** - * The number of vectors upserted. - * @type {number} - * @memberof UpsertResponse - */ - upsertedCount?: number; -} - -/** - * Check if a given object implements the UpsertResponse interface. - */ -export function instanceOfUpsertResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function UpsertResponseFromJSON(json: any): UpsertResponse { - return UpsertResponseFromJSONTyped(json, false); -} - -export function UpsertResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpsertResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'upsertedCount': !exists(json, 'upsertedCount') ? undefined : json['upsertedCount'], - }; -} - -export function UpsertResponseToJSON(value?: UpsertResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'upsertedCount': value.upsertedCount, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/Vector.ts b/src/v0/pinecone-generated-ts-fetch/models/Vector.ts deleted file mode 100644 index 32806cd1..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/Vector.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - -import { exists, mapValues } from '../runtime'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * - * @deprecated - * Deprecated in v1.0.0. - * - * Use {@link PineconeRecord} instead. - */ -export interface Vector { - /** - * This is the vector's unique id. - * @type {string} - * @memberof Vector - */ - id: string; - /** - * This is the vector data included in the request. - * @type {Array} - * @memberof Vector - */ - values: Array; - /** - * - * @type {SparseValues} - * @memberof Vector - */ - sparseValues?: SparseValues; - /** - * This is the metadata included in the request. - * @type {object} - * @memberof Vector - */ - metadata?: object; -} - -/** - * Check if a given object implements the Vector interface. - */ -export function instanceOfVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function VectorFromJSON(json: any): Vector { - return VectorFromJSONTyped(json, false); -} - -export function VectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): Vector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'values': json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function VectorToJSON(value?: Vector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'metadata': value.metadata, - }; -} - diff --git a/src/v0/pinecone-generated-ts-fetch/models/index.ts b/src/v0/pinecone-generated-ts-fetch/models/index.ts deleted file mode 100644 index 8752fda7..00000000 --- a/src/v0/pinecone-generated-ts-fetch/models/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './ApproximatedConfig'; -export * from './CollectionMeta'; -export * from './CreateCollectionRequest'; -export * from './CreateRequest'; -export * from './CreateRequestIndexConfig'; -export * from './DeleteRequest'; -export * from './DescribeIndexStatsRequest'; -export * from './DescribeIndexStatsResponse'; -export * from './FetchResponse'; -export * from './HnswConfig'; -export * from './IndexMeta'; -export * from './IndexMetaDatabase'; -export * from './IndexMetaDatabaseIndexConfig'; -export * from './IndexMetaStatus'; -export * from './NamespaceSummary'; -export * from './PatchRequest'; -export * from './ProtobufAny'; -export * from './ProtobufNullValue'; -export * from './QueryRequest'; -export * from './QueryResponse'; -export * from './QueryVector'; -export * from './RpcStatus'; -export * from './ScoredVector'; -export * from './SingleQueryResults'; -export * from './SparseValues'; -export * from './UpdateRequest'; -export * from './UpsertRequest'; -export * from './UpsertResponse'; -export * from './Vector'; diff --git a/src/v0/pinecone-generated-ts-fetch/runtime.ts b/src/v0/pinecone-generated-ts-fetch/runtime.ts deleted file mode 100644 index aa551427..00000000 --- a/src/v0/pinecone-generated-ts-fetch/runtime.ts +++ /dev/null @@ -1,407 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pinecone API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: version not set - * 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. - */ - - -export const BASE_PATH = "https://unknown-unknown.svc.unknown.pinecone.io".replace(/\/+$/, ""); - -export interface ConfigurationParameters { - basePath?: string; // override base path - fetchApi?: FetchAPI; // override for fetch implementation - middleware?: Middleware[]; // middleware to apply before/after fetch requests - queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings - username?: string; // parameter for basic security - password?: string; // parameter for basic security - apiKey?: string | ((name: string) => string); // parameter for apiKey security - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security - headers?: HTTPHeaders; //header params we want to use on every request - credentials?: RequestCredentials; //value for the credentials param we want to use on each request -} - -export class Configuration { - constructor(private configuration: ConfigurationParameters = {}) {} - - set config(configuration: Configuration) { - this.configuration = configuration; - } - - get basePath(): string { - return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; - } - - get fetchApi(): FetchAPI | undefined { - return this.configuration.fetchApi; - } - - get middleware(): Middleware[] { - return this.configuration.middleware || []; - } - - get queryParamsStringify(): (params: HTTPQuery) => string { - return this.configuration.queryParamsStringify || querystring; - } - - get username(): string | undefined { - return this.configuration.username; - } - - get password(): string | undefined { - return this.configuration.password; - } - - get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; - if (apiKey) { - return typeof apiKey === 'function' ? apiKey : () => apiKey; - } - return undefined; - } - - get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { - const accessToken = this.configuration.accessToken; - if (accessToken) { - return typeof accessToken === 'function' ? accessToken : async () => accessToken; - } - return undefined; - } - - get headers(): HTTPHeaders | undefined { - return this.configuration.headers; - } - - get credentials(): RequestCredentials | undefined { - return this.configuration.credentials; - } -} - -export const DefaultConfig = new Configuration(); - -/** - * This is the base class for all generated API classes. - */ -export class BaseAPI { - - private middleware: Middleware[]; - - constructor(protected configuration = DefaultConfig) { - this.middleware = configuration.middleware; - } - - withMiddleware(this: T, ...middlewares: Middleware[]) { - const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); - return next; - } - - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } - - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } - - protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { - const { url, init } = await this.createFetchParams(context, initOverrides); - const response = await this.fetchApi(url, init); - if (response && (response.status >= 200 && response.status < 300)) { - return response; - } - throw new ResponseError(response, 'Response returned an error code'); - } - - private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { - let url = this.configuration.basePath + context.path; - if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. - // this is done to avoid urls ending with a "?" character which buggy webservers - // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); - } - - const headers = Object.assign({}, this.configuration.headers, context.headers); - Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); - - const initOverrideFn = - typeof initOverrides === "function" - ? initOverrides - : async () => initOverrides; - - const initParams = { - method: context.method, - headers, - body: context.body, - credentials: this.configuration.credentials, - }; - - const overriddenInit: RequestInit = { - ...initParams, - ...(await initOverrideFn({ - init: initParams, - context, - })) - }; - - const init: RequestInit = { - ...overriddenInit, - body: - isFormData(overriddenInit.body) || - overriddenInit.body instanceof URLSearchParams || - isBlob(overriddenInit.body) - ? overriddenInit.body - : JSON.stringify(overriddenInit.body), - }; - - return { url, init }; - } - - private fetchApi = async (url: string, init: RequestInit) => { - let fetchParams = { url, init }; - for (const middleware of this.middleware) { - if (middleware.pre) { - fetchParams = await middleware.pre({ - fetch: this.fetchApi, - ...fetchParams, - }) || fetchParams; - } - } - let response: Response | undefined = undefined; - try { - response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); - } catch (e) { - for (const middleware of this.middleware) { - if (middleware.onError) { - response = await middleware.onError({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - error: e, - response: response ? response.clone() : undefined, - }) || response; - } - } - if (response === undefined) { - if (e instanceof Error) { - throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); - } else { - throw e; - } - } - } - for (const middleware of this.middleware) { - if (middleware.post) { - response = await middleware.post({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - response: response.clone(), - }) || response; - } - } - return response; - } - - /** - * Create a shallow clone of `this` by constructing a new instance - * and then shallow cloning data members. - */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } -}; - -function isBlob(value: any): value is Blob { - return typeof Blob !== 'undefined' && value instanceof Blob; -} - -function isFormData(value: any): value is FormData { - return typeof FormData !== "undefined" && value instanceof FormData; -} - -export class ResponseError extends Error { - override name: "ResponseError" = "ResponseError"; - constructor(public response: Response, msg?: string) { - super(msg); - } -} - -export class FetchError extends Error { - override name: "FetchError" = "FetchError"; - constructor(public cause: Error, msg?: string) { - super(msg); - } -} - -export class RequiredError extends Error { - override name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} - -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; - -export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; -export type HTTPHeaders = { [key: string]: string }; -export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; -export type HTTPBody = Json | FormData | URLSearchParams; -export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; -export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; - -export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise - -export interface FetchParams { - url: string; - init: RequestInit; -} - -export interface RequestOpts { - path: string; - method: HTTPMethod; - headers: HTTPHeaders; - query?: HTTPQuery; - body?: HTTPBody; -} - -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export function querystring(params: HTTPQuery, prefix: string = ''): string { - return Object.keys(params) - .map(key => querystringSingleKey(key, params[key], prefix)) - .filter(part => part.length > 0) - .join('&'); -} - -function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { - const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); - if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) - .join(`&${encodeURIComponent(fullKey)}=`); - return `${encodeURIComponent(fullKey)}=${multiValue}`; - } - if (value instanceof Set) { - const valueAsArray = Array.from(value); - return querystringSingleKey(key, valueAsArray, keyPrefix); - } - if (value instanceof Date) { - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; - } - if (value instanceof Object) { - return querystring(value as HTTPQuery, fullKey); - } - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} - -export function canConsumeForm(consumes: Consume[]): boolean { - for (const consume of consumes) { - if ('multipart/form-data' === consume.contentType) { - return true; - } - } - return false; -} - -export interface Consume { - contentType: string; -} - -export interface RequestContext { - fetch: FetchAPI; - url: string; - init: RequestInit; -} - -export interface ResponseContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - response: Response; -} - -export interface ErrorContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - error: unknown; - response?: Response; -} - -export interface Middleware { - pre?(context: RequestContext): Promise; - post?(context: ResponseContext): Promise; - onError?(context: ErrorContext): Promise; -} - -export interface ApiResponse { - raw: Response; - value(): Promise; -} - -export interface ResponseTransformer { - (json: any): T; -} - -export class JSONApiResponse { - constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - - async value(): Promise { - return this.transformer(await this.raw.json()); - } -} - -export class VoidApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return undefined; - } -} - -export class BlobApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.blob(); - }; -} - -export class TextApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.text(); - }; -} diff --git a/src/v0/utils.ts b/src/v0/utils.ts deleted file mode 100644 index 3ec99d33..00000000 --- a/src/v0/utils.ts +++ /dev/null @@ -1,113 +0,0 @@ -import type { PineconeClient } from '..'; -import { - IndexMeta, - Vector, - VectorOperationsApi, -} from './pinecone-generated-ts-fetch'; - -/** - * @deprecated in v1.0.0 - * - * Use {@link Pinecone} with the createIndex waitUntilReady option. - */ -const waitUntilIndexIsReady = async ( - client: PineconeClient, - indexName: string, - retries: number = 0 -) => { - try { - let indexDescription: IndexMeta = await client.describeIndex({ indexName }); - if (!indexDescription.status?.ready) { - await new Promise((r) => setTimeout(r, 1000)); - await waitUntilIndexIsReady(client, indexName, retries + 1); - } else { - console.log(`Index ready after ${retries} seconds`); - return; - } - } catch (e) { - console.error('Error waiting until index is ready', e); - } -}; - -/** - * @deprecated in v1.0.0 - */ -const createIndexIfNotExists = async ( - client: PineconeClient, - indexName: string, - dimension: number -) => { - try { - const indexList = await client.listIndexes(); - if (!indexList.includes(indexName)) { - console.log('Creating index', indexName); - await client.createIndex({ - createRequest: { - name: indexName, - dimension, - }, - }); - console.log('Waiting until index is ready...'); - await waitUntilIndexIsReady(client, indexName); - console.log('Index is ready.'); - } - } catch (e) { - console.error('Error creating index', e); - } -}; - -const sliceIntoChunks = (arr: T[], chunkSize: number) => { - return Array.from({ length: Math.ceil(arr.length / chunkSize) }, (_, i) => - arr.slice(i * chunkSize, (i + 1) * chunkSize) - ); -}; - -/** - * @deprecated in v1.0.0 - */ -const chunkedUpsert = async ( - index: VectorOperationsApi, - vectors: Vector[], - namespace: string, - chunkSize = 10 -) => { - // Split the vectors into chunks - const chunks = sliceIntoChunks(vectors, chunkSize); - - try { - // Upsert each chunk of vectors into the index - await Promise.allSettled( - chunks.map(async (chunk) => { - try { - await index.upsert({ - upsertRequest: { - vectors: chunk as Vector[], - namespace, - }, - }); - } catch (e) { - console.log('Error upserting chunk', e); - } - }) - ); - - return true; - } catch (e) { - throw new Error(`Error upserting vectors into index: ${e}`); - } -}; - -/** - * @deprecated - * - * Deprecated in v1.0.0 - * - * See [discussion on replacing utils for v1](https://github.com/pinecone-io/pinecone-ts-client/issues/117) - */ -const utils = { - waitUntilIndexIsReady, - createIndexIfNotExists, - chunkedUpsert, -}; - -export { utils }; diff --git a/typedoc.json b/typedoc.json index 4d4aa784..c111ecb6 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,7 +1,7 @@ { "name": "Pinecone TypeScript SDK", "entryPoints": ["src/index.ts"], - "exclude": ["src/v0/**/*"], + "exclude": [], "hideGenerator": true, "includeVersion": true, "excludeInternal": true, diff --git a/utils/replInit.ts b/utils/replInit.ts index a47b0424..350b1e40 100644 --- a/utils/replInit.ts +++ b/utils/replInit.ts @@ -5,7 +5,7 @@ var dotenv = require('dotenv'); dotenv.config(); -const expectedVars = ['PINECONE_ENVIRONMENT', 'PINECONE_API_KEY']; +const expectedVars = ['PINECONE_API_KEY']; for (const envVar of expectedVars) { if (!process.env[envVar]) { console.warn(`WARNING Missing environment variable ${envVar} in .env file`); @@ -22,18 +22,12 @@ for (const [key, value] of Object.entries(pinecone)) { myrepl.context[key] = value; } -// Even though this export is called PineconeClient, add an alias to -// LegacyPineconeClient so I don't get confused in manual testing. Allows me -// to initialize with "new LegacyPineconeClient()" instead of "new PineconeClient()" -// when working in the REPL. -myrepl.context['LegacyPineconeClient'] = pinecone.PineconeClient; - console.log( - 'SUCCESS Pinecone module exports (Pinecone, PineconeClient, etc) automatically imported to this repl session.' + 'SUCCESS Pinecone module exports (Pinecone, etc) automatically imported to this repl session.' ); console.log(''); console.log( - 'Run "await init()" to setup client instances using environment variable configs.' + 'Run "await init()" to setup client instance using environment variable configs.' ); const init = async () => { @@ -41,16 +35,6 @@ const init = async () => { myrepl.context['client'] = client; console.log('SUCCESS Created new client "client":'); console.log(client); - console.log(''); - - const legacyClient = new pinecone.PineconeClient(); - await legacyClient.init({ - apiKey: process.env.PINECONE_API_KEY, - environment: process.env.PINECONE_ENVIRONMENT, - }); - myrepl.context['legacy'] = legacyClient; - console.log('SUCCESS Created legacy client "legacy":'); - console.log(legacyClient); }; myrepl.context['init'] = init; diff --git a/v1-migration.md b/v1-migration.md deleted file mode 100644 index 5f769c5b..00000000 --- a/v1-migration.md +++ /dev/null @@ -1,661 +0,0 @@ -# v1 Migration Guide - -This doc will outline the differences between `v0.x` beta versions of the Pinecone client and the `v1` version. The `v1.0.0` release adds a new `Pinecone` module export alongside the legacy `PineconeClient` export. `PineconeClient` is deprecated and will be removed in a future release. - -## Types and Terminology - -In general, you can expect to see terminology migrate the term `vector` to `record` in many places to align with our [documentation](https://docs.pinecone.io/docs/overview#pinecone-indexes-store-records-with-vector-data) which calls the item stored and retrieved from indexes a "record". Some examples of how this impacts naming in the client: - -- Legacy type `Vector` is being replaced with `PineconeRecord` -- Legacy type `ScoredVector` is being replaced with `ScoredPineconeRecord` -- The `fetch()` method now returns `records` instead of `vectors` in the response object. -- The `describeIndexStats()` method now returns `totalRecordCount` instead of `totalVectorCount` in the response object. - -The old types are still exported from the client, but you're encouraged to adopt the new ones because of their support for generic type params specifying the expected shape of your metadata. For example: - -```typescript -// user-defined metadata type -type MovieMetadata = { - title: string; - genre: 'comedy' | 'drama' | 'horror' | 'action'; -}; - -const records: PineconeRecord[] = [ - { - id: '1234', - values: [0.234, 0.143, 0.999], // embedding values, a.k.a. "vector values", simplified - metadata: { - title: 'Ghostbusters', - genre: 'comedy', - }, - }, - { - id: '1235', - values: [0.675, 0.332, 0.512], - metadata: { - title: 'Vertigo', - genre: 'suspense', // <---- Typescript will flag this type error telling us we made a mistake, yay! - }, - }, -]; -``` - -## Client Initialization - -The legacy `PineconeClient` export has a two-step async initialization. - -```typescript -// Legacy initialization -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient(); -await pineconeClient.init({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -``` - -The new `Pinecone` client constructor accepts the same configuration object and eliminates the async `init()` step. - -```typescript -// v1.0.0 initialization -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -``` - -Also, if you have set values for the environment variables `PINECONE_ENVIRONMENT`and `PINECONE_API_KEY` then the `Pinecone` constructor does not require any additional configuration. - -```typescript -// v1.0.0 initialization -import { Pinecone } from '@pinecone-database/pinecone'; - -// When no config param, constructor reads from PINECONE_ENVIRONMENT and -// PINECONE_API_KEY environment variables -const pinecone = new Pinecone(); -``` - -## Control plane - -### Creating indexes - -The new `Pinecone` client's `createIndex` flattens out the method params to remove the top-level `createRequest` key. It supports all the same optional configuration parameters. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient(); -await pineconeClient.init({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -await pineconeClient.createClient({ - createRequest: { - name: 'sample-index', - dimension: 1536, - }, -}); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.createIndex({ - name: 'sample-index', - dimension: 1536, -}); -``` - -### Deleting indexes - -The new `Pinecone` client has flattened out the `deleteIndex` method param from an object to a string. Now you only need to pass the name of the index you would like to delete. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient(); -await pineconeClient.init({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); - -await client.deleteIndex({ indexName: 'index-to-delete' }); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.deleteIndex('index-to-delete'); -``` - -### Listing indexes - -The new `Pinecone` client returns an array of objects instead of an array of strings from `listIndexes()`. Returning an array of objects creates flexibility for additional data to be returned in the future without creating a breaking change. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const list = await pineconeClient.listIndexes(); -// ['index-name', 'index-name2'] -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -const list = await pinecone.listIndexes(); -// [{ name: 'index-name' }, { name: 'index-name2' }] -``` - -### Describe index - -The `describeIndex` method of the new `Pinecone` client has flattened the required parameters. Now you only need to pass the name of the index you would like to describe. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const indexDescription = await pineconeClient.describeIndex({ - indexName: 'index-name', -}); -// { -// database: { -// name: 'index-name', -// dimension: 2, -// indexType: undefined, -// metric: 'cosine', -// pods: 2, -// replicas: 2, -// shards: 1, -// podType: 'p1.x1', -// indexConfig: undefined, -// metadataConfig: { indexed: [ 'description' ] } -// }, -// status: { ready: true, state: 'Ready' } -// } -``` - -The new client flattens the method params, removes deprecated response field `database.indexConfig` and adds new status fields for `status.host` and `status.port`. - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.describeIndex('test-index'); -// { -// database: { -// name: 'test-index', -// dimension: 10, -// metric: 'cosine', -// pods: 1, -// replicas: 1, -// shards: 1, -// podType: 'p1.x1', -// metadataConfig: { indexed: [Array] } -// }, -// status: { -// ready: true, -// state: 'Ready', -// host: 'test-index-c01b9b5.svc.us-east1-gcp.pinecone.io', -// port: 433 -// } -// } -``` - -### Configure index - -Both clients support the same configuration variables (`replicas` and `podType`), but the new `Pinecone` client has changed the signature of `configureIndex` to separate the name of the target index from the configuration that is going to change. Also, the legacy client returned empty string `''` on completion whereas the new client resolves to undefined. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -await pineconeClient.configureIndex({ indexName: 'my-index', replicas: 2 }); -// '' -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.configureIndex('my-index', { replicas: 2 }); -``` - -### Create collection - -New `Pinecone` client simplifies these method params. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -await pineconeClient.createCollection({ - createCollectionRequest: { source: 'index-name', name: 'collection-name' }, -}); -// '' -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.createCollection({ - source: 'index-name', - name: 'collection-name', -}); -``` - -### Describe collection - -The new `Pinecone` client simplifies method paramters to `describeCollection` and adds new data fields for `dimension` and `recordCount` in the response. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -await pineconeClient.describeCollection({ collectionName: 'collection3' }); -// { name: 'collection3', size: 3126700, status: 'Ready' } -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.describeCollection('collection3') -{ - name: 'collection3', - size: 3126700, - status: 'Ready', - dimension: 1536, - recordCount: 99 -} -``` - -### List collections - -The new `Pinecone` client returns an array of objects instead of an array of strings from `listCollections`. Returning an array of objects creates flexibility for additional data to be returned in the future without creating a breaking change. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const list = await pineconeClient.listCollections(); -// ['collection-name', 'collection-name2'] -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -const list = await pinecone.listCollections(); -// [{ name: 'collection-name' }, { name: 'collection-name2' }] -``` - -## Data plane - -### Targeting an index - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); -``` - -In the new `Pinecone` client, the `index()` method accepts an optional generic type arument that describes the shape of your index's metadata. If you provide this type parameter, the TypeScript compiler will provide appropriate typechecking on your interactions with the `index` object when attempting to `upsert()` or `update()` and you shouldn't need to cast results of `query()` and `fetch()` operations. - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); - -type MovieMetadata = { - genre: 'comedy' | 'horror' | 'drama' | 'action' | 'other'; - runtime: number; -}; -const index = await pinecone.index('movie-embeddings'); -``` - -### Upserting - -The namespace parameter has moved out of the `upsert` method param options and been elevated into a chained `namespace()` call. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); -await index.upsert({ - upsertRequest: { - vectors: [ - { - id: '1', - values: [0.1, 0.2, 0.3, 0.4], - metadata: { genre: 'comedy', runtime: 120 }, - }, - { - id: '2', - values: [0.5, 0.6, 0.7, 0.8], - metadata: { genre: 'horror', runtime: 120 }, - }, - ], - namespace: 'imdb', - }, -}); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); - -type MovieMetadata = { - genre: 'comedy' | 'horror' | 'drama' | 'action' | 'other'; - runtime: number; -}; - -const index = await pinecone.index('movie-embeddings'); -const namespace = index.namespace('imdb'); -await namespace.upsert([ - { - id: '1', - values: [0.1, 0.2, 0.3, 0.4], - metadata: { genre: 'comedy', runtime: 120 }, - }, - { - id: '2', - values: [0.5, 0.6, 0, 0.8], - metadata: { genre: 'horror', runtime: 120 }, - }, -]); -``` - -### Fetching - -In the new `Pinecone` client, namespace has been elevated from the `fetch()` method param to a chained `namespace()` call. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); -const results = await index.fetch({ ids: ['1', '2', '3'], namespace: 'imdb' }); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); - -type MovieMetadata = { - genre: 'comedy' | 'horror' | 'drama' | 'action' | 'other'; - runtime: number; -}; - -const index = await pinecone.index('movie-embeddings'); -const namespace = index.namespace('imdb'); -const results = await namespace.fetch(['1', '2', '3']); -``` - -### Query - -In the new `Pinecone` client, namespace has been elevated from the `query()` method param to a chained `namespace()` call. The top-level key `queryRequest` has been removed. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); -const results = await index.query({ - queryRequest: { - topK: 1, - vector: [...], // actual values here - namespace: 'imdb', - includeMetadata: true, - includeValues: true, - sparseVector: { - indices: [15, 30, 11], - values: [0.1, 0.2, 0.3], - } - } -}); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); - -type MovieMetadata = { - genre: 'comedy' | 'horror' | 'drama' | 'action' | 'other'; - runtime: number; -}; - -const index = await pinecone.index('movie-embeddings'); -const namespace = index.namespace('imdb') -const results = await namespace.query({ - topK: 1, - vector: [...], // actual values here - includeMetadata: true, - includeValues: true, - sparseVector: { - indices: [15, 30, 11], - values: [0.1, 0.2, 0.3], - }, -}); -``` - -### Delete - -In the new `Pinecone` client, there are convenience methods for `deleteOne`, `deleteMany`, `deleteAll`. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); - -// Delete one record by id in namespace -await index.delete1({ - ids: ['1'], - namespace: 'imdb', -}); - -// Delete several record by ids in namespace -await index.delete1({ - ids: ['1', '2', '3'], - namespace: 'imdb', -}); - -// Delete all records in namespace -await index.delete1({ - deleteAll: true, - namespace: 'imdb', -}); - -// Delete all records in namespace with filter -await index.delete1({ - deleteAll: true, - namespace: 'imdb', - filter: { - { $and: [ - { genre: 'comedy' }, - { rating: { $gt: 7.0 } } - ] - } - } -}); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -const index = await pinecone.index('movie-embeddings'); -const namespace = index.namespace('imdb'); - -// Delete one record by id in namespace -await namespace.deleteOne('1'); - -// Delete several record by ids in namespace -await namespace.deleteMany(['1', '2', '3']); - -// Delete all records in namesapce with filter expression -await namespace.deleteMany({ - $and: [{ genre: 'comedy' }, { rating: { $gt: 7.0 } }], -}); - -// Delete all records in namespace -await namespace.deleteAll(); - -// Delete one record by id in default namespace -await index.deleteOne('1'); - -// Delete several record by ids in default namespace -await index.deleteMany(['1', '2', '3']); - -// Delete all records in default namespace -await index.deleteAll(); -``` - -### Describe index stats - -The return type has changed slightly in the new `Pinecone` client. The arguments to `describeIndexStats()` have been simplified and the return type has changed `totalVectorCount` to `totalRecordCount`, `vectorCount` to `recordCount`. - -```typescript -// v0.x beta releases -import { PineconeClient } from '@pinecone-database/pinecone'; - -const pineconeClient = new PineconeClient({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); -const index = pineconeClient.Index('movie-embeddings'); -const stats = await index.describeIndexStats({ describeIndexStatsRequest: {} }); -// { -// namespaces: { '': { vectorCount: 10001502 } }, -// dimension: 256, -// indexFullness: 0.9, -// totalVectorCount: 10001502 -// } -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); - -const index = await pinecone.index('movie-embeddings'); -const stats = await index.describeIndexStats(); -// { -// namespaces: { '': { recordCount: 10001502 } }, -// dimension: 256, -// indexFullness: 0.9, -// totalRecordCount: 10001502 -// } -``` - -### Utilities `waitUntilIndexIsReady` and `createIndexIfNotExists` - -In the v1 client, the needs served by these utility functions in v0.x beta clients are served by additional options to the `createIndex` method. - -```typescript -// v0.x beta releases -import { PineconeClient, utils } from '@pinecone-database/pinecone'; - -const { createIndexIfNotExists, waitUntilIndexIsReady } = utils; - -const pineconeClient = new PineconeClient(); -await pineconeClient.init({ - apiKey: 'your-api-key', - environment: 'your-environment', -}); - -await createIndexIfNotExists(pineconeClient, 'sample-index', 1536); -await waitUntilIndexIsReady(pineconeClient, 'sample-index'); -``` - -```typescript -// v1.0.0 -import { Pinecone } from '@pinecone-database/pinecone'; - -const pinecone = new Pinecone(); -await pinecone.createIndex({ - name: 'sample-index', - dimension: 1536, - - // This option tells the client not to throw if the index already exists. - // It serves as replacement for createIndexIfNotExists - suppressConflicts: true, - - // This option tells the client not to resolve the promise until the - // index is ready. It replaces waitUntilIndexIsReady. - waitUntilReady: true, -}); -```