From 0e19a3b455f72c534a73f637820e3804b3f1d4f7 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 13:00:23 -0500 Subject: [PATCH 1/6] regenerate OpenAPI core, rename vectorOperations patterns to dataPlaneOperations --- src/data/__tests__/deleteAll.test.ts | 4 +- src/data/__tests__/deleteMany.test.ts | 8 +- src/data/__tests__/deleteOne.test.ts | 14 +- src/data/__tests__/describeIndexStats.test.ts | 16 +- src/data/__tests__/fetch.test.ts | 14 +- src/data/__tests__/update.test.ts | 10 +- src/data/__tests__/upsert.test.ts | 10 +- .../vectorOperationsProvider.test.ts | 14 +- ...sProvider.ts => dataOperationsProvider.ts} | 22 +-- src/data/deleteAll.ts | 4 +- src/data/deleteMany.ts | 4 +- src/data/deleteOne.ts | 4 +- src/data/describeIndexStats.ts | 4 +- src/data/fetch.ts | 4 +- src/data/index.ts | 4 +- src/data/list.ts | 40 +++++ src/data/query.ts | 4 +- src/data/update.ts | 4 +- src/data/upsert.ts | 4 +- .../.openapi-generator/FILES | 8 +- ...VectorOperationsApi.ts => DataPlaneApi.ts} | 168 ++++++++++++------ .../apis/ManageIndexesApi.ts | 52 ++++-- src/pinecone-generated-ts-fetch/apis/index.ts | 2 +- .../models/AwsRegions.ts | 39 ---- .../models/CollectionList.ts | 6 +- .../models/CollectionModel.ts | 15 +- .../models/ConfigureIndexRequest.ts | 6 +- .../models/ConfigureIndexRequestSpec.ts | 6 +- .../models/ConfigureIndexRequestSpecPod.ts | 6 +- .../models/CreateCollectionRequest.ts | 8 +- .../models/CreateIndexRequest.ts | 15 +- .../models/CreateIndexRequestSpec.ts | 12 +- .../models/CreateIndexRequestSpecPod.ts | 26 +-- ...CreateIndexRequestSpecPodMetadataConfig.ts | 65 +++++++ .../models/DeleteRequest.ts | 6 +- .../models/DescribeIndexStatsRequest.ts | 8 +- .../models/DescribeIndexStatsResponse.ts | 8 +- .../models/ErrorResponse.ts | 10 +- .../models/ErrorResponseError.ts | 16 +- .../models/FetchResponse.ts | 8 +- .../models/GcpRegions.ts | 42 ----- .../models/IndexList.ts | 6 +- .../models/IndexModel.ts | 12 +- .../models/IndexModelSpec.ts | 6 +- .../models/IndexModelStatus.ts | 6 +- .../models/ListItem.ts | 65 +++++++ .../models/ListResponse.ts | 108 +++++++++++ .../models/NamespaceSummary.ts | 6 +- .../models/Pagination.ts | 65 +++++++ .../models/PodSpec.ts | 10 +- .../models/PodSpecMetadataConfig.ts | 10 +- .../models/ProtobufAny.ts | 6 +- .../models/ProtobufNullValue.ts | 6 +- .../models/QueryRequest.ts | 8 +- .../models/QueryResponse.ts | 8 +- .../models/QueryVector.ts | 6 +- .../models/RpcStatus.ts | 6 +- .../models/ScoredVector.ts | 6 +- .../models/ServerlessSpec.ts | 12 +- .../models/SingleQueryResults.ts | 6 +- .../models/SparseValues.ts | 12 +- .../models/UpdateRequest.ts | 8 +- .../models/UpsertRequest.ts | 8 +- .../models/UpsertResponse.ts | 8 +- .../models/Usage.ts | 6 +- .../models/Vector.ts | 6 +- .../models/index.ts | 6 +- src/pinecone-generated-ts-fetch/runtime.ts | 6 +- 68 files changed, 742 insertions(+), 396 deletions(-) rename src/data/{vectorOperationsProvider.ts => dataOperationsProvider.ts} (74%) create mode 100644 src/data/list.ts rename src/pinecone-generated-ts-fetch/apis/{VectorOperationsApi.ts => DataPlaneApi.ts} (60%) delete mode 100644 src/pinecone-generated-ts-fetch/models/AwsRegions.ts create mode 100644 src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/GcpRegions.ts create mode 100644 src/pinecone-generated-ts-fetch/models/ListItem.ts create mode 100644 src/pinecone-generated-ts-fetch/models/ListResponse.ts create mode 100644 src/pinecone-generated-ts-fetch/models/Pagination.ts diff --git a/src/data/__tests__/deleteAll.test.ts b/src/data/__tests__/deleteAll.test.ts index 431e0d0b..6476f5c2 100644 --- a/src/data/__tests__/deleteAll.test.ts +++ b/src/data/__tests__/deleteAll.test.ts @@ -3,13 +3,13 @@ import { setupDeleteSuccess } from './deleteOne.test'; describe('deleteAll', () => { test('calls the openapi delete endpoint, passing deleteAll with target namespace', async () => { - const { VoaProvider, VOA } = setupDeleteSuccess(undefined); + const { VoaProvider, DPA } = setupDeleteSuccess(undefined); const deleteAllFn = deleteAll(VoaProvider, 'namespace'); const returned = await deleteAllFn(); expect(returned).toBe(void 0); - expect(VOA._delete).toHaveBeenCalledWith({ + expect(DPA._delete).toHaveBeenCalledWith({ deleteRequest: { deleteAll: true, namespace: 'namespace' }, }); }); diff --git a/src/data/__tests__/deleteMany.test.ts b/src/data/__tests__/deleteMany.test.ts index 85b4763d..2d146c1b 100644 --- a/src/data/__tests__/deleteMany.test.ts +++ b/src/data/__tests__/deleteMany.test.ts @@ -3,25 +3,25 @@ import { setupDeleteSuccess } from './deleteOne.test'; describe('deleteMany', () => { test('calls the openapi delete endpoint, passing ids with target namespace', async () => { - const { VoaProvider, VOA } = setupDeleteSuccess(undefined); + const { VoaProvider, DPA } = setupDeleteSuccess(undefined); const deleteManyFn = deleteMany(VoaProvider, 'namespace'); const returned = await deleteManyFn(['123', '456', '789']); expect(returned).toBe(void 0); - expect(VOA._delete).toHaveBeenCalledWith({ + expect(DPA._delete).toHaveBeenCalledWith({ deleteRequest: { ids: ['123', '456', '789'], namespace: 'namespace' }, }); }); test('calls the openapi delete endpoint, passing filter with target namespace', async () => { - const { VOA, VoaProvider } = setupDeleteSuccess(undefined); + const { DPA, VoaProvider } = setupDeleteSuccess(undefined); const deleteManyFn = deleteMany(VoaProvider, 'namespace'); const returned = await deleteManyFn({ genre: 'ambient' }); expect(returned).toBe(void 0); - expect(VOA._delete).toHaveBeenCalledWith({ + expect(DPA._delete).toHaveBeenCalledWith({ deleteRequest: { filter: { genre: 'ambient' }, namespace: 'namespace' }, }); }); diff --git a/src/data/__tests__/deleteOne.test.ts b/src/data/__tests__/deleteOne.test.ts index 436cdfdd..9eda7071 100644 --- a/src/data/__tests__/deleteOne.test.ts +++ b/src/data/__tests__/deleteOne.test.ts @@ -1,9 +1,9 @@ import { deleteOne } from '../deleteOne'; import type { DeleteOperationRequest, - VectorOperationsApi, + DataPlaneApi, } from '../../pinecone-generated-ts-fetch'; -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataOperationsProvider } from '../dataOperationsProvider'; const setupDeleteResponse = (response, isSuccess) => { const fakeDelete: (req: DeleteOperationRequest) => Promise = jest @@ -11,9 +11,9 @@ const setupDeleteResponse = (response, isSuccess) => { .mockImplementation(() => isSuccess ? Promise.resolve(response) : Promise.reject(response) ); - const VOA = { _delete: fakeDelete } as VectorOperationsApi; - const VoaProvider = { provide: async () => VOA } as VectorOperationsProvider; - return { VOA, VoaProvider }; + const DPA = { _delete: fakeDelete } as DataPlaneApi; + const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; + return { DPA, VoaProvider }; }; export const setupDeleteSuccess = (response) => { return setupDeleteResponse(response, true); @@ -24,13 +24,13 @@ export const setupDeleteFailure = (response) => { describe('deleteOne', () => { test('calls the openapi delete endpoint, passing target namespace and the vector id to delete', async () => { - const { VoaProvider, VOA } = setupDeleteSuccess(undefined); + const { VoaProvider, DPA } = setupDeleteSuccess(undefined); const deleteOneFn = deleteOne(VoaProvider, 'namespace'); const returned = await deleteOneFn('123'); expect(returned).toBe(void 0); - expect(VOA._delete).toHaveBeenCalledWith({ + expect(DPA._delete).toHaveBeenCalledWith({ deleteRequest: { ids: ['123'], namespace: 'namespace' }, }); }); diff --git a/src/data/__tests__/describeIndexStats.test.ts b/src/data/__tests__/describeIndexStats.test.ts index 4b819b01..f0074532 100644 --- a/src/data/__tests__/describeIndexStats.test.ts +++ b/src/data/__tests__/describeIndexStats.test.ts @@ -1,6 +1,6 @@ import { describeIndexStats } from '../describeIndexStats'; -import { VectorOperationsApi } from '../../pinecone-generated-ts-fetch'; -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataOperationsProvider } from '../dataOperationsProvider'; import type { DescribeIndexStatsOperationRequest } from '../../pinecone-generated-ts-fetch'; const setupResponse = (response, isSuccess) => { @@ -11,11 +11,11 @@ const setupResponse = (response, isSuccess) => { .mockImplementation(() => isSuccess ? Promise.resolve(response) : Promise.reject(response) ); - const VOA = { + const DPA = { describeIndexStats: fakeDescribeIndexStats, - } as VectorOperationsApi; - const VoaProvider = { provide: async () => VOA } as VectorOperationsProvider; - return { VOA, VoaProvider }; + } as DataPlaneApi; + const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; + return { DPA, VoaProvider }; }; const setupSuccess = (response) => { return setupResponse(response, true); @@ -23,7 +23,7 @@ const setupSuccess = (response) => { describe('describeIndexStats', () => { test('calls the openapi describe_index_stats endpoint passing filter if provided', async () => { - const { VOA, VoaProvider } = setupSuccess({ + const { DPA, VoaProvider } = setupSuccess({ namespaces: { '': { vectorCount: 50 }, }, @@ -46,7 +46,7 @@ describe('describeIndexStats', () => { indexFullness: 0, totalRecordCount: 50, }); - expect(VOA.describeIndexStats).toHaveBeenCalledWith({ + expect(DPA.describeIndexStats).toHaveBeenCalledWith({ describeIndexStatsRequest: { filter: { genre: 'classical' } }, }); }); diff --git a/src/data/__tests__/fetch.test.ts b/src/data/__tests__/fetch.test.ts index 4f0e0996..7f276fdc 100644 --- a/src/data/__tests__/fetch.test.ts +++ b/src/data/__tests__/fetch.test.ts @@ -1,6 +1,6 @@ import { FetchCommand } from '../fetch'; -import { VectorOperationsApi } from '../../pinecone-generated-ts-fetch'; -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataOperationsProvider } from '../dataOperationsProvider'; import type { FetchRequest, FetchResponse, @@ -12,10 +12,10 @@ const setupResponse = (response, isSuccess) => { .mockImplementation(() => isSuccess ? Promise.resolve(response) : Promise.reject(response) ); - const VOA = { fetch: fakeFetch } as VectorOperationsApi; - const VoaProvider = { provide: async () => VOA } as VectorOperationsProvider; + const DPA = { fetch: fakeFetch } as DataPlaneApi; + const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; const cmd = new FetchCommand(VoaProvider, 'namespace'); - return { VOA, VoaProvider, cmd }; + return { DPA, VoaProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); @@ -23,11 +23,11 @@ const setupSuccess = (response) => { describe('fetch', () => { test('calls the openapi fetch endpoint, passing target namespace', async () => { - const { VOA, cmd } = setupSuccess({ vectors: [] }); + const { DPA, cmd } = setupSuccess({ vectors: [] }); const returned = await cmd.run(['1', '2']); expect(returned).toEqual({ records: [], namespace: '' }); - expect(VOA.fetch).toHaveBeenCalledWith({ + expect(DPA.fetch).toHaveBeenCalledWith({ ids: ['1', '2'], namespace: 'namespace', }); diff --git a/src/data/__tests__/update.test.ts b/src/data/__tests__/update.test.ts index b920c825..c71a8838 100644 --- a/src/data/__tests__/update.test.ts +++ b/src/data/__tests__/update.test.ts @@ -1,6 +1,6 @@ import { UpdateCommand } from '../update'; -import { VectorOperationsApi } from '../../pinecone-generated-ts-fetch'; -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataOperationsProvider } from '../dataOperationsProvider'; import type { UpdateOperationRequest } from '../../pinecone-generated-ts-fetch'; const setupResponse = (response, isSuccess) => { @@ -9,10 +9,10 @@ const setupResponse = (response, isSuccess) => { .mockImplementation(() => isSuccess ? Promise.resolve(response) : Promise.reject(response) ); - const VOA = { update: fakeUpdate } as VectorOperationsApi; - const VoaProvider = { provide: async () => VOA } as VectorOperationsProvider; + const DPA = { update: fakeUpdate } as DataPlaneApi; + const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; const cmd = new UpdateCommand(VoaProvider, 'namespace'); - return { fakeUpdate, VOA, VoaProvider, cmd }; + return { fakeUpdate, DPA, VoaProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); diff --git a/src/data/__tests__/upsert.test.ts b/src/data/__tests__/upsert.test.ts index d4da1428..e6ef6574 100644 --- a/src/data/__tests__/upsert.test.ts +++ b/src/data/__tests__/upsert.test.ts @@ -1,7 +1,7 @@ import { UpsertCommand } from '../upsert'; -import { VectorOperationsApi } from '../../pinecone-generated-ts-fetch'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; import type { UpsertOperationRequest } from '../../pinecone-generated-ts-fetch'; -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataOperationsProvider } from '../dataOperationsProvider'; const setupResponse = (response, isSuccess) => { const fakeUpsert: (req: UpsertOperationRequest) => Promise = jest @@ -9,11 +9,11 @@ const setupResponse = (response, isSuccess) => { .mockImplementation(() => isSuccess ? Promise.resolve(response) : Promise.reject(response) ); - const VOA = { upsert: fakeUpsert } as VectorOperationsApi; - const VoaProvider = { provide: async () => VOA } as VectorOperationsProvider; + const DPA = { upsert: fakeUpsert } as DataPlaneApi; + const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; const cmd = new UpsertCommand(VoaProvider, 'namespace'); - return { fakeUpsert, VOA, VoaProvider, cmd }; + return { fakeUpsert, DPA, VoaProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); diff --git a/src/data/__tests__/vectorOperationsProvider.test.ts b/src/data/__tests__/vectorOperationsProvider.test.ts index 76f2c363..da5d7e4e 100644 --- a/src/data/__tests__/vectorOperationsProvider.test.ts +++ b/src/data/__tests__/vectorOperationsProvider.test.ts @@ -1,7 +1,7 @@ -import { VectorOperationsProvider } from '../vectorOperationsProvider'; +import { DataOperationsProvider } from '../dataOperationsProvider'; import { IndexHostSingleton } from '../indexHostSingleton'; -describe('VectorOperationsProvider', () => { +describe('DataOperationsProvider', () => { let real; beforeAll(() => { @@ -21,7 +21,7 @@ describe('VectorOperationsProvider', () => { const config = { apiKey: 'test-api-key', }; - new VectorOperationsProvider(config, 'index-name'); + new DataOperationsProvider(config, 'index-name'); expect(IndexHostSingleton.getHostUrl).not.toHaveBeenCalled(); }); @@ -29,7 +29,7 @@ describe('VectorOperationsProvider', () => { const config = { apiKey: 'test-api-key', }; - const provider = new VectorOperationsProvider(config, 'index-name'); + const provider = new DataOperationsProvider(config, 'index-name'); expect(IndexHostSingleton.getHostUrl).not.toHaveBeenCalled(); const api = await provider.provide(); @@ -45,17 +45,17 @@ describe('VectorOperationsProvider', () => { apiKey: 'test-api-key', }; const indexHostUrl = 'http://index-host-url'; - const provider = new VectorOperationsProvider( + const provider = new DataOperationsProvider( config, 'index-name', indexHostUrl ); - jest.spyOn(provider, 'buildVectorOperationsConfig'); + jest.spyOn(provider, 'buildDataOperationsConfig'); await provider.provide(); expect(IndexHostSingleton.getHostUrl).not.toHaveBeenCalled(); - expect(provider.buildVectorOperationsConfig).toHaveBeenCalled(); + expect(provider.buildDataOperationsConfig).toHaveBeenCalled(); }); }); diff --git a/src/data/vectorOperationsProvider.ts b/src/data/dataOperationsProvider.ts similarity index 74% rename from src/data/vectorOperationsProvider.ts rename to src/data/dataOperationsProvider.ts index 99363dbb..d013bc3b 100644 --- a/src/data/vectorOperationsProvider.ts +++ b/src/data/dataOperationsProvider.ts @@ -2,7 +2,7 @@ import type { PineconeConfiguration } from './types'; import { Configuration, ConfigurationParameters, - VectorOperationsApi, + DataPlaneApi, } from '../pinecone-generated-ts-fetch'; import { queryParamsStringify, @@ -13,11 +13,11 @@ import { import { IndexHostSingleton } from './indexHostSingleton'; import { middleware } from '../utils/middleware'; -export class VectorOperationsProvider { +export class DataOperationsProvider { private config: PineconeConfiguration; private indexName: string; private indexHostUrl?: string; - private vectorOperations?: VectorOperationsApi; + private dataOperations?: DataPlaneApi; constructor( config: PineconeConfiguration, @@ -30,27 +30,27 @@ export class VectorOperationsProvider { } async provide() { - if (this.vectorOperations) { - return this.vectorOperations; + if (this.dataOperations) { + return this.dataOperations; } // If an indexHostUrl has been manually passed we use that, // otherwise we rely on resolving the host from the IndexHostSingleton if (this.indexHostUrl) { - this.vectorOperations = this.buildVectorOperationsConfig(); + this.dataOperations = this.buildDataOperationsConfig(); } else { this.indexHostUrl = await IndexHostSingleton.getHostUrl( this.config, this.indexName ); - this.vectorOperations = this.buildVectorOperationsConfig(); + this.dataOperations = this.buildDataOperationsConfig(); } - return this.vectorOperations; + return this.dataOperations; } - buildVectorOperationsConfig() { + buildDataOperationsConfig() { const indexConfigurationParameters: ConfigurationParameters = { basePath: this.indexHostUrl, apiKey: this.config.apiKey, @@ -63,8 +63,8 @@ export class VectorOperationsProvider { }; const indexConfiguration = new Configuration(indexConfigurationParameters); - const vectorOperations = new VectorOperationsApi(indexConfiguration); + const dataOperations = new DataPlaneApi(indexConfiguration); - return vectorOperations; + return dataOperations; } } diff --git a/src/data/deleteAll.ts b/src/data/deleteAll.ts index 4a3cd288..6d8b5d52 100644 --- a/src/data/deleteAll.ts +++ b/src/data/deleteAll.ts @@ -1,7 +1,7 @@ -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; export const deleteAll = ( - apiProvider: VectorOperationsProvider, + apiProvider: DataOperationsProvider, namespace: string ) => { return async (): Promise => { diff --git a/src/data/deleteMany.ts b/src/data/deleteMany.ts index 34ea5aed..821cbf31 100644 --- a/src/data/deleteMany.ts +++ b/src/data/deleteMany.ts @@ -1,4 +1,4 @@ -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import { buildConfigValidator } from '../validator'; import { Type } from '@sinclair/typebox'; import type { DeleteRequest } from '../pinecone-generated-ts-fetch/models/DeleteRequest'; @@ -35,7 +35,7 @@ export type DeleteManyOptions = | DeleteManyByFilterOptions; export const deleteMany = ( - apiProvider: VectorOperationsProvider, + apiProvider: DataOperationsProvider, namespace: string ) => { const validator = buildConfigValidator(DeleteManySchema, 'deleteMany'); diff --git a/src/data/deleteOne.ts b/src/data/deleteOne.ts index 93e020fd..2d1004a2 100644 --- a/src/data/deleteOne.ts +++ b/src/data/deleteOne.ts @@ -1,4 +1,4 @@ -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import { buildConfigValidator } from '../validator'; import { RecordIdSchema } from './types'; import type { RecordId } from './types'; @@ -11,7 +11,7 @@ import type { RecordId } from './types'; export type DeleteOneOptions = RecordId; export const deleteOne = ( - apiProvider: VectorOperationsProvider, + apiProvider: DataOperationsProvider, namespace: string ) => { const validator = buildConfigValidator(RecordIdSchema, 'deleteOne'); diff --git a/src/data/describeIndexStats.ts b/src/data/describeIndexStats.ts index fa6bebc5..e15929ea 100644 --- a/src/data/describeIndexStats.ts +++ b/src/data/describeIndexStats.ts @@ -1,6 +1,6 @@ import { buildConfigValidator } from '../validator'; import { Type } from '@sinclair/typebox'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; /** * A count of the number of records found inside a namespace @@ -59,7 +59,7 @@ export type DescribeIndexStatsOptions = { filter: object; }; -export const describeIndexStats = (apiProvider: VectorOperationsProvider) => { +export const describeIndexStats = (apiProvider: DataOperationsProvider) => { const validator = buildConfigValidator( DescribeIndexStatsOptionsSchema, 'describeIndexStats' diff --git a/src/data/fetch.ts b/src/data/fetch.ts index bfc06199..afb8033a 100644 --- a/src/data/fetch.ts +++ b/src/data/fetch.ts @@ -1,5 +1,5 @@ import { buildConfigValidator } from '../validator'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import { RecordIdSchema } from './types'; import type { OperationUsage, @@ -32,7 +32,7 @@ export type FetchResponse = { }; export class FetchCommand { - apiProvider: VectorOperationsProvider; + apiProvider: DataOperationsProvider; namespace: string; validator: ReturnType; diff --git a/src/data/index.ts b/src/data/index.ts index 6d031d52..8ecacb22 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -9,7 +9,7 @@ import { deleteOne } from './deleteOne'; import { deleteMany } from './deleteMany'; import { deleteAll } from './deleteAll'; import { describeIndexStats } from './describeIndexStats'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import type { PineconeConfiguration, RecordMetadata, @@ -273,7 +273,7 @@ export class Index { indexHostUrl: indexHostUrl, }; - const apiProvider = new VectorOperationsProvider( + const apiProvider = new DataOperationsProvider( config, indexName, indexHostUrl diff --git a/src/data/list.ts b/src/data/list.ts new file mode 100644 index 00000000..c05095c7 --- /dev/null +++ b/src/data/list.ts @@ -0,0 +1,40 @@ +import { buildConfigValidator } from '../validator'; +import { Type } from '@sinclair/typebox'; +import { DataOperationsProvider } from './dataOperationsProvider'; +import type { ListRequest, ListResponse } from '../pinecone-generated-ts-fetch'; + +export type ListOptions = { + prefix?: string; + limit?: number; + paginationToken?: string; +}; + +const ListOptionsSchema = Type.Object( + { + prefix: Type.Optional(Type.String({ minLength: 1 })), + limit: Type.Optional(Type.Number()), + paginationToken: Type.Optional(Type.String({ minLength: 1 })), + }, + { additionalProperties: false } +); + +export const list = ( + apiProvider: DataOperationsProvider, + namespace: string +) => { + const validator = buildConfigValidator(ListOptionsSchema, 'list'); + + return async (options?: ListOptions): Promise => { + if (options) { + validator(options); + } + + const listRequest: ListRequest = { + ...options, + namespace, + }; + + const api = await apiProvider.provide(); + return await api.list(listRequest); + }; +}; diff --git a/src/data/query.ts b/src/data/query.ts index 77ea1f6e..5b8adbab 100644 --- a/src/data/query.ts +++ b/src/data/query.ts @@ -8,7 +8,7 @@ import { } from './types'; import type { PineconeRecord, RecordMetadata } from './types'; import { Type } from '@sinclair/typebox'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; const shared = { topK: Type.Number(), @@ -132,7 +132,7 @@ export type QueryResponse = { }; export class QueryCommand { - apiProvider: VectorOperationsProvider; + apiProvider: DataOperationsProvider; namespace: string; validator: ReturnType; diff --git a/src/data/update.ts b/src/data/update.ts index d71840ea..88af4b98 100644 --- a/src/data/update.ts +++ b/src/data/update.ts @@ -1,6 +1,6 @@ import { buildConfigValidator } from '../validator'; import { Type } from '@sinclair/typebox'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import { RecordIdSchema, RecordValuesSchema, @@ -49,7 +49,7 @@ export type UpdateOptions = { }; export class UpdateCommand { - apiProvider: VectorOperationsProvider; + apiProvider: DataOperationsProvider; namespace: string; validator: ReturnType; diff --git a/src/data/upsert.ts b/src/data/upsert.ts index bea31d7e..6a072cbd 100644 --- a/src/data/upsert.ts +++ b/src/data/upsert.ts @@ -1,14 +1,14 @@ import { buildConfigValidator } from '../validator'; import { PineconeRecordSchema } from './types'; import { Type } from '@sinclair/typebox'; -import { VectorOperationsProvider } from './vectorOperationsProvider'; +import { DataOperationsProvider } from './dataOperationsProvider'; import type { Vector } from '../pinecone-generated-ts-fetch'; import type { PineconeRecord, RecordMetadata } from './types'; const RecordArray = Type.Array(PineconeRecordSchema); export class UpsertCommand { - apiProvider: VectorOperationsProvider; + apiProvider: DataOperationsProvider; namespace: string; validator: ReturnType; diff --git a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES b/src/pinecone-generated-ts-fetch/.openapi-generator/FILES index 4edef5c3..74882718 100644 --- a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES +++ b/src/pinecone-generated-ts-fetch/.openapi-generator/FILES @@ -1,9 +1,8 @@ .openapi-generator-ignore +apis/DataPlaneApi.ts apis/ManageIndexesApi.ts -apis/VectorOperationsApi.ts apis/index.ts index.ts -models/AwsRegions.ts models/CollectionList.ts models/CollectionModel.ts models/ConfigureIndexRequest.ts @@ -13,18 +12,21 @@ models/CreateCollectionRequest.ts models/CreateIndexRequest.ts models/CreateIndexRequestSpec.ts models/CreateIndexRequestSpecPod.ts +models/CreateIndexRequestSpecPodMetadataConfig.ts models/DeleteRequest.ts models/DescribeIndexStatsRequest.ts models/DescribeIndexStatsResponse.ts models/ErrorResponse.ts models/ErrorResponseError.ts models/FetchResponse.ts -models/GcpRegions.ts models/IndexList.ts models/IndexModel.ts models/IndexModelSpec.ts models/IndexModelStatus.ts +models/ListItem.ts +models/ListResponse.ts models/NamespaceSummary.ts +models/Pagination.ts models/PodSpec.ts models/PodSpecMetadataConfig.ts models/ProtobufAny.ts diff --git a/src/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts b/src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts similarity index 60% rename from src/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts rename to src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts index 8741af46..cd87e534 100644 --- a/src/pinecone-generated-ts-fetch/apis/VectorOperationsApi.ts +++ b/src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -19,6 +19,7 @@ import type { DescribeIndexStatsRequest, DescribeIndexStatsResponse, FetchResponse, + ListResponse, QueryRequest, QueryResponse, RpcStatus, @@ -35,6 +36,8 @@ import { DescribeIndexStatsResponseToJSON, FetchResponseFromJSON, FetchResponseToJSON, + ListResponseFromJSON, + ListResponseToJSON, QueryRequestFromJSON, QueryRequestToJSON, QueryResponseFromJSON, @@ -53,7 +56,7 @@ export interface DeleteOperationRequest { deleteRequest: DeleteRequest; } -export interface Delete1Request { +export interface AltDeleteRequest { ids?: Array; deleteAll?: boolean; namespace?: string; @@ -68,6 +71,13 @@ export interface FetchRequest { namespace?: string; } +export interface ListRequest { + prefix?: string; + limit?: number; + paginationToken?: string; + namespace?: string; +} + export interface QueryOperationRequest { queryRequest: QueryRequest; } @@ -83,11 +93,11 @@ export interface UpsertOperationRequest { /** * */ -export class VectorOperationsApi extends runtime.BaseAPI { +export class DataPlaneApi 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 + * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/docs/delete-data). + * Delete vectors */ async _deleteRaw(requestParameters: DeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.deleteRequest === null || requestParameters.deleteRequest === undefined) { @@ -116,8 +126,8 @@ 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 + * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/docs/delete-data). + * Delete vectors */ async _delete(requestParameters: DeleteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this._deleteRaw(requestParameters, initOverrides); @@ -125,10 +135,10 @@ 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 + * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/delete) instead. + * Delete vectors */ - async delete1Raw(requestParameters: Delete1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + async altDeleteRaw(requestParameters: AltDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters.ids) { @@ -160,88 +170,88 @@ 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 + * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/delete) instead. + * Delete vectors */ - async delete1(requestParameters: Delete1Request = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.delete1Raw(requestParameters, initOverrides); + async altDelete(requestParameters: AltDeleteRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.altDeleteRaw(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 + * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/describe_index_stats) instead. + * Get index stats */ - 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.'); - } - + async altDescribeIndexStatsRaw(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: `/describe_index_stats`, - method: 'POST', + method: 'GET', 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 + * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/describe_index_stats) instead. + * Get index stats */ - async describeIndexStats(requestParameters: DescribeIndexStatsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeIndexStatsRaw(requestParameters, initOverrides); + async altDescribeIndexStats(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.altDescribeIndexStatsRaw(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 + * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace and the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. For pod-based indexes, 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/). + * Get index stats */ - async describeIndexStats1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + 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: 'GET', + 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 + * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace and the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. For pod-based indexes, 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/). + * Get index stats */ - async describeIndexStats1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.describeIndexStats1Raw(initOverrides); + async describeIndexStats(requestParameters: DescribeIndexStatsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.describeIndexStatsRaw(requestParameters, 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 + * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/reference/fetch). + * Fetch vectors */ async fetchRaw(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.ids === null || requestParameters.ids === undefined) { @@ -275,8 +285,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/reference/fetch). + * Fetch vectors */ async fetch(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.fetchRaw(requestParameters, initOverrides); @@ -284,8 +294,56 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. `list` returns up to 100 IDs at a time by default in sorted order (bitwise/\"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [Get record IDs](https://docs.pinecone.io/docs/get-record-ids). **Note:** `list` is supported only for serverless indexes. + * List vector IDs + */ + async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + if (requestParameters.prefix !== undefined) { + queryParameters['prefix'] = requestParameters.prefix; + } + + if (requestParameters.limit !== undefined) { + queryParameters['limit'] = requestParameters.limit; + } + + if (requestParameters.paginationToken !== undefined) { + queryParameters['paginationToken'] = requestParameters.paginationToken; + } + + 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/list`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ListResponseFromJSON(jsonValue)); + } + + /** + * The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. `list` returns up to 100 IDs at a time by default in sorted order (bitwise/\"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [Get record IDs](https://docs.pinecone.io/docs/get-record-ids). **Note:** `list` is supported only for serverless indexes. + * List vector IDs + */ + async list(requestParameters: ListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.listRaw(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. For guidance and examples, see [Query data](https://docs.pinecone.io/docs/query-data). + * Query vectors */ async queryRaw(requestParameters: QueryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.queryRequest === null || requestParameters.queryRequest === undefined) { @@ -314,8 +372,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * 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. For guidance and examples, see [Query data](https://docs.pinecone.io/docs/query-data). + * Query vectors */ async query(requestParameters: QueryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.queryRaw(requestParameters, initOverrides); @@ -323,8 +381,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * The `update` operation updates a 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. For guidance and examples, see [Update data](https://docs.pinecone.io/reference/update). + * Update a vector */ async updateRaw(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.updateRequest === null || requestParameters.updateRequest === undefined) { @@ -353,8 +411,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * The `update` operation updates a 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. For guidance and examples, see [Update data](https://docs.pinecone.io/reference/update). + * Update a vector */ async update(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateRaw(requestParameters, initOverrides); @@ -362,8 +420,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * 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. For guidance and examples, see [Upsert data](https://docs.pinecone.io/docs/upsert-data). + * Upsert vectors */ async upsertRaw(requestParameters: UpsertOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.upsertRequest === null || requestParameters.upsertRequest === undefined) { @@ -392,8 +450,8 @@ export class VectorOperationsApi extends runtime.BaseAPI { } /** - * 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 + * 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. For guidance and examples, see [Upsert data](https://docs.pinecone.io/docs/upsert-data). + * Upsert vectors */ async upsert(requestParameters: UpsertOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.upsertRaw(requestParameters, initOverrides); diff --git a/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts b/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts index e44a401d..a8cfbdb2 100644 --- a/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts +++ b/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -78,7 +78,8 @@ export interface DescribeIndexRequest { export class ManageIndexesApi extends runtime.BaseAPI { /** - * This operation specifies the pod type and number of replicas for an index. + * This operation specifies the pod type and number of replicas for an index. It applies to pod-based indexes only. Serverless indexes scale automatically based on usage. + * Configure an index */ async configureIndexRaw(requestParameters: ConfigureIndexOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.indexName === null || requestParameters.indexName === undefined) { @@ -111,7 +112,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation specifies the pod type and number of replicas for an index. + * This operation specifies the pod type and number of replicas for an index. It applies to pod-based indexes only. Serverless indexes scale automatically based on usage. + * Configure an index */ async configureIndex(requestParameters: ConfigureIndexOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.configureIndexRaw(requestParameters, initOverrides); @@ -119,7 +121,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation creates a Pinecone collection. + * This operation creates a Pinecone collection. Serverless and starter indexes do not support collections. + * Create a collection */ async createCollectionRaw(requestParameters: CreateCollectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.createCollectionRequest === null || requestParameters.createCollectionRequest === undefined) { @@ -148,7 +151,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation creates a Pinecone collection. + * This operation creates a Pinecone collection. Serverless and starter indexes do not support collections. + * Create a collection */ async createCollection(requestParameters: CreateCollectionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createCollectionRaw(requestParameters, initOverrides); @@ -156,7 +160,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/docs/manage-indexes#create-a-serverless-index). + * Create an index */ async createIndexRaw(requestParameters: CreateIndexOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.createIndexRequest === null || requestParameters.createIndexRequest === undefined) { @@ -185,7 +190,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/docs/manage-indexes#create-a-serverless-index). + * Create an index */ async createIndex(requestParameters: CreateIndexOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createIndexRaw(requestParameters, initOverrides); @@ -193,7 +199,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation deletes an existing collection. + * This operation deletes an existing collection. Serverless and starter indexes do not support collections. + * Delete a collection */ async deleteCollectionRaw(requestParameters: DeleteCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.collectionName === null || requestParameters.collectionName === undefined) { @@ -223,7 +230,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation deletes an existing collection. + * This operation deletes an existing collection. Serverless and starter indexes do not support collections. + * Delete a collection */ async deleteCollection(requestParameters: DeleteCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteCollectionRaw(requestParameters, initOverrides); @@ -232,6 +240,7 @@ export class ManageIndexesApi extends runtime.BaseAPI { /** * This operation deletes an existing index. + * Delete an index */ async deleteIndexRaw(requestParameters: DeleteIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.indexName === null || requestParameters.indexName === undefined) { @@ -258,13 +267,15 @@ export class ManageIndexesApi extends runtime.BaseAPI { /** * This operation deletes an existing index. + * Delete an index */ async deleteIndex(requestParameters: DeleteIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteIndexRaw(requestParameters, initOverrides); } /** - * This operation gets a description of a collection. + * This operation gets a description of a collection. Serverless and starter indexes do not support collections. + * Describe a collection */ async describeCollectionRaw(requestParameters: DescribeCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.collectionName === null || requestParameters.collectionName === undefined) { @@ -290,7 +301,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation gets a description of a collection. + * This operation gets a description of a collection. Serverless and starter indexes do not support collections. + * Describe a collection */ async describeCollection(requestParameters: DescribeCollectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.describeCollectionRaw(requestParameters, initOverrides); @@ -299,6 +311,7 @@ export class ManageIndexesApi extends runtime.BaseAPI { /** * Get a description of an index. + * Describe an index */ async describeIndexRaw(requestParameters: DescribeIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.indexName === null || requestParameters.indexName === undefined) { @@ -325,6 +338,7 @@ export class ManageIndexesApi extends runtime.BaseAPI { /** * Get a description of an index. + * Describe an index */ async describeIndex(requestParameters: DescribeIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.describeIndexRaw(requestParameters, initOverrides); @@ -332,7 +346,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation returns a list of your Pinecone collections. + * This operation returns a list of all collections in a project. Serverless and starter indexes do not support collections. + * List collections */ async listCollectionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; @@ -354,7 +369,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation returns a list of your Pinecone collections. + * This operation returns a list of all collections in a project. Serverless and starter indexes do not support collections. + * List collections */ async listCollections(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listCollectionsRaw(initOverrides); @@ -362,7 +378,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation returns a list of your Pinecone indexes. + * This operation returns a list of all indexes in a project. + * List indexes */ async listIndexesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; @@ -384,7 +401,8 @@ export class ManageIndexesApi extends runtime.BaseAPI { } /** - * This operation returns a list of your Pinecone indexes. + * This operation returns a list of all indexes in a project. + * List indexes */ async listIndexes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.listIndexesRaw(initOverrides); diff --git a/src/pinecone-generated-ts-fetch/apis/index.ts b/src/pinecone-generated-ts-fetch/apis/index.ts index 39dff9ea..b86b509b 100644 --- a/src/pinecone-generated-ts-fetch/apis/index.ts +++ b/src/pinecone-generated-ts-fetch/apis/index.ts @@ -1,4 +1,4 @@ /* tslint:disable */ /* eslint-disable */ +export * from './DataPlaneApi'; export * from './ManageIndexesApi'; -export * from './VectorOperationsApi'; diff --git a/src/pinecone-generated-ts-fetch/models/AwsRegions.ts b/src/pinecone-generated-ts-fetch/models/AwsRegions.ts deleted file mode 100644 index 4b223c02..00000000 --- a/src/pinecone-generated-ts-fetch/models/AwsRegions.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pineonce.io Public API - * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. - * - * The version of the OpenAPI document: 1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Regions available with the AWS cloud provider - * @export - */ -export const AwsRegions = { - East1: 'us-east-1', - West1: 'us-west-1', - West2: 'us-west-2' -} as const; -export type AwsRegions = typeof AwsRegions[keyof typeof AwsRegions]; - - -export function AwsRegionsFromJSON(json: any): AwsRegions { - return AwsRegionsFromJSONTyped(json, false); -} - -export function AwsRegionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): AwsRegions { - return json as AwsRegions; -} - -export function AwsRegionsToJSON(value?: AwsRegions | null): any { - return value as any; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CollectionList.ts b/src/pinecone-generated-ts-fetch/models/CollectionList.ts index 15e2773f..a1b311b9 100644 --- a/src/pinecone-generated-ts-fetch/models/CollectionList.ts +++ b/src/pinecone-generated-ts-fetch/models/CollectionList.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/CollectionModel.ts b/src/pinecone-generated-ts-fetch/models/CollectionModel.ts index 4fb8686c..7105a3be 100644 --- a/src/pinecone-generated-ts-fetch/models/CollectionModel.ts +++ b/src/pinecone-generated-ts-fetch/models/CollectionModel.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -38,13 +38,13 @@ export interface CollectionModel { */ status: CollectionModelStatusEnum; /** - * The dimension of the vectors stored in each record held in the collection + * The dimension of the vectors stored in each record held in the collection. * @type {number} * @memberof CollectionModel */ dimension?: number; /** - * The number of records stored in the collection + * The number of records stored in the collection. * @type {number} * @memberof CollectionModel */ @@ -54,7 +54,7 @@ export interface CollectionModel { * @type {string} * @memberof CollectionModel */ - environment?: string; + environment: string; } @@ -76,6 +76,7 @@ export function instanceOfCollectionModel(value: object): boolean { let isInstance = true; isInstance = isInstance && "name" in value; isInstance = isInstance && "status" in value; + isInstance = isInstance && "environment" in value; return isInstance; } @@ -95,7 +96,7 @@ export function CollectionModelFromJSONTyped(json: any, ignoreDiscriminator: boo 'status': json['status'], 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], 'vectorCount': !exists(json, 'vector_count') ? undefined : json['vector_count'], - 'environment': !exists(json, 'environment') ? undefined : json['environment'], + 'environment': json['environment'], }; } diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts index 374cd8aa..22e8d80f 100644 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts index b951beb3..8eb8cc10 100644 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts +++ b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts index 3ddb2165..84854b17 100644 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts +++ b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts index 15df4182..31708bbc 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -20,7 +20,7 @@ import { exists, mapValues } from '../runtime'; */ export interface CreateCollectionRequest { /** - * The name of the collection to be created. + * The name of the collection to be created. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'. * @type {string} * @memberof CreateCollectionRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts index a3bbf172..00ed10d1 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -27,13 +27,13 @@ import { */ export interface CreateIndexRequest { /** - * The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + * The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'. * @type {string} * @memberof CreateIndexRequest */ name: string; /** - * The dimensions of the vectors to be inserted in the index + * The dimensions of the vectors to be inserted in the index. * @type {number} * @memberof CreateIndexRequest */ @@ -43,7 +43,7 @@ export interface CreateIndexRequest { * @type {string} * @memberof CreateIndexRequest */ - metric: CreateIndexRequestMetricEnum; + metric?: CreateIndexRequestMetricEnum; /** * * @type {CreateIndexRequestSpec} @@ -71,7 +71,6 @@ export function instanceOfCreateIndexRequest(value: object): boolean { let isInstance = true; isInstance = isInstance && "name" in value; isInstance = isInstance && "dimension" in value; - isInstance = isInstance && "metric" in value; isInstance = isInstance && "spec" in value; return isInstance; @@ -89,7 +88,7 @@ export function CreateIndexRequestFromJSONTyped(json: any, ignoreDiscriminator: 'name': json['name'], 'dimension': json['dimension'], - 'metric': json['metric'], + 'metric': !exists(json, 'metric') ? undefined : json['metric'], 'spec': CreateIndexRequestSpecFromJSON(json['spec']), }; } diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts index ca81e9b8..80c4bf3c 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -27,7 +27,11 @@ import { } from './ServerlessSpec'; /** - * Spec objects describe how the index should be deployed + * The spec object defines how the index should be deployed. + * + * For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. + * + * Serverless indexes are in public preview and are available only on AWS in the us-west-2 region. Test thoroughly before using serverless indexes in production. * @export * @interface CreateIndexRequestSpec */ diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts index 0493196c..7c394fc0 100644 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts +++ b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -13,15 +13,15 @@ */ import { exists, mapValues } from '../runtime'; -import type { PodSpecMetadataConfig } from './PodSpecMetadataConfig'; +import type { CreateIndexRequestSpecPodMetadataConfig } from './CreateIndexRequestSpecPodMetadataConfig'; import { - PodSpecMetadataConfigFromJSON, - PodSpecMetadataConfigFromJSONTyped, - PodSpecMetadataConfigToJSON, -} from './PodSpecMetadataConfig'; + CreateIndexRequestSpecPodMetadataConfigFromJSON, + CreateIndexRequestSpecPodMetadataConfigFromJSONTyped, + CreateIndexRequestSpecPodMetadataConfigToJSON, +} from './CreateIndexRequestSpecPodMetadataConfig'; /** - * Configuration needed to deploy a pod index + * Configuration needed to deploy a pod-based index. * @export * @interface CreateIndexRequestSpecPod */ @@ -58,10 +58,10 @@ export interface CreateIndexRequestSpecPod { shards?: number; /** * - * @type {PodSpecMetadataConfig} + * @type {CreateIndexRequestSpecPodMetadataConfig} * @memberof CreateIndexRequestSpecPod */ - metadataConfig?: PodSpecMetadataConfig; + metadataConfig?: CreateIndexRequestSpecPodMetadataConfig; /** * The name of the collection to be used as the source for the index. * @type {string} @@ -96,7 +96,7 @@ export function CreateIndexRequestSpecPodFromJSONTyped(json: any, ignoreDiscrimi 'podType': json['pod_type'], 'pods': !exists(json, 'pods') ? undefined : json['pods'], 'shards': !exists(json, 'shards') ? undefined : json['shards'], - 'metadataConfig': !exists(json, 'metadata_config') ? undefined : PodSpecMetadataConfigFromJSON(json['metadata_config']), + 'metadataConfig': !exists(json, 'metadata_config') ? undefined : CreateIndexRequestSpecPodMetadataConfigFromJSON(json['metadata_config']), 'sourceCollection': !exists(json, 'source_collection') ? undefined : json['source_collection'], }; } @@ -115,7 +115,7 @@ export function CreateIndexRequestSpecPodToJSON(value?: CreateIndexRequestSpecPo 'pod_type': value.podType, 'pods': value.pods, 'shards': value.shards, - 'metadata_config': PodSpecMetadataConfigToJSON(value.metadataConfig), + 'metadata_config': CreateIndexRequestSpecPodMetadataConfigToJSON(value.metadataConfig), 'source_collection': value.sourceCollection, }; } diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts new file mode 100644 index 00000000..3de52f1d --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: v1 + * 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'; +/** + * 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. These configurations are only valid for use with pod-based indexes. + * @export + * @interface CreateIndexRequestSpecPodMetadataConfig + */ +export interface CreateIndexRequestSpecPodMetadataConfig { + /** + * By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields which should be indexed. + * @type {Array} + * @memberof CreateIndexRequestSpecPodMetadataConfig + */ + indexed?: Array; +} + +/** + * Check if a given object implements the CreateIndexRequestSpecPodMetadataConfig interface. + */ +export function instanceOfCreateIndexRequestSpecPodMetadataConfig(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function CreateIndexRequestSpecPodMetadataConfigFromJSON(json: any): CreateIndexRequestSpecPodMetadataConfig { + return CreateIndexRequestSpecPodMetadataConfigFromJSONTyped(json, false); +} + +export function CreateIndexRequestSpecPodMetadataConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateIndexRequestSpecPodMetadataConfig { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'indexed': !exists(json, 'indexed') ? undefined : json['indexed'], + }; +} + +export function CreateIndexRequestSpecPodMetadataConfigToJSON(value?: CreateIndexRequestSpecPodMetadataConfig | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'indexed': value.indexed, + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/DeleteRequest.ts b/src/pinecone-generated-ts-fetch/models/DeleteRequest.ts index c56e805e..6f5545d5 100644 --- a/src/pinecone-generated-ts-fetch/models/DeleteRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/DeleteRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts index f181211f..f3043f07 100644 --- a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,7 +14,7 @@ import { exists, mapValues } from '../runtime'; /** - * The request for the `DescribeIndexStats` operation. + * The request for the `describe_index_stats` operation. * @export * @interface DescribeIndexStatsRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts index cb3aaa12..bcfdcfa5 100644 --- a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts +++ b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -21,7 +21,7 @@ import { } from './NamespaceSummary'; /** - * The response for the `DescribeIndexStats` operation. + * The response for the `describe_index_stats` operation. * @export * @interface DescribeIndexStatsResponse */ diff --git a/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts b/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts index 106c9022..61cb9fa5 100644 --- a/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts +++ b/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -21,13 +21,13 @@ import { } from './ErrorResponseError'; /** - * The response shape used for all error responses + * The response shape used for all error responses. * @export * @interface ErrorResponse */ export interface ErrorResponse { /** - * The HTTP status code of the error + * The HTTP status code of the error. * @type {number} * @memberof ErrorResponse */ diff --git a/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts b/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts index ad7432f5..b8374867 100644 --- a/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts +++ b/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,7 +14,7 @@ import { exists, mapValues } from '../runtime'; /** - * Detailed information about the error that occurred + * Detailed information about the error that occurred. * @export * @interface ErrorResponseError */ @@ -44,12 +44,11 @@ export interface ErrorResponseError { * @export */ export const ErrorResponseErrorCodeEnum = { - QuotaExceeded: 'QUOTA_EXCEEDED', - BadParams: 'BAD_PARAMS', - Cancelled: 'CANCELLED', + Ok: 'OK', Unknown: 'UNKNOWN', InvalidArgument: 'INVALID_ARGUMENT', DeadlineExceeded: 'DEADLINE_EXCEEDED', + QuotaExceeded: 'QUOTA_EXCEEDED', NotFound: 'NOT_FOUND', AlreadyExists: 'ALREADY_EXISTS', PermissionDenied: 'PERMISSION_DENIED', @@ -61,7 +60,8 @@ export const ErrorResponseErrorCodeEnum = { Unimplemented: 'UNIMPLEMENTED', Internal: 'INTERNAL', Unavailable: 'UNAVAILABLE', - DataLoss: 'DATA_LOSS' + DataLoss: 'DATA_LOSS', + Forbidden: 'FORBIDDEN' } as const; export type ErrorResponseErrorCodeEnum = typeof ErrorResponseErrorCodeEnum[keyof typeof ErrorResponseErrorCodeEnum]; diff --git a/src/pinecone-generated-ts-fetch/models/FetchResponse.ts b/src/pinecone-generated-ts-fetch/models/FetchResponse.ts index 9acc2404..a2d6d551 100644 --- a/src/pinecone-generated-ts-fetch/models/FetchResponse.ts +++ b/src/pinecone-generated-ts-fetch/models/FetchResponse.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -27,7 +27,7 @@ import { } from './Vector'; /** - * The response for the `Fetch` operation. + * The response for the `fetch` operation. * @export * @interface FetchResponse */ diff --git a/src/pinecone-generated-ts-fetch/models/GcpRegions.ts b/src/pinecone-generated-ts-fetch/models/GcpRegions.ts deleted file mode 100644 index f9931ba3..00000000 --- a/src/pinecone-generated-ts-fetch/models/GcpRegions.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Pineonce.io Public API - * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. - * - * The version of the OpenAPI document: 1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Regions available with the GCP cloud provider - * @export - */ -export const GcpRegions = { - UsWest1: 'us-west1', - UsWest2: 'us-west2', - EuWest4: 'eu-west4', - NorthamericaNortheast1: 'northamerica-northeast1', - AsiaNortheast1: 'asia-northeast1', - AsiaSoutheast1C: 'asia-southeast1C' -} as const; -export type GcpRegions = typeof GcpRegions[keyof typeof GcpRegions]; - - -export function GcpRegionsFromJSON(json: any): GcpRegions { - return GcpRegionsFromJSONTyped(json, false); -} - -export function GcpRegionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): GcpRegions { - return json as GcpRegions; -} - -export function GcpRegionsToJSON(value?: GcpRegions | null): any { - return value as any; -} - diff --git a/src/pinecone-generated-ts-fetch/models/IndexList.ts b/src/pinecone-generated-ts-fetch/models/IndexList.ts index cbc0cd60..b85c3a82 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexList.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexList.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/IndexModel.ts b/src/pinecone-generated-ts-fetch/models/IndexModel.ts index e2b0c485..804606a0 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexModel.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexModel.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -27,19 +27,19 @@ import { } from './IndexModelStatus'; /** - * The IndexModel describes the configuration and deployment status of a Pinecone index. + * The IndexModel describes the configuration and status of a Pinecone index. * @export * @interface IndexModel */ export interface IndexModel { /** - * The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + * The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'. * @type {string} * @memberof IndexModel */ name: string; /** - * The dimensions of the vectors to be inserted in the index + * The dimensions of the vectors to be inserted in the index. * @type {number} * @memberof IndexModel */ diff --git a/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts b/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts index 948373cb..563aaac6 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts b/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts index 10064342..348b1613 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts +++ b/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ListItem.ts b/src/pinecone-generated-ts-fetch/models/ListItem.ts new file mode 100644 index 00000000..e222522b --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/ListItem.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: v1 + * 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 ListItem + */ +export interface ListItem { + /** + * + * @type {string} + * @memberof ListItem + */ + id?: string; +} + +/** + * Check if a given object implements the ListItem interface. + */ +export function instanceOfListItem(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ListItemFromJSON(json: any): ListItem { + return ListItemFromJSONTyped(json, false); +} + +export function ListItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListItem { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'id': !exists(json, 'id') ? undefined : json['id'], + }; +} + +export function ListItemToJSON(value?: ListItem | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'id': value.id, + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/ListResponse.ts b/src/pinecone-generated-ts-fetch/models/ListResponse.ts new file mode 100644 index 00000000..083a7eca --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/ListResponse.ts @@ -0,0 +1,108 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: v1 + * 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 { ListItem } from './ListItem'; +import { + ListItemFromJSON, + ListItemFromJSONTyped, + ListItemToJSON, +} from './ListItem'; +import type { Pagination } from './Pagination'; +import { + PaginationFromJSON, + PaginationFromJSONTyped, + PaginationToJSON, +} from './Pagination'; +import type { Usage } from './Usage'; +import { + UsageFromJSON, + UsageFromJSONTyped, + UsageToJSON, +} from './Usage'; + +/** + * The response for the `List` operation. + * @export + * @interface ListResponse + */ +export interface ListResponse { + /** + * + * @type {Array} + * @memberof ListResponse + */ + vectors?: Array; + /** + * + * @type {Pagination} + * @memberof ListResponse + */ + pagination?: Pagination; + /** + * The namespace of the vectors. + * @type {string} + * @memberof ListResponse + */ + namespace?: string; + /** + * + * @type {Usage} + * @memberof ListResponse + */ + usage?: Usage; +} + +/** + * Check if a given object implements the ListResponse interface. + */ +export function instanceOfListResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ListResponseFromJSON(json: any): ListResponse { + return ListResponseFromJSONTyped(json, false); +} + +export function ListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ListResponse { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'vectors': !exists(json, 'vectors') ? undefined : ((json['vectors'] as Array).map(ListItemFromJSON)), + 'pagination': !exists(json, 'pagination') ? undefined : PaginationFromJSON(json['pagination']), + 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], + 'usage': !exists(json, 'usage') ? undefined : UsageFromJSON(json['usage']), + }; +} + +export function ListResponseToJSON(value?: ListResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'vectors': value.vectors === undefined ? undefined : ((value.vectors as Array).map(ListItemToJSON)), + 'pagination': PaginationToJSON(value.pagination), + 'namespace': value.namespace, + 'usage': UsageToJSON(value.usage), + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts b/src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts index ea3d623f..4783f6d2 100644 --- a/src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts +++ b/src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/Pagination.ts b/src/pinecone-generated-ts-fetch/models/Pagination.ts new file mode 100644 index 00000000..ef7762ea --- /dev/null +++ b/src/pinecone-generated-ts-fetch/models/Pagination.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: v1 + * 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 Pagination + */ +export interface Pagination { + /** + * + * @type {string} + * @memberof Pagination + */ + next?: string; +} + +/** + * Check if a given object implements the Pagination interface. + */ +export function instanceOfPagination(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function PaginationFromJSON(json: any): Pagination { + return PaginationFromJSONTyped(json, false); +} + +export function PaginationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Pagination { + if ((json === undefined) || (json === null)) { + return json; + } + return { + + 'next': !exists(json, 'next') ? undefined : json['next'], + }; +} + +export function PaginationToJSON(value?: Pagination | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + + 'next': value.next, + }; +} + diff --git a/src/pinecone-generated-ts-fetch/models/PodSpec.ts b/src/pinecone-generated-ts-fetch/models/PodSpec.ts index 3ef69dec..fd4737c8 100644 --- a/src/pinecone-generated-ts-fetch/models/PodSpec.ts +++ b/src/pinecone-generated-ts-fetch/models/PodSpec.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -21,7 +21,7 @@ import { } from './PodSpecMetadataConfig'; /** - * Configuration needed to deploy a pod index + * Configuration needed to deploy a pod-based index. * @export * @interface PodSpec */ @@ -51,7 +51,7 @@ export interface PodSpec { */ podType: string; /** - * The number of pods to be used in the index. This should be equal to `shards` x `replicas`. + * The number of pods to be used in the index. This should be equal to `shards` x `replicas`.' * @type {number} * @memberof PodSpec */ diff --git a/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts b/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts index c674b24a..a240f9d6 100644 --- a/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts +++ b/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,13 +14,13 @@ import { exists, mapValues } from '../runtime'; /** - * 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. These configurations are only valid for use with pod indexes. + * 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. These configurations are only valid for use with pod-based indexes. * @export * @interface PodSpecMetadataConfig */ export interface PodSpecMetadataConfig { /** - * By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields which should be indexed. + * By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields that should be indexed. * @type {Array} * @memberof PodSpecMetadataConfig */ diff --git a/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts b/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts index da57a3d7..3c66f9dc 100644 --- a/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts +++ b/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts b/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts index ae009827..2ee75dbc 100644 --- a/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts +++ b/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/QueryRequest.ts b/src/pinecone-generated-ts-fetch/models/QueryRequest.ts index 496fd223..3f5c98d7 100644 --- a/src/pinecone-generated-ts-fetch/models/QueryRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/QueryRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -27,7 +27,7 @@ import { } from './SparseValues'; /** - * The request for the `Query` operation. + * The request for the `query` operation. * @export * @interface QueryRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/QueryResponse.ts b/src/pinecone-generated-ts-fetch/models/QueryResponse.ts index 316e27a4..57123a1d 100644 --- a/src/pinecone-generated-ts-fetch/models/QueryResponse.ts +++ b/src/pinecone-generated-ts-fetch/models/QueryResponse.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -33,7 +33,7 @@ import { } from './Usage'; /** - * 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. + * 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 */ diff --git a/src/pinecone-generated-ts-fetch/models/QueryVector.ts b/src/pinecone-generated-ts-fetch/models/QueryVector.ts index fde12a4d..2e7937bc 100644 --- a/src/pinecone-generated-ts-fetch/models/QueryVector.ts +++ b/src/pinecone-generated-ts-fetch/models/QueryVector.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/RpcStatus.ts b/src/pinecone-generated-ts-fetch/models/RpcStatus.ts index 6879da20..ce5f1046 100644 --- a/src/pinecone-generated-ts-fetch/models/RpcStatus.ts +++ b/src/pinecone-generated-ts-fetch/models/RpcStatus.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ScoredVector.ts b/src/pinecone-generated-ts-fetch/models/ScoredVector.ts index c4046211..7d238ab7 100644 --- a/src/pinecone-generated-ts-fetch/models/ScoredVector.ts +++ b/src/pinecone-generated-ts-fetch/models/ScoredVector.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts b/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts index 60475796..24dc69dc 100644 --- a/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts +++ b/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,19 +14,19 @@ import { exists, mapValues } from '../runtime'; /** - * Configuration needed to deploy a serverless index + * Configuration needed to deploy a serverless index. * @export * @interface ServerlessSpec */ export interface ServerlessSpec { /** - * The public cloud where you would like your index hosted + * The public cloud where you would like your index hosted. Serverless indexes can be hosted only in AWS at this time. * @type {string} * @memberof ServerlessSpec */ cloud: ServerlessSpecCloudEnum; /** - * The region where you would like your index to be created. Different cloud providers have different regions available. See AwsRegions and GcpRegions for a list of available options. + * The region where you would like your index to be created. Serverless indexes can be created only in the us-west-2 region of AWS at this time. * @type {string} * @memberof ServerlessSpec */ diff --git a/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts b/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts index 0fe7542e..2a6ab965 100644 --- a/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts +++ b/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/SparseValues.ts b/src/pinecone-generated-ts-fetch/models/SparseValues.ts index f7941dcb..a1df99ba 100644 --- a/src/pinecone-generated-ts-fetch/models/SparseValues.ts +++ b/src/pinecone-generated-ts-fetch/models/SparseValues.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,19 +14,19 @@ 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 */ diff --git a/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts b/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts index 5dac5fc4..b86de27e 100644 --- a/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -21,7 +21,7 @@ import { } from './SparseValues'; /** - * The request for the `Upsert` operation. + * The request for the `update` operation. * @export * @interface UpdateRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts b/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts index f26351fd..b34227d2 100644 --- a/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts +++ b/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -21,7 +21,7 @@ import { } from './Vector'; /** - * The request for the `Upsert` operation. + * The request for the `upsert` operation. * @export * @interface UpsertRequest */ diff --git a/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts b/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts index 5bd5f702..bbdf27af 100644 --- a/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts +++ b/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -14,7 +14,7 @@ import { exists, mapValues } from '../runtime'; /** - * The response for the `Upsert` operation. + * The response for the `upsert` operation. * @export * @interface UpsertResponse */ diff --git a/src/pinecone-generated-ts-fetch/models/Usage.ts b/src/pinecone-generated-ts-fetch/models/Usage.ts index 4840915a..27abe5c5 100644 --- a/src/pinecone-generated-ts-fetch/models/Usage.ts +++ b/src/pinecone-generated-ts-fetch/models/Usage.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/Vector.ts b/src/pinecone-generated-ts-fetch/models/Vector.ts index 4764e0cb..e9307a46 100644 --- a/src/pinecone-generated-ts-fetch/models/Vector.ts +++ b/src/pinecone-generated-ts-fetch/models/Vector.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech diff --git a/src/pinecone-generated-ts-fetch/models/index.ts b/src/pinecone-generated-ts-fetch/models/index.ts index 474fb99b..b2e7dbe6 100644 --- a/src/pinecone-generated-ts-fetch/models/index.ts +++ b/src/pinecone-generated-ts-fetch/models/index.ts @@ -1,6 +1,5 @@ /* tslint:disable */ /* eslint-disable */ -export * from './AwsRegions'; export * from './CollectionList'; export * from './CollectionModel'; export * from './ConfigureIndexRequest'; @@ -10,18 +9,21 @@ export * from './CreateCollectionRequest'; export * from './CreateIndexRequest'; export * from './CreateIndexRequestSpec'; export * from './CreateIndexRequestSpecPod'; +export * from './CreateIndexRequestSpecPodMetadataConfig'; export * from './DeleteRequest'; export * from './DescribeIndexStatsRequest'; export * from './DescribeIndexStatsResponse'; export * from './ErrorResponse'; export * from './ErrorResponseError'; export * from './FetchResponse'; -export * from './GcpRegions'; export * from './IndexList'; export * from './IndexModel'; export * from './IndexModelSpec'; export * from './IndexModelStatus'; +export * from './ListItem'; +export * from './ListResponse'; export * from './NamespaceSummary'; +export * from './Pagination'; export * from './PodSpec'; export * from './PodSpecMetadataConfig'; export * from './ProtobufAny'; diff --git a/src/pinecone-generated-ts-fetch/runtime.ts b/src/pinecone-generated-ts-fetch/runtime.ts index ddb9c35d..873d6933 100644 --- a/src/pinecone-generated-ts-fetch/runtime.ts +++ b/src/pinecone-generated-ts-fetch/runtime.ts @@ -1,11 +1,11 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pineonce.io Public API + * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 1.0 - * + * The version of the OpenAPI document: v1 + * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech From 5e04ab447a59adb80b6df250744f746b49021895 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 13:44:08 -0500 Subject: [PATCH 2/6] clean up query integration test --- src/integration/data/query.test.ts | 80 +++++++++++------------------- 1 file changed, 28 insertions(+), 52 deletions(-) diff --git a/src/integration/data/query.test.ts b/src/integration/data/query.test.ts index 28790819..b5ea79df 100644 --- a/src/integration/data/query.test.ts +++ b/src/integration/data/query.test.ts @@ -12,9 +12,10 @@ describe('query', () => { index: Index, ns: Index, namespace: string, - recordIds: string[]; + recordIds: string[], + numberOfRecords: number; - beforeEach(async () => { + beforeAll(async () => { pinecone = new Pinecone(); await pinecone.createIndex({ @@ -34,87 +35,65 @@ describe('query', () => { namespace = randomString(16); index = pinecone.index(INDEX_NAME); ns = index.namespace(namespace); - }); + numberOfRecords = 3; - afterEach(async () => { - await ns.deleteMany(recordIds); - }); - - test('query by id', async () => { - const recordsToUpsert = generateRecords(5, 3); - recordIds = recordsToUpsert.map((r) => r.id); + // Seed with records for testing + const recordsToUpsert = generateRecords(5, numberOfRecords); expect(recordsToUpsert).toHaveLength(3); - expect(recordsToUpsert[0].id).toEqual('0'); - expect(recordsToUpsert[1].id).toEqual('1'); - expect(recordsToUpsert[2].id).toEqual('2'); + expect(recordsToUpsert[0].id).toEqual('query-0'); + expect(recordsToUpsert[1].id).toEqual('query-1'); + expect(recordsToUpsert[2].id).toEqual('query-2'); await ns.upsert(recordsToUpsert); + recordIds = recordsToUpsert.map((r) => r.id); await waitUntilRecordsReady(ns, namespace, recordIds); + }); + afterAll(async () => { + await ns.deleteMany(recordIds); + }); + + test('query by id', async () => { const topK = 2; + const queryId = recordIds[0]; const assertions = (results) => { expect(results.matches).toBeDefined(); expect(results.matches?.length).toEqual(topK); expect(results.usage.readUnits).toBeDefined(); + expect(results.matches).toEqual( + expect.arrayContaining([expect.objectContaining({ id: queryId })]) + ); }; - await assertWithRetries(() => ns.query({ id: '0', topK }), assertions); + await assertWithRetries(() => ns.query({ id: queryId, topK }), assertions); }); test('query when topK is greater than number of records', async () => { - const numberOfRecords = 3; - const recordsToUpsert = generateRecords(5, numberOfRecords); - recordIds = recordsToUpsert.map((r) => r.id); - expect(recordsToUpsert).toHaveLength(3); - expect(recordsToUpsert[0].id).toEqual('0'); - expect(recordsToUpsert[1].id).toEqual('1'); - expect(recordsToUpsert[2].id).toEqual('2'); - - await ns.upsert(recordsToUpsert); - await waitUntilRecordsReady(ns, namespace, recordIds); - - const topK = 5; + const topK = numberOfRecords + 2; + const queryId = recordIds[1]; const assertions = (results) => { expect(results.matches).toBeDefined(); expect(results.matches?.length).toEqual(numberOfRecords); expect(results.usage.readUnits).toBeDefined(); }; - await assertWithRetries(() => ns.query({ id: '0', topK }), assertions); + await assertWithRetries(() => ns.query({ id: queryId, topK }), assertions); }); test('with invalid id, returns empty results', async () => { - const recordsToUpsert = generateRecords(5, 3); - recordIds = recordsToUpsert.map((r) => r.id); - expect(recordsToUpsert).toHaveLength(3); - expect(recordsToUpsert[0].id).toEqual('0'); - expect(recordsToUpsert[1].id).toEqual('1'); - expect(recordsToUpsert[2].id).toEqual('2'); - - await ns.upsert(recordsToUpsert); - await waitUntilRecordsReady(ns, namespace, recordIds); - const topK = 2; const assertions = (results) => { expect(results.matches).toBeDefined(); expect(results.matches?.length).toEqual(0); }; - await assertWithRetries(() => ns.query({ id: '100', topK }), assertions); + await assertWithRetries( + () => ns.query({ id: '12354523423', topK }), + assertions + ); }); test('query with vector values', async () => { - const numberOfRecords = 3; - const recordsToUpsert = generateRecords(5, numberOfRecords); - recordIds = recordsToUpsert.map((r) => r.id); - expect(recordsToUpsert).toHaveLength(3); - expect(recordsToUpsert[0].id).toEqual('0'); - expect(recordsToUpsert[1].id).toEqual('1'); - expect(recordsToUpsert[2].id).toEqual('2'); - - await ns.upsert(recordsToUpsert); - await waitUntilRecordsReady(ns, namespace, recordIds); - const topK = 1; const assertions = (results) => { expect(results.matches).toBeDefined(); @@ -133,9 +112,6 @@ describe('query', () => { }); test('query with includeValues: true', async () => { - const recordsToUpsert = generateRecords(5, 3); - expect(recordsToUpsert).toHaveLength(3); - const queryVec = Array.from({ length: 5 }, () => Math.random()); const assertions = (results) => { From d605658729c5a495b5a299e596b5382ad2cb0f8f Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 13:50:12 -0500 Subject: [PATCH 3/6] fix assertions --- src/integration/data/query.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integration/data/query.test.ts b/src/integration/data/query.test.ts index b5ea79df..7d511308 100644 --- a/src/integration/data/query.test.ts +++ b/src/integration/data/query.test.ts @@ -40,9 +40,9 @@ describe('query', () => { // Seed with records for testing const recordsToUpsert = generateRecords(5, numberOfRecords); expect(recordsToUpsert).toHaveLength(3); - expect(recordsToUpsert[0].id).toEqual('query-0'); - expect(recordsToUpsert[1].id).toEqual('query-1'); - expect(recordsToUpsert[2].id).toEqual('query-2'); + expect(recordsToUpsert[0].id).toEqual('0'); + expect(recordsToUpsert[1].id).toEqual('1'); + expect(recordsToUpsert[2].id).toEqual('2'); await ns.upsert(recordsToUpsert); recordIds = recordsToUpsert.map((r) => r.id); From 90621fbd19de91803788ce0caa27925a9be31a08 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 13:59:19 -0500 Subject: [PATCH 4/6] delete list file --- src/data/list.ts | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/data/list.ts diff --git a/src/data/list.ts b/src/data/list.ts deleted file mode 100644 index c05095c7..00000000 --- a/src/data/list.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { buildConfigValidator } from '../validator'; -import { Type } from '@sinclair/typebox'; -import { DataOperationsProvider } from './dataOperationsProvider'; -import type { ListRequest, ListResponse } from '../pinecone-generated-ts-fetch'; - -export type ListOptions = { - prefix?: string; - limit?: number; - paginationToken?: string; -}; - -const ListOptionsSchema = Type.Object( - { - prefix: Type.Optional(Type.String({ minLength: 1 })), - limit: Type.Optional(Type.Number()), - paginationToken: Type.Optional(Type.String({ minLength: 1 })), - }, - { additionalProperties: false } -); - -export const list = ( - apiProvider: DataOperationsProvider, - namespace: string -) => { - const validator = buildConfigValidator(ListOptionsSchema, 'list'); - - return async (options?: ListOptions): Promise => { - if (options) { - validator(options); - } - - const listRequest: ListRequest = { - ...options, - namespace, - }; - - const api = await apiProvider.provide(); - return await api.list(listRequest); - }; -}; From 31d2f68eb02e8bae7bf637ebfc427b7ca6270e30 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 14:19:04 -0500 Subject: [PATCH 5/6] rename VoaProvider to DataProvider in unit tests --- src/data/__tests__/deleteAll.test.ts | 4 ++-- src/data/__tests__/deleteMany.test.ts | 8 ++++---- src/data/__tests__/deleteOne.test.ts | 8 ++++---- src/data/__tests__/describeIndexStats.test.ts | 8 ++++---- src/data/__tests__/fetch.test.ts | 6 +++--- src/data/__tests__/update.test.ts | 6 +++--- src/data/__tests__/upsert.test.ts | 6 +++--- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/data/__tests__/deleteAll.test.ts b/src/data/__tests__/deleteAll.test.ts index 6476f5c2..ccce36cf 100644 --- a/src/data/__tests__/deleteAll.test.ts +++ b/src/data/__tests__/deleteAll.test.ts @@ -3,9 +3,9 @@ import { setupDeleteSuccess } from './deleteOne.test'; describe('deleteAll', () => { test('calls the openapi delete endpoint, passing deleteAll with target namespace', async () => { - const { VoaProvider, DPA } = setupDeleteSuccess(undefined); + const { DataProvider, DPA } = setupDeleteSuccess(undefined); - const deleteAllFn = deleteAll(VoaProvider, 'namespace'); + const deleteAllFn = deleteAll(DataProvider, 'namespace'); const returned = await deleteAllFn(); expect(returned).toBe(void 0); diff --git a/src/data/__tests__/deleteMany.test.ts b/src/data/__tests__/deleteMany.test.ts index 2d146c1b..3cbc08c2 100644 --- a/src/data/__tests__/deleteMany.test.ts +++ b/src/data/__tests__/deleteMany.test.ts @@ -3,9 +3,9 @@ import { setupDeleteSuccess } from './deleteOne.test'; describe('deleteMany', () => { test('calls the openapi delete endpoint, passing ids with target namespace', async () => { - const { VoaProvider, DPA } = setupDeleteSuccess(undefined); + const { DataProvider, DPA } = setupDeleteSuccess(undefined); - const deleteManyFn = deleteMany(VoaProvider, 'namespace'); + const deleteManyFn = deleteMany(DataProvider, 'namespace'); const returned = await deleteManyFn(['123', '456', '789']); expect(returned).toBe(void 0); @@ -15,9 +15,9 @@ describe('deleteMany', () => { }); test('calls the openapi delete endpoint, passing filter with target namespace', async () => { - const { DPA, VoaProvider } = setupDeleteSuccess(undefined); + const { DPA, DataProvider } = setupDeleteSuccess(undefined); - const deleteManyFn = deleteMany(VoaProvider, 'namespace'); + const deleteManyFn = deleteMany(DataProvider, 'namespace'); const returned = await deleteManyFn({ genre: 'ambient' }); expect(returned).toBe(void 0); diff --git a/src/data/__tests__/deleteOne.test.ts b/src/data/__tests__/deleteOne.test.ts index 9eda7071..8766508c 100644 --- a/src/data/__tests__/deleteOne.test.ts +++ b/src/data/__tests__/deleteOne.test.ts @@ -12,8 +12,8 @@ const setupDeleteResponse = (response, isSuccess) => { isSuccess ? Promise.resolve(response) : Promise.reject(response) ); const DPA = { _delete: fakeDelete } as DataPlaneApi; - const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; - return { DPA, VoaProvider }; + const DataProvider = { provide: async () => DPA } as DataOperationsProvider; + return { DPA, DataProvider }; }; export const setupDeleteSuccess = (response) => { return setupDeleteResponse(response, true); @@ -24,9 +24,9 @@ export const setupDeleteFailure = (response) => { describe('deleteOne', () => { test('calls the openapi delete endpoint, passing target namespace and the vector id to delete', async () => { - const { VoaProvider, DPA } = setupDeleteSuccess(undefined); + const { DataProvider, DPA } = setupDeleteSuccess(undefined); - const deleteOneFn = deleteOne(VoaProvider, 'namespace'); + const deleteOneFn = deleteOne(DataProvider, 'namespace'); const returned = await deleteOneFn('123'); expect(returned).toBe(void 0); diff --git a/src/data/__tests__/describeIndexStats.test.ts b/src/data/__tests__/describeIndexStats.test.ts index f0074532..e7bbadba 100644 --- a/src/data/__tests__/describeIndexStats.test.ts +++ b/src/data/__tests__/describeIndexStats.test.ts @@ -14,8 +14,8 @@ const setupResponse = (response, isSuccess) => { const DPA = { describeIndexStats: fakeDescribeIndexStats, } as DataPlaneApi; - const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; - return { DPA, VoaProvider }; + const DataProvider = { provide: async () => DPA } as DataOperationsProvider; + return { DPA, DataProvider }; }; const setupSuccess = (response) => { return setupResponse(response, true); @@ -23,7 +23,7 @@ const setupSuccess = (response) => { describe('describeIndexStats', () => { test('calls the openapi describe_index_stats endpoint passing filter if provided', async () => { - const { DPA, VoaProvider } = setupSuccess({ + const { DPA, DataProvider } = setupSuccess({ namespaces: { '': { vectorCount: 50 }, }, @@ -32,7 +32,7 @@ describe('describeIndexStats', () => { totalVectorCount: 50, }); - const describeIndexStatsFn = describeIndexStats(VoaProvider); + const describeIndexStatsFn = describeIndexStats(DataProvider); const returned = await describeIndexStatsFn({ filter: { genre: 'classical' }, }); diff --git a/src/data/__tests__/fetch.test.ts b/src/data/__tests__/fetch.test.ts index 7f276fdc..365f2d0d 100644 --- a/src/data/__tests__/fetch.test.ts +++ b/src/data/__tests__/fetch.test.ts @@ -13,9 +13,9 @@ const setupResponse = (response, isSuccess) => { isSuccess ? Promise.resolve(response) : Promise.reject(response) ); const DPA = { fetch: fakeFetch } as DataPlaneApi; - const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; - const cmd = new FetchCommand(VoaProvider, 'namespace'); - return { DPA, VoaProvider, cmd }; + const DataProvider = { provide: async () => DPA } as DataOperationsProvider; + const cmd = new FetchCommand(DataProvider, 'namespace'); + return { DPA, DataProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); diff --git a/src/data/__tests__/update.test.ts b/src/data/__tests__/update.test.ts index c71a8838..97d39b73 100644 --- a/src/data/__tests__/update.test.ts +++ b/src/data/__tests__/update.test.ts @@ -10,9 +10,9 @@ const setupResponse = (response, isSuccess) => { isSuccess ? Promise.resolve(response) : Promise.reject(response) ); const DPA = { update: fakeUpdate } as DataPlaneApi; - const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; - const cmd = new UpdateCommand(VoaProvider, 'namespace'); - return { fakeUpdate, DPA, VoaProvider, cmd }; + const DataProvider = { provide: async () => DPA } as DataOperationsProvider; + const cmd = new UpdateCommand(DataProvider, 'namespace'); + return { fakeUpdate, DPA, DataProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); diff --git a/src/data/__tests__/upsert.test.ts b/src/data/__tests__/upsert.test.ts index e6ef6574..fd0f2e56 100644 --- a/src/data/__tests__/upsert.test.ts +++ b/src/data/__tests__/upsert.test.ts @@ -10,10 +10,10 @@ const setupResponse = (response, isSuccess) => { isSuccess ? Promise.resolve(response) : Promise.reject(response) ); const DPA = { upsert: fakeUpsert } as DataPlaneApi; - const VoaProvider = { provide: async () => DPA } as DataOperationsProvider; - const cmd = new UpsertCommand(VoaProvider, 'namespace'); + const DataProvider = { provide: async () => DPA } as DataOperationsProvider; + const cmd = new UpsertCommand(DataProvider, 'namespace'); - return { fakeUpsert, DPA, VoaProvider, cmd }; + return { fakeUpsert, DPA, DataProvider, cmd }; }; const setupSuccess = (response) => { return setupResponse(response, true); From 5319d77d953a4fb4c9521521a33858aae03af9cc Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Thu, 22 Feb 2024 14:23:21 -0500 Subject: [PATCH 6/6] rename vectorOperationsProvider unit test file --- ...rOperationsProvider.test.ts => dataOperationsProvider.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/data/__tests__/{vectorOperationsProvider.test.ts => dataOperationsProvider.test.ts} (100%) diff --git a/src/data/__tests__/vectorOperationsProvider.test.ts b/src/data/__tests__/dataOperationsProvider.test.ts similarity index 100% rename from src/data/__tests__/vectorOperationsProvider.test.ts rename to src/data/__tests__/dataOperationsProvider.test.ts