From 7eff996727840b92ea43057e216333b9623decbe Mon Sep 17 00:00:00 2001 From: Jennifer Hamon Date: Mon, 15 Jul 2024 11:21:21 -0400 Subject: [PATCH] Add openapi code generation script and api versioning (#235) ## Problem We need a way to generate code from updated openapi specs ## Solution - Copy & modify overall approach used in python repository for similar purpose - Create new `codegen/` directory to be the home for code generation stuff - Use git submodules to get information from `apis` repo - Build using the `typescript-fetch` generator in the v7 openapi generator cli. This is the same as we have used in the past, to keep the diff somewhat small. - Build data and control planes separately and copy outputs into `src/pinecone-generated-ts-fetch` directory in source. This has been the traditional home for these generated files. - Since we're no longer mashing specs together ahead of code generation, I need to adjust import paths to find either `pinecone-generated-ts-fetch/control` or `pinecone-generated-ts-fetch/data` as appropriate - In addition to the default generated output, write a constant called `X_PINECONE_API_VERSION` in each generated module. This will be used when building header configuration with `X-Pinecone-Api-Version` for each request. ## Type of Change - [x] Infrastructure change (CI configs, etc) ## Test Plan `npm run generate:openapi` --- .gitignore | 3 +- .gitmodules | 3 + .prettierignore | 2 +- codegen/apis | 1 + codegen/build-oas.sh | 81 +++ package.json | 1 + src/control/__tests__/configureIndex.test.ts | 4 +- .../configureIndex.validation.test.ts | 4 +- .../__tests__/createCollection.test.ts | 4 +- src/control/__tests__/createIndex.test.ts | 4 +- .../__tests__/createIndex.validation.test.ts | 4 +- .../__tests__/deleteCollection.test.ts | 9 +- .../__tests__/describeCollection.test.ts | 4 +- .../__tests__/indexOperationsBuilder.test.ts | 6 +- src/control/configureIndex.ts | 2 +- src/control/createCollection.ts | 2 +- src/control/createIndex.ts | 2 +- src/control/deleteCollection.ts | 2 +- src/control/deleteIndex.ts | 2 +- src/control/describeCollection.ts | 2 +- src/control/describeIndex.ts | 5 +- src/control/indexOperationsBuilder.ts | 6 +- src/control/listCollections.ts | 2 +- src/control/listIndexes.ts | 5 +- .../__tests__/dataOperationsProvider.test.ts | 6 +- src/data/__tests__/deleteOne.test.ts | 2 +- src/data/__tests__/describeIndexStats.test.ts | 4 +- src/data/__tests__/fetch.test.ts | 4 +- src/data/__tests__/indexHostSingleton.test.ts | 5 - src/data/__tests__/list.test.ts | 2 +- src/data/__tests__/update.test.ts | 4 +- src/data/__tests__/upsert.test.ts | 4 +- src/data/dataOperationsProvider.ts | 6 +- src/data/deleteMany.ts | 2 +- src/data/index.ts | 2 +- src/data/list.ts | 5 +- src/data/types.ts | 5 +- src/data/upsert.ts | 2 +- src/errors/handling.ts | 2 +- src/errors/request.ts | 2 +- src/errors/utils.ts | 2 +- src/index.ts | 5 +- .../.openapi-generator-ignore | 23 - .../.openapi-generator/FILES | 48 -- .../.openapi-generator/VERSION | 1 - .../apis/DataPlaneApi.ts | 461 -------------- .../apis/ManageIndexesApi.ts | 412 ------------ .../control/api_version.ts | 1 + .../control/apis/InferenceApi.ts | 83 +++ .../control/apis/ManageIndexesApi.ts | 577 +++++++++++++++++ .../{ => control}/apis/index.ts | 2 +- .../{ => control}/index.ts | 1 + .../control/models/CollectionList.ts | 77 +++ .../control/models/CollectionModel.ts | 121 ++++ .../control/models/ConfigureIndexRequest.ts | 77 +++ .../models/ConfigureIndexRequestSpec.ts | 77 +++ .../models/ConfigureIndexRequestSpecPod.ts | 77 +++ .../control/models/CreateCollectionRequest.ts | 79 +++ .../control/models/CreateIndexRequest.ts | 112 ++++ .../control/models/EmbedRequest.ts | 98 +++ .../control/models/EmbedRequestInputsInner.ts | 69 ++ .../control/models/EmbedRequestParameters.ts | 77 +++ .../control/models/Embedding.ts | 65 ++ .../control/models/EmbeddingsList.ts | 101 +++ .../control/models/EmbeddingsListUsage.ts | 69 ++ .../{ => control}/models/IndexList.ts | 69 +- .../control/models/IndexModel.ts | 135 ++++ .../control/models/IndexModelSpec.ts | 88 +++ .../control/models/IndexModelStatus.ts | 91 +++ .../control/models/IndexSpec.ts | 90 +++ .../control/models/ListIndexes401Response.ts | 86 +++ .../models/ListIndexes401ResponseError.ts | 113 ++++ .../control/models/PodSpec.ts | 127 ++++ .../control/models/PodSpecMetadataConfig.ts | 69 ++ .../control/models/ServerlessSpec.ts | 86 +++ .../control/models/index.ts | 25 + .../control/runtime.ts | 519 ++++++++++++++++ .../data/api_version.ts | 1 + .../data/apis/DataPlaneApi.ts | 587 ++++++++++++++++++ .../data/apis/index.ts | 3 + src/pinecone-generated-ts-fetch/data/index.ts | 6 + .../data/models/DeleteRequest.ts | 90 +++ .../data/models/DescribeIndexStatsRequest.ts | 71 +++ .../data/models/DescribeIndexStatsResponse.ts | 113 ++++ .../data/models/FetchResponse.ts | 91 +++ .../{ => data}/models/ListItem.ts | 62 +- .../data/models/ListResponse.ts | 111 ++++ .../data/models/NamespaceSummary.ts | 65 ++ .../{ => data}/models/Pagination.ts | 62 +- .../data/models/ProtobufAny.ts | 73 +++ .../{ => data}/models/ProtobufNullValue.ts | 31 +- .../data/models/QueryRequest.ts | 155 +++++ .../data/models/QueryResponse.ts | 115 ++++ .../data/models/QueryVector.ts | 107 ++++ .../data/models/RpcStatus.ts | 93 +++ .../data/models/ScoredVector.ts | 107 ++++ .../data/models/SingleQueryResults.ts | 87 +++ .../data/models/SparseValues.ts | 75 +++ .../data/models/UpdateRequest.ts | 107 ++++ .../data/models/UpsertRequest.ts | 77 +++ .../{ => data}/models/UpsertResponse.ts | 62 +- .../data/models/Usage.ts | 65 ++ .../data/models/Vector.ts | 100 +++ .../{ => data}/models/index.ts | 19 - .../data/runtime.ts | 519 ++++++++++++++++ .../models/CollectionList.ts | 72 --- .../models/CollectionModel.ts | 120 ---- .../models/ConfigureIndexRequest.ts | 73 --- .../models/ConfigureIndexRequestSpec.ts | 73 --- .../models/ConfigureIndexRequestSpecPod.ts | 73 --- .../models/CreateCollectionRequest.ts | 75 --- .../models/CreateIndexRequest.ts | 111 ---- .../models/CreateIndexRequestSpec.ts | 90 --- .../models/CreateIndexRequestSpecPod.ts | 122 ---- ...CreateIndexRequestSpecPodMetadataConfig.ts | 65 -- .../models/DeleteRequest.ts | 91 --- .../models/DescribeIndexStatsRequest.ts | 67 -- .../models/DescribeIndexStatsResponse.ts | 98 --- .../models/ErrorResponse.ts | 82 --- .../models/ErrorResponseError.ts | 110 ---- .../models/FetchResponse.ts | 94 --- .../models/IndexModel.ts | 136 ---- .../models/IndexModelSpec.ts | 86 --- .../models/IndexModelStatus.ts | 92 --- .../models/ListResponse.ts | 108 ---- .../models/NamespaceSummary.ts | 66 -- .../models/PodSpec.ts | 125 ---- .../models/PodSpecMetadataConfig.ts | 65 -- .../models/ProtobufAny.ts | 73 --- .../models/QueryRequest.ts | 144 ----- .../models/QueryResponse.ts | 109 ---- .../models/QueryVector.ts | 105 ---- .../models/RpcStatus.ts | 88 --- .../models/ScoredVector.ts | 105 ---- .../models/ServerlessSpec.ts | 87 --- .../models/SingleQueryResults.ts | 80 --- .../models/SparseValues.ts | 75 --- .../models/UpdateRequest.ts | 105 ---- .../models/UpsertRequest.ts | 81 --- .../models/Usage.ts | 65 -- .../models/Vector.ts | 98 --- src/pinecone-generated-ts-fetch/runtime.ts | 431 ------------- src/pinecone.ts | 4 +- src/utils/middleware.ts | 5 +- src/utils/queryParamsStringify.ts | 2 +- 145 files changed, 6322 insertions(+), 4913 deletions(-) create mode 100644 .gitmodules create mode 160000 codegen/apis create mode 100755 codegen/build-oas.sh delete mode 100644 src/pinecone-generated-ts-fetch/.openapi-generator-ignore delete mode 100644 src/pinecone-generated-ts-fetch/.openapi-generator/FILES delete mode 100644 src/pinecone-generated-ts-fetch/.openapi-generator/VERSION delete mode 100644 src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts delete mode 100644 src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts create mode 100644 src/pinecone-generated-ts-fetch/control/api_version.ts create mode 100644 src/pinecone-generated-ts-fetch/control/apis/InferenceApi.ts create mode 100644 src/pinecone-generated-ts-fetch/control/apis/ManageIndexesApi.ts rename src/pinecone-generated-ts-fetch/{ => control}/apis/index.ts (70%) rename src/pinecone-generated-ts-fetch/{ => control}/index.ts (80%) create mode 100644 src/pinecone-generated-ts-fetch/control/models/CollectionList.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/CollectionModel.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpec.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpecPod.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/CreateCollectionRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/CreateIndexRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/EmbedRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/EmbedRequestInputsInner.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/EmbedRequestParameters.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/Embedding.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/EmbeddingsList.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/EmbeddingsListUsage.ts rename src/pinecone-generated-ts-fetch/{ => control}/models/IndexList.ts (50%) create mode 100644 src/pinecone-generated-ts-fetch/control/models/IndexModel.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/IndexModelSpec.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/IndexModelStatus.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/IndexSpec.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ListIndexes401Response.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ListIndexes401ResponseError.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/PodSpec.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/PodSpecMetadataConfig.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/ServerlessSpec.ts create mode 100644 src/pinecone-generated-ts-fetch/control/models/index.ts create mode 100644 src/pinecone-generated-ts-fetch/control/runtime.ts create mode 100644 src/pinecone-generated-ts-fetch/data/api_version.ts create mode 100644 src/pinecone-generated-ts-fetch/data/apis/DataPlaneApi.ts create mode 100644 src/pinecone-generated-ts-fetch/data/apis/index.ts create mode 100644 src/pinecone-generated-ts-fetch/data/index.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/DeleteRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsResponse.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/FetchResponse.ts rename src/pinecone-generated-ts-fetch/{ => data}/models/ListItem.ts (51%) create mode 100644 src/pinecone-generated-ts-fetch/data/models/ListResponse.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/NamespaceSummary.ts rename src/pinecone-generated-ts-fetch/{ => data}/models/Pagination.ts (51%) create mode 100644 src/pinecone-generated-ts-fetch/data/models/ProtobufAny.ts rename src/pinecone-generated-ts-fetch/{ => data}/models/ProtobufNullValue.ts (54%) create mode 100644 src/pinecone-generated-ts-fetch/data/models/QueryRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/QueryResponse.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/QueryVector.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/RpcStatus.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/ScoredVector.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/SingleQueryResults.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/SparseValues.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/UpdateRequest.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/UpsertRequest.ts rename src/pinecone-generated-ts-fetch/{ => data}/models/UpsertResponse.ts (50%) create mode 100644 src/pinecone-generated-ts-fetch/data/models/Usage.ts create mode 100644 src/pinecone-generated-ts-fetch/data/models/Vector.ts rename src/pinecone-generated-ts-fetch/{ => data}/models/index.ts (51%) create mode 100644 src/pinecone-generated-ts-fetch/data/runtime.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CollectionList.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CollectionModel.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/DeleteRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ErrorResponse.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/FetchResponse.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/IndexModel.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ListResponse.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/PodSpec.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ProtobufAny.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/QueryRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/QueryResponse.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/QueryVector.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/RpcStatus.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ScoredVector.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/SparseValues.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/UpdateRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/UpsertRequest.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/Usage.ts delete mode 100644 src/pinecone-generated-ts-fetch/models/Vector.ts delete mode 100644 src/pinecone-generated-ts-fetch/runtime.ts diff --git a/.gitignore b/.gitignore index c573c26b..3f727b6d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .env # Generated files +build/ coverage/ dist/ docs/ @@ -13,4 +14,4 @@ ts-compilation-test/lib/ # Clutter .vscode .DS_Store -scratch \ No newline at end of file +scratch diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..df376f56 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "codegen/apis"] + path = codegen/apis + url = git@github.com:pinecone-io/apis.git diff --git a/.prettierignore b/.prettierignore index f542d5b9..321fa6f8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,3 @@ dist node_modules -src/pinecone-generated-ts-fetch \ No newline at end of file +codegen \ No newline at end of file diff --git a/codegen/apis b/codegen/apis new file mode 160000 index 00000000..fbd9d8d4 --- /dev/null +++ b/codegen/apis @@ -0,0 +1 @@ +Subproject commit fbd9d8d48c95b12c6b28aea4e496b6f28666d2d1 diff --git a/codegen/build-oas.sh b/codegen/build-oas.sh new file mode 100755 index 00000000..e044bba5 --- /dev/null +++ b/codegen/build-oas.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -eux -o pipefail + +version=$1 # e.g. 2024-07 +modules=("control" "data") + +destination="src/pinecone-generated-ts-fetch" +build_dir="build" + +update_apis_repo() { + echo "Updating apis repo" + pushd codegen/apis + git fetch + git pull + just build + popd +} + +verify_spec_version() { + local version=$1 + echo "Verifying spec version $version exists in apis repo" + if [ -z "$version" ]; then + echo "Version is required" + exit 1 + fi + + verify_directory_exists "codegen/apis/_build/${version}" +} + +verify_file_exists() { + local filename=$1 + if [ ! -f "$filename" ]; then + echo "File does not exist at $filename" + exit 1 + fi +} + +verify_directory_exists() { + local directory=$1 + if [ ! -d "$directory" ]; then + echo "Directory does not exist at $directory" + exit 1 + fi +} + +generate_client() { + local module_name=$1 + + oas_file="codegen/apis/_build/${version}/${module_name}_${version}.oas.yaml" + + verify_file_exists $oas_file + + # Cleanup previous build files + echo "Cleaning up previous build files" + rm -rf "${build_dir}" + + # Generate client module + docker run --rm -v $(pwd):/workspace openapitools/openapi-generator-cli:v7.0.0 generate \ + --input-spec "/workspace/$oas_file" \ + --generator-name typescript-fetch \ + --output "/workspace/${build_dir}" + + # Copy the generated module to the correct location + rm -rf "${destination}/${module_name}" + mkdir -p "${destination}/${module_name}" + cp -r ${build_dir}/* "${destination}/${module_name}" + + echo "export const X_PINECONE_API_VERSION = '${version}';" > ${destination}/${module_name}/api_version.ts + echo "export * from './api_version';" >> ${destination}/${module_name}/index.ts +} + +update_apis_repo +verify_spec_version $version + +rm -rf "${destination}" +mkdir -p "${destination}" + +for module in "${modules[@]}"; do + generate_client $module +done diff --git a/package.json b/package.json index b3a9f8a6..77717d41 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build": "rm -rf dist/ && tsc", "version": "jq --null-input --arg version $npm_package_version '{\"name\": \"@pinecone-database/pinecone\", \"version\": $version}' > src/version.json", "docs:build": "typedoc --plugin ./assets/docs-theme.mjs", + "generate:openapi": "./codegen/build-oas.sh 2024-07 && npm run build && npm run format", "format": "prettier --write .", "lint": "eslint src/ --ext .ts", "repl": "npm run build && node utils/replInit.ts", diff --git a/src/control/__tests__/configureIndex.test.ts b/src/control/__tests__/configureIndex.test.ts index dfd0cf9d..499cf4ca 100644 --- a/src/control/__tests__/configureIndex.test.ts +++ b/src/control/__tests__/configureIndex.test.ts @@ -1,9 +1,9 @@ import { configureIndex } from '../configureIndex'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; import type { ConfigureIndexOperationRequest, IndexModel, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/control'; describe('configureIndex', () => { test('calls the openapi configure endpoint', async () => { diff --git a/src/control/__tests__/configureIndex.validation.test.ts b/src/control/__tests__/configureIndex.validation.test.ts index 3d5af5d6..d5b566c1 100644 --- a/src/control/__tests__/configureIndex.validation.test.ts +++ b/src/control/__tests__/configureIndex.validation.test.ts @@ -6,13 +6,13 @@ import { configureIndex } from '../configureIndex'; import { PineconeArgumentError } from '../../errors'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; describe('configureIndex argument validations', () => { let MIA: ManageIndexesApi; beforeEach(() => { MIA = { configureIndex: jest.fn() }; - jest.mock('../../pinecone-generated-ts-fetch', () => ({ + jest.mock('../../pinecone-generated-ts-fetch/control', () => ({ IndexOperationsApi: MIA, })); }); diff --git a/src/control/__tests__/createCollection.test.ts b/src/control/__tests__/createCollection.test.ts index 8d9a3a85..032bc11e 100644 --- a/src/control/__tests__/createCollection.test.ts +++ b/src/control/__tests__/createCollection.test.ts @@ -1,11 +1,11 @@ import { createCollection } from '../createCollection'; import { PineconeArgumentError } from '../../errors'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; import type { CollectionModel, CreateCollectionOperationRequest, IndexList, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/control'; const setOpenAPIResponse = (fakeCreateCollectionResponse) => { const fakeCreateCollection: ( diff --git a/src/control/__tests__/createIndex.test.ts b/src/control/__tests__/createIndex.test.ts index a94225e9..ee166b9d 100644 --- a/src/control/__tests__/createIndex.test.ts +++ b/src/control/__tests__/createIndex.test.ts @@ -1,10 +1,10 @@ import { createIndex } from '../createIndex'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; import type { CreateIndexOperationRequest, DescribeIndexRequest, IndexModel, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/control'; // describeIndexResponse can either be a single response, or an array of responses for testing polling scenarios const setupCreateIndexResponse = ( diff --git a/src/control/__tests__/createIndex.validation.test.ts b/src/control/__tests__/createIndex.validation.test.ts index 88293d82..c1ce013e 100644 --- a/src/control/__tests__/createIndex.validation.test.ts +++ b/src/control/__tests__/createIndex.validation.test.ts @@ -6,13 +6,13 @@ import { createIndex } from '../createIndex'; import { PineconeArgumentError } from '../../errors'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; describe('createIndex argument validations', () => { let MIA: ManageIndexesApi; beforeEach(() => { MIA = { createIndex: jest.fn() }; - jest.mock('../../pinecone-generated-ts-fetch', () => ({ + jest.mock('../../pinecone-generated-ts-fetch/control', () => ({ ManageIndexesApi: MIA, })); }); diff --git a/src/control/__tests__/deleteCollection.test.ts b/src/control/__tests__/deleteCollection.test.ts index f013c089..748e046a 100644 --- a/src/control/__tests__/deleteCollection.test.ts +++ b/src/control/__tests__/deleteCollection.test.ts @@ -1,18 +1,17 @@ import { deleteCollection } from '../deleteCollection'; import { PineconeArgumentError } from '../../errors'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; import type { DeleteCollectionRequest, CollectionList, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/control'; const setupMocks = ( deleteResponse, listCollectionResponse = () => Promise.resolve([]) ) => { - const fakeDeleteCollection: ( - req: DeleteCollectionRequest - ) => Promise = jest.fn().mockImplementation(deleteResponse); + const fakeDeleteCollection: (req: DeleteCollectionRequest) => Promise = + jest.fn().mockImplementation(deleteResponse); const fakeListCollections: () => Promise = jest .fn() .mockImplementation(listCollectionResponse); diff --git a/src/control/__tests__/describeCollection.test.ts b/src/control/__tests__/describeCollection.test.ts index 45b494ed..155b1ac4 100644 --- a/src/control/__tests__/describeCollection.test.ts +++ b/src/control/__tests__/describeCollection.test.ts @@ -1,11 +1,11 @@ import { describeCollection } from '../describeCollection'; import { PineconeArgumentError } from '../../errors'; -import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../../pinecone-generated-ts-fetch/control'; import type { DescribeCollectionRequest, CollectionList, CollectionModel, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/control'; const setupMocks = ( describeResponse, diff --git a/src/control/__tests__/indexOperationsBuilder.test.ts b/src/control/__tests__/indexOperationsBuilder.test.ts index 7aab28fa..6834725b 100644 --- a/src/control/__tests__/indexOperationsBuilder.test.ts +++ b/src/control/__tests__/indexOperationsBuilder.test.ts @@ -1,8 +1,8 @@ import { indexOperationsBuilder } from '../indexOperationsBuilder'; -import { Configuration } from '../../pinecone-generated-ts-fetch'; +import { Configuration } from '../../pinecone-generated-ts-fetch/control'; -jest.mock('../../pinecone-generated-ts-fetch', () => ({ - ...jest.requireActual('../../pinecone-generated-ts-fetch'), +jest.mock('../../pinecone-generated-ts-fetch/control', () => ({ + ...jest.requireActual('../../pinecone-generated-ts-fetch/control'), Configuration: jest.fn(), })); diff --git a/src/control/configureIndex.ts b/src/control/configureIndex.ts index 3ed54363..28f748ff 100644 --- a/src/control/configureIndex.ts +++ b/src/control/configureIndex.ts @@ -2,7 +2,7 @@ import { ManageIndexesApi, IndexModel, ConfigureIndexRequestSpecPod, -} from '../pinecone-generated-ts-fetch'; +} from '../pinecone-generated-ts-fetch/control'; import { PineconeArgumentError } from '../errors'; import { buildValidator } from '../validator'; import type { IndexName } from './types'; diff --git a/src/control/createCollection.ts b/src/control/createCollection.ts index 76ee7306..93d27548 100644 --- a/src/control/createCollection.ts +++ b/src/control/createCollection.ts @@ -2,7 +2,7 @@ import { CollectionModel, CreateCollectionRequest, ManageIndexesApi, -} from '../pinecone-generated-ts-fetch'; +} from '../pinecone-generated-ts-fetch/control'; import { buildConfigValidator } from '../validator'; import { CollectionNameSchema, IndexNameSchema } from './types'; import { Type } from '@sinclair/typebox'; diff --git a/src/control/createIndex.ts b/src/control/createIndex.ts index 68445561..70b480d1 100644 --- a/src/control/createIndex.ts +++ b/src/control/createIndex.ts @@ -3,7 +3,7 @@ import { IndexModel, ManageIndexesApi, CreateIndexRequestMetricEnum, -} from '../pinecone-generated-ts-fetch'; +} from '../pinecone-generated-ts-fetch/control'; import { buildConfigValidator } from '../validator'; import { debugLog } from '../utils'; import { handleApiError } from '../errors'; diff --git a/src/control/deleteCollection.ts b/src/control/deleteCollection.ts index 71aaccb2..d79c7cf3 100644 --- a/src/control/deleteCollection.ts +++ b/src/control/deleteCollection.ts @@ -1,4 +1,4 @@ -import { ManageIndexesApi } from '../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../pinecone-generated-ts-fetch/control'; import { buildConfigValidator } from '../validator'; import { CollectionNameSchema } from './types'; import type { CollectionName } from './types'; diff --git a/src/control/deleteIndex.ts b/src/control/deleteIndex.ts index 250c7d37..9f6de7c1 100644 --- a/src/control/deleteIndex.ts +++ b/src/control/deleteIndex.ts @@ -1,4 +1,4 @@ -import { ManageIndexesApi } from '../pinecone-generated-ts-fetch'; +import { ManageIndexesApi } from '../pinecone-generated-ts-fetch/control'; import { buildConfigValidator } from '../validator'; import { IndexName, IndexNameSchema } from './types'; diff --git a/src/control/describeCollection.ts b/src/control/describeCollection.ts index 91ea3fe9..0819ab04 100644 --- a/src/control/describeCollection.ts +++ b/src/control/describeCollection.ts @@ -1,7 +1,7 @@ import { ManageIndexesApi, CollectionModel, -} from '../pinecone-generated-ts-fetch'; +} from '../pinecone-generated-ts-fetch/control'; import { buildConfigValidator } from '../validator'; import { CollectionNameSchema } from './types'; import type { CollectionName } from './types'; diff --git a/src/control/describeIndex.ts b/src/control/describeIndex.ts index 81628ebc..aae53426 100644 --- a/src/control/describeIndex.ts +++ b/src/control/describeIndex.ts @@ -1,5 +1,8 @@ import { buildConfigValidator } from '../validator'; -import { IndexModel, ManageIndexesApi } from '../pinecone-generated-ts-fetch'; +import { + IndexModel, + ManageIndexesApi, +} from '../pinecone-generated-ts-fetch/control'; import { IndexNameSchema } from './types'; import type { IndexName } from './types'; diff --git a/src/control/indexOperationsBuilder.ts b/src/control/indexOperationsBuilder.ts index b8cb71aa..37eed670 100644 --- a/src/control/indexOperationsBuilder.ts +++ b/src/control/indexOperationsBuilder.ts @@ -1,7 +1,8 @@ import { ManageIndexesApi, Configuration, -} from '../pinecone-generated-ts-fetch'; + X_PINECONE_API_VERSION, +} from '../pinecone-generated-ts-fetch/control'; import { queryParamsStringify, buildUserAgent, @@ -10,7 +11,7 @@ import { } from '../utils'; import { middleware } from '../utils/middleware'; import type { PineconeConfiguration } from '../data/types'; -import type { ConfigurationParameters as IndexOperationsApiConfigurationParameters } from '../pinecone-generated-ts-fetch'; +import type { ConfigurationParameters as IndexOperationsApiConfigurationParameters } from '../pinecone-generated-ts-fetch/control'; export const indexOperationsBuilder = ( config: PineconeConfiguration @@ -25,6 +26,7 @@ export const indexOperationsBuilder = ( queryParamsStringify, headers: { 'User-Agent': buildUserAgent(config), + 'X-Pinecone-Api-Version': X_PINECONE_API_VERSION, ...headers, }, fetchApi: getFetch(config), diff --git a/src/control/listCollections.ts b/src/control/listCollections.ts index b8b66de6..3ef94a47 100644 --- a/src/control/listCollections.ts +++ b/src/control/listCollections.ts @@ -1,7 +1,7 @@ import { ManageIndexesApi, CollectionList, -} from '../pinecone-generated-ts-fetch'; +} from '../pinecone-generated-ts-fetch/control'; export const listCollections = (api: ManageIndexesApi) => { return async (): Promise => { diff --git a/src/control/listIndexes.ts b/src/control/listIndexes.ts index b60deea9..0f480b9c 100644 --- a/src/control/listIndexes.ts +++ b/src/control/listIndexes.ts @@ -1,4 +1,7 @@ -import { ManageIndexesApi, IndexList } from '../pinecone-generated-ts-fetch'; +import { + ManageIndexesApi, + IndexList, +} from '../pinecone-generated-ts-fetch/control'; export const listIndexes = (api: ManageIndexesApi) => { return async (): Promise => { diff --git a/src/data/__tests__/dataOperationsProvider.test.ts b/src/data/__tests__/dataOperationsProvider.test.ts index c21f4386..3134e012 100644 --- a/src/data/__tests__/dataOperationsProvider.test.ts +++ b/src/data/__tests__/dataOperationsProvider.test.ts @@ -1,9 +1,9 @@ import { DataOperationsProvider } from '../dataOperationsProvider'; import { IndexHostSingleton } from '../indexHostSingleton'; -import { Configuration } from '../../pinecone-generated-ts-fetch'; +import { Configuration } from '../../pinecone-generated-ts-fetch/data'; -jest.mock('../../pinecone-generated-ts-fetch', () => ({ - ...jest.requireActual('../../pinecone-generated-ts-fetch'), +jest.mock('../../pinecone-generated-ts-fetch/data', () => ({ + ...jest.requireActual('../../pinecone-generated-ts-fetch/data'), Configuration: jest.fn(), })); diff --git a/src/data/__tests__/deleteOne.test.ts b/src/data/__tests__/deleteOne.test.ts index 8766508c..1096b516 100644 --- a/src/data/__tests__/deleteOne.test.ts +++ b/src/data/__tests__/deleteOne.test.ts @@ -2,7 +2,7 @@ import { deleteOne } from '../deleteOne'; import type { DeleteOperationRequest, DataPlaneApi, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; const setupDeleteResponse = (response, isSuccess) => { diff --git a/src/data/__tests__/describeIndexStats.test.ts b/src/data/__tests__/describeIndexStats.test.ts index e7bbadba..73bc5a85 100644 --- a/src/data/__tests__/describeIndexStats.test.ts +++ b/src/data/__tests__/describeIndexStats.test.ts @@ -1,7 +1,7 @@ import { describeIndexStats } from '../describeIndexStats'; -import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; -import type { DescribeIndexStatsOperationRequest } from '../../pinecone-generated-ts-fetch'; +import type { DescribeIndexStatsOperationRequest } from '../../pinecone-generated-ts-fetch/data'; const setupResponse = (response, isSuccess) => { const fakeDescribeIndexStats: ( diff --git a/src/data/__tests__/fetch.test.ts b/src/data/__tests__/fetch.test.ts index 365f2d0d..76653e3c 100644 --- a/src/data/__tests__/fetch.test.ts +++ b/src/data/__tests__/fetch.test.ts @@ -1,10 +1,10 @@ import { FetchCommand } from '../fetch'; -import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; import type { FetchRequest, FetchResponse, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/data'; const setupResponse = (response, isSuccess) => { const fakeFetch: (req: FetchRequest) => Promise = jest diff --git a/src/data/__tests__/indexHostSingleton.test.ts b/src/data/__tests__/indexHostSingleton.test.ts index f23f9b1d..1391f208 100644 --- a/src/data/__tests__/indexHostSingleton.test.ts +++ b/src/data/__tests__/indexHostSingleton.test.ts @@ -173,11 +173,6 @@ describe('IndexHostSingleton', () => { expect(mockDescribeIndex).toHaveBeenNthCalledWith(1, 'index-1'); expect(mockDescribeIndex).toHaveBeenNthCalledWith(2, 'index-2'); - console.log( - 'mockIndexOperationsBuilder', - JSON.stringify(mockIndexOperationsBuilder.mock) - ); - expect(mockIndexOperationsBuilder).toHaveBeenCalledTimes(2); expect(mockIndexOperationsBuilder).toHaveBeenNthCalledWith( 1, diff --git a/src/data/__tests__/list.test.ts b/src/data/__tests__/list.test.ts index bf29f4b7..6ce32573 100644 --- a/src/data/__tests__/list.test.ts +++ b/src/data/__tests__/list.test.ts @@ -3,7 +3,7 @@ import type { ListRequest, ListResponse, DataPlaneApi, -} from '../../pinecone-generated-ts-fetch'; +} from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; const setupListResponse = (response, isSuccess = true) => { diff --git a/src/data/__tests__/update.test.ts b/src/data/__tests__/update.test.ts index 97d39b73..f854baac 100644 --- a/src/data/__tests__/update.test.ts +++ b/src/data/__tests__/update.test.ts @@ -1,7 +1,7 @@ import { UpdateCommand } from '../update'; -import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; -import type { UpdateOperationRequest } from '../../pinecone-generated-ts-fetch'; +import type { UpdateOperationRequest } from '../../pinecone-generated-ts-fetch/data'; const setupResponse = (response, isSuccess) => { const fakeUpdate: (req: UpdateOperationRequest) => Promise = jest diff --git a/src/data/__tests__/upsert.test.ts b/src/data/__tests__/upsert.test.ts index fd0f2e56..9e97e60a 100644 --- a/src/data/__tests__/upsert.test.ts +++ b/src/data/__tests__/upsert.test.ts @@ -1,6 +1,6 @@ import { UpsertCommand } from '../upsert'; -import { DataPlaneApi } from '../../pinecone-generated-ts-fetch'; -import type { UpsertOperationRequest } from '../../pinecone-generated-ts-fetch'; +import { DataPlaneApi } from '../../pinecone-generated-ts-fetch/data'; +import type { UpsertOperationRequest } from '../../pinecone-generated-ts-fetch/data'; import { DataOperationsProvider } from '../dataOperationsProvider'; const setupResponse = (response, isSuccess) => { diff --git a/src/data/dataOperationsProvider.ts b/src/data/dataOperationsProvider.ts index 71d8c74a..8798a0a2 100644 --- a/src/data/dataOperationsProvider.ts +++ b/src/data/dataOperationsProvider.ts @@ -3,8 +3,9 @@ import { Configuration, ConfigurationParameters, DataPlaneApi, -} from '../pinecone-generated-ts-fetch'; -import type { HTTPHeaders } from '../pinecone-generated-ts-fetch'; + X_PINECONE_API_VERSION, +} from '../pinecone-generated-ts-fetch/data'; +import type { HTTPHeaders } from '../pinecone-generated-ts-fetch/data'; import { queryParamsStringify, buildUserAgent, @@ -63,6 +64,7 @@ export class DataOperationsProvider { queryParamsStringify, headers: { 'User-Agent': buildUserAgent(this.config), + 'X-Pinecone-Api-Version': X_PINECONE_API_VERSION, ...headers, }, fetchApi: getFetch(this.config), diff --git a/src/data/deleteMany.ts b/src/data/deleteMany.ts index 821cbf31..30daffd4 100644 --- a/src/data/deleteMany.ts +++ b/src/data/deleteMany.ts @@ -1,7 +1,7 @@ import { DataOperationsProvider } from './dataOperationsProvider'; import { buildConfigValidator } from '../validator'; import { Type } from '@sinclair/typebox'; -import type { DeleteRequest } from '../pinecone-generated-ts-fetch/models/DeleteRequest'; +import type { DeleteRequest } from '../pinecone-generated-ts-fetch/data/models/DeleteRequest'; import { RecordIdSchema } from './types'; import type { RecordId } from './types'; diff --git a/src/data/index.ts b/src/data/index.ts index 789ab007..10a52f1d 100644 --- a/src/data/index.ts +++ b/src/data/index.ts @@ -14,7 +14,7 @@ import { describeIndexStats } from './describeIndexStats'; import { DataOperationsProvider } from './dataOperationsProvider'; import { listPaginated } from './list'; import type { ListOptions } from './list'; -import type { HTTPHeaders } from '../pinecone-generated-ts-fetch'; +import type { HTTPHeaders } from '../pinecone-generated-ts-fetch/data'; import type { PineconeConfiguration, RecordMetadata, diff --git a/src/data/list.ts b/src/data/list.ts index 6ee8302d..106e042a 100644 --- a/src/data/list.ts +++ b/src/data/list.ts @@ -1,7 +1,10 @@ import { buildConfigValidator } from '../validator'; import { Type } from '@sinclair/typebox'; import { DataOperationsProvider } from './dataOperationsProvider'; -import type { ListRequest, ListResponse } from '../pinecone-generated-ts-fetch'; +import type { + ListRequest, + ListResponse, +} from '../pinecone-generated-ts-fetch/data'; /** * See [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids) diff --git a/src/data/types.ts b/src/data/types.ts index 3251c1f6..6712ffc5 100644 --- a/src/data/types.ts +++ b/src/data/types.ts @@ -1,5 +1,8 @@ import { Type } from '@sinclair/typebox'; -import type { FetchAPI, HTTPHeaders } from '../pinecone-generated-ts-fetch'; +import type { + FetchAPI, + HTTPHeaders, +} from '../pinecone-generated-ts-fetch/data'; export const PineconeConfigurationSchema = Type.Object( { diff --git a/src/data/upsert.ts b/src/data/upsert.ts index 6a072cbd..29ac815b 100644 --- a/src/data/upsert.ts +++ b/src/data/upsert.ts @@ -2,7 +2,7 @@ import { buildConfigValidator } from '../validator'; import { PineconeRecordSchema } from './types'; import { Type } from '@sinclair/typebox'; import { DataOperationsProvider } from './dataOperationsProvider'; -import type { Vector } from '../pinecone-generated-ts-fetch'; +import type { Vector } from '../pinecone-generated-ts-fetch/data'; import type { PineconeRecord, RecordMetadata } from './types'; const RecordArray = Type.Array(PineconeRecordSchema); diff --git a/src/errors/handling.ts b/src/errors/handling.ts index 80e4375b..6b75d59e 100644 --- a/src/errors/handling.ts +++ b/src/errors/handling.ts @@ -1,7 +1,7 @@ import { extractMessage } from './utils'; import { mapHttpStatusError } from './http'; import { PineconeConnectionError } from './request'; -import type { ResponseError } from '../pinecone-generated-ts-fetch'; +import type { ResponseError } from '../pinecone-generated-ts-fetch/control'; /** @internal */ export const handleApiError = async ( diff --git a/src/errors/request.ts b/src/errors/request.ts index 6a1c8f36..0c84172a 100644 --- a/src/errors/request.ts +++ b/src/errors/request.ts @@ -1,5 +1,5 @@ import { BasePineconeError } from './base'; -import type { ErrorContext } from '../pinecone-generated-ts-fetch'; +import type { ErrorContext } from '../pinecone-generated-ts-fetch/control'; /** * This error is thrown when the client attempts to make a diff --git a/src/errors/utils.ts b/src/errors/utils.ts index 97b46b6d..c75a4faf 100644 --- a/src/errors/utils.ts +++ b/src/errors/utils.ts @@ -1,4 +1,4 @@ -import type { ResponseError } from '../pinecone-generated-ts-fetch'; +import type { ResponseError } from '../pinecone-generated-ts-fetch/control'; /** @internal */ export const extractMessage = async (error: ResponseError): Promise => { diff --git a/src/index.ts b/src/index.ts index 7cc19178..ca5922b0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -39,6 +39,7 @@ export type { RecordValues, ScoredPineconeRecord, } from './data'; + export type { CollectionList, CollectionModel, @@ -51,9 +52,9 @@ export type { FetchAPI, IndexList, IndexModel, - ListResponse, ServerlessSpec, ServerlessSpecCloudEnum, PodSpec, PodSpecMetadataConfig, -} from './pinecone-generated-ts-fetch'; +} from './pinecone-generated-ts-fetch/control'; +export type { ListResponse } from './pinecone-generated-ts-fetch/data'; diff --git a/src/pinecone-generated-ts-fetch/.openapi-generator-ignore b/src/pinecone-generated-ts-fetch/.openapi-generator-ignore deleted file mode 100644 index 7484ee59..00000000 --- a/src/pinecone-generated-ts-fetch/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES b/src/pinecone-generated-ts-fetch/.openapi-generator/FILES deleted file mode 100644 index 74882718..00000000 --- a/src/pinecone-generated-ts-fetch/.openapi-generator/FILES +++ /dev/null @@ -1,48 +0,0 @@ -.openapi-generator-ignore -apis/DataPlaneApi.ts -apis/ManageIndexesApi.ts -apis/index.ts -index.ts -models/CollectionList.ts -models/CollectionModel.ts -models/ConfigureIndexRequest.ts -models/ConfigureIndexRequestSpec.ts -models/ConfigureIndexRequestSpecPod.ts -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/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 -models/ProtobufNullValue.ts -models/QueryRequest.ts -models/QueryResponse.ts -models/QueryVector.ts -models/RpcStatus.ts -models/ScoredVector.ts -models/ServerlessSpec.ts -models/SingleQueryResults.ts -models/SparseValues.ts -models/UpdateRequest.ts -models/UpsertRequest.ts -models/UpsertResponse.ts -models/Usage.ts -models/Vector.ts -models/index.ts -runtime.ts diff --git a/src/pinecone-generated-ts-fetch/.openapi-generator/VERSION b/src/pinecone-generated-ts-fetch/.openapi-generator/VERSION deleted file mode 100644 index 41225218..00000000 --- a/src/pinecone-generated-ts-fetch/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.0.0 \ No newline at end of file diff --git a/src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts b/src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts deleted file mode 100644 index e99a45d7..00000000 --- a/src/pinecone-generated-ts-fetch/apis/DataPlaneApi.ts +++ /dev/null @@ -1,461 +0,0 @@ -/* 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 * as runtime from '../runtime'; -import type { - DeleteRequest, - DescribeIndexStatsRequest, - DescribeIndexStatsResponse, - FetchResponse, - ListResponse, - QueryRequest, - QueryResponse, - RpcStatus, - UpdateRequest, - UpsertRequest, - UpsertResponse, -} from '../models/index'; -import { - DeleteRequestFromJSON, - DeleteRequestToJSON, - DescribeIndexStatsRequestFromJSON, - DescribeIndexStatsRequestToJSON, - DescribeIndexStatsResponseFromJSON, - DescribeIndexStatsResponseToJSON, - FetchResponseFromJSON, - FetchResponseToJSON, - ListResponseFromJSON, - ListResponseToJSON, - QueryRequestFromJSON, - QueryRequestToJSON, - QueryResponseFromJSON, - QueryResponseToJSON, - RpcStatusFromJSON, - RpcStatusToJSON, - UpdateRequestFromJSON, - UpdateRequestToJSON, - UpsertRequestFromJSON, - UpsertRequestToJSON, - UpsertResponseFromJSON, - UpsertResponseToJSON, -} from '../models/index'; - -export interface DeleteOperationRequest { - deleteRequest: DeleteRequest; -} - -export interface AltDeleteRequest { - ids?: Array; - deleteAll?: boolean; - namespace?: string; -} - -export interface DescribeIndexStatsOperationRequest { - describeIndexStatsRequest: DescribeIndexStatsRequest; -} - -export interface FetchRequest { - ids: Array; - namespace?: string; -} - -export interface ListRequest { - prefix?: string; - limit?: number; - paginationToken?: string; - namespace?: string; -} - -export interface QueryOperationRequest { - queryRequest: QueryRequest; -} - -export interface UpdateOperationRequest { - updateRequest: UpdateRequest; -} - -export interface UpsertOperationRequest { - upsertRequest: UpsertRequest; -} - -/** - * - */ -export class DataPlaneApi extends runtime.BaseAPI { - - /** - * 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) { - throw new runtime.RequiredError('deleteRequest','Required parameter requestParameters.deleteRequest was null or undefined when calling _delete.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/delete`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DeleteRequestToJSON(requestParameters.deleteRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * The `delete` operation deletes vectors, by id, from a single namespace. 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); - return await response.value(); - } - - /** - * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/delete) instead. - * Delete vectors - */ - async altDeleteRaw(requestParameters: AltDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids; - } - - if (requestParameters.deleteAll !== undefined) { - queryParameters['deleteAll'] = requestParameters.deleteAll; - } - - if (requestParameters.namespace !== undefined) { - queryParameters['namespace'] = requestParameters.namespace; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/delete`, - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/delete) instead. - * Delete vectors - */ - async altDelete(requestParameters: AltDeleteRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.altDeleteRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/describe_index_stats) instead. - * Get index stats - */ - async altDescribeIndexStatsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/describe_index_stats`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DescribeIndexStatsResponseFromJSON(jsonValue)); - } - - /** - * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/describe_index_stats) instead. - * Get index stats - */ - async altDescribeIndexStats(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.altDescribeIndexStatsRaw(initOverrides); - return await response.value(); - } - - /** - * 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 describeIndexStatsRaw(requestParameters: DescribeIndexStatsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.describeIndexStatsRequest === null || requestParameters.describeIndexStatsRequest === undefined) { - throw new runtime.RequiredError('describeIndexStatsRequest','Required parameter requestParameters.describeIndexStatsRequest was null or undefined when calling describeIndexStats.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/describe_index_stats`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: DescribeIndexStatsRequestToJSON(requestParameters.describeIndexStatsRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => DescribeIndexStatsResponseFromJSON(jsonValue)); - } - - /** - * The `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 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. For guidance and examples, see [Fetch data](https://docs.pinecone.io/docs/fetch-data). - * Fetch vectors - */ - async fetchRaw(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.ids === null || requestParameters.ids === undefined) { - throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling fetch.'); - } - - const queryParameters: any = {}; - - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids; - } - - if (requestParameters.namespace !== undefined) { - queryParameters['namespace'] = requestParameters.namespace; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/fetch`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => FetchResponseFromJSON(jsonValue)); - } - - /** - * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/docs/fetch-data). - * Fetch vectors - */ - async fetch(requestParameters: FetchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.fetchRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('queryRequest','Required parameter requestParameters.queryRequest was null or undefined when calling query.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/query`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: QueryRequestToJSON(requestParameters.queryRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => QueryResponseFromJSON(jsonValue)); - } - - /** - * The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 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); - return await response.value(); - } - - /** - * 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/docs/update-data). - * Update a vector - */ - async updateRaw(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updateRequest === null || requestParameters.updateRequest === undefined) { - throw new runtime.RequiredError('updateRequest','Required parameter requestParameters.updateRequest was null or undefined when calling update.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/update`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UpdateRequestToJSON(requestParameters.updateRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * The `update` operation updates 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/docs/update-data). - * Update a vector - */ - async update(requestParameters: UpdateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. 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) { - throw new runtime.RequiredError('upsertRequest','Required parameter requestParameters.upsertRequest was null or undefined when calling upsert.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/vectors/upsert`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: UpsertRequestToJSON(requestParameters.upsertRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => UpsertResponseFromJSON(jsonValue)); - } - - /** - * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. 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); - return await response.value(); - } - -} diff --git a/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts b/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts deleted file mode 100644 index a8cfbdb2..00000000 --- a/src/pinecone-generated-ts-fetch/apis/ManageIndexesApi.ts +++ /dev/null @@ -1,412 +0,0 @@ -/* 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 * as runtime from '../runtime'; -import type { - CollectionList, - CollectionModel, - ConfigureIndexRequest, - CreateCollectionRequest, - CreateIndexRequest, - ErrorResponse, - IndexList, - IndexModel, -} from '../models/index'; -import { - CollectionListFromJSON, - CollectionListToJSON, - CollectionModelFromJSON, - CollectionModelToJSON, - ConfigureIndexRequestFromJSON, - ConfigureIndexRequestToJSON, - CreateCollectionRequestFromJSON, - CreateCollectionRequestToJSON, - CreateIndexRequestFromJSON, - CreateIndexRequestToJSON, - ErrorResponseFromJSON, - ErrorResponseToJSON, - IndexListFromJSON, - IndexListToJSON, - IndexModelFromJSON, - IndexModelToJSON, -} from '../models/index'; - -export interface ConfigureIndexOperationRequest { - indexName: string; - configureIndexRequest: ConfigureIndexRequest; -} - -export interface CreateCollectionOperationRequest { - createCollectionRequest: CreateCollectionRequest; -} - -export interface CreateIndexOperationRequest { - createIndexRequest: CreateIndexRequest; -} - -export interface DeleteCollectionRequest { - collectionName: string; -} - -export interface DeleteIndexRequest { - indexName: string; -} - -export interface DescribeCollectionRequest { - collectionName: string; -} - -export interface DescribeIndexRequest { - indexName: string; -} - -/** - * - */ -export class ManageIndexesApi extends runtime.BaseAPI { - - /** - * 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) { - throw new runtime.RequiredError('indexName','Required parameter requestParameters.indexName was null or undefined when calling configureIndex.'); - } - - if (requestParameters.configureIndexRequest === null || requestParameters.configureIndexRequest === undefined) { - throw new runtime.RequiredError('configureIndexRequest','Required parameter requestParameters.configureIndexRequest was null or undefined when calling configureIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/indexes/{index_name}`.replace(`{${"index_name"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: ConfigureIndexRequestToJSON(requestParameters.configureIndexRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => IndexModelFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('createCollectionRequest','Required parameter requestParameters.createCollectionRequest was null or undefined when calling createCollection.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateCollectionRequestToJSON(requestParameters.createCollectionRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CollectionModelFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('createIndexRequest','Required parameter requestParameters.createIndexRequest was null or undefined when calling createIndex.'); - } - - 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: `/indexes`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: CreateIndexRequestToJSON(requestParameters.createIndexRequest), - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => IndexModelFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('collectionName','Required parameter requestParameters.collectionName was null or undefined when calling deleteCollection.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections/{collection_name}`.replace(`{${"collection_name"}}`, encodeURIComponent(String(requestParameters.collectionName))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - if (this.isJsonMime(response.headers.get('content-type'))) { - return new runtime.JSONApiResponse(response); - } else { - return new runtime.TextApiResponse(response) as any; - } - } - - /** - * 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); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('indexName','Required parameter requestParameters.indexName was null or undefined when calling deleteIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/indexes/{index_name}`.replace(`{${"index_name"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.VoidApiResponse(response); - } - - /** - * 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. 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) { - throw new runtime.RequiredError('collectionName','Required parameter requestParameters.collectionName was null or undefined when calling describeCollection.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections/{collection_name}`.replace(`{${"collection_name"}}`, encodeURIComponent(String(requestParameters.collectionName))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CollectionModelFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * 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) { - throw new runtime.RequiredError('indexName','Required parameter requestParameters.indexName was null or undefined when calling describeIndex.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/indexes/{index_name}`.replace(`{${"index_name"}}`, encodeURIComponent(String(requestParameters.indexName))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => IndexModelFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * 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 = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/collections`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => CollectionListFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - - /** - * This operation returns a list of all indexes in a project. - * List indexes - */ - async listIndexesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Api-Key"] = this.configuration.apiKey("Api-Key"); // ApiKeyAuth authentication - } - - const response = await this.request({ - path: `/indexes`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response, (jsonValue) => IndexListFromJSON(jsonValue)); - } - - /** - * 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); - return await response.value(); - } - -} diff --git a/src/pinecone-generated-ts-fetch/control/api_version.ts b/src/pinecone-generated-ts-fetch/control/api_version.ts new file mode 100644 index 00000000..d0567824 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/api_version.ts @@ -0,0 +1 @@ +export const X_PINECONE_API_VERSION = '2024-07'; diff --git a/src/pinecone-generated-ts-fetch/control/apis/InferenceApi.ts b/src/pinecone-generated-ts-fetch/control/apis/InferenceApi.ts new file mode 100644 index 00000000..3fb329d0 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/apis/InferenceApi.ts @@ -0,0 +1,83 @@ +/* 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import * as runtime from '../runtime'; +import type { + EmbedRequest, + EmbeddingsList, + ListIndexes401Response, +} from '../models/index'; +import { + EmbedRequestFromJSON, + EmbedRequestToJSON, + EmbeddingsListFromJSON, + EmbeddingsListToJSON, + ListIndexes401ResponseFromJSON, + ListIndexes401ResponseToJSON, +} from '../models/index'; + +export interface EmbedOperationRequest { + embedRequest?: EmbedRequest; +} + +/** + * + */ +export class InferenceApi extends runtime.BaseAPI { + /** + * Generate embeddings for input data + * Embed data + */ + async embedRaw( + requestParameters: EmbedOperationRequest, + 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: `/embed`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: EmbedRequestToJSON(requestParameters.embedRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + EmbeddingsListFromJSON(jsonValue) + ); + } + + /** + * Generate embeddings for input data + * Embed data + */ + async embed( + requestParameters: EmbedOperationRequest = {}, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.embedRaw(requestParameters, initOverrides); + return await response.value(); + } +} diff --git a/src/pinecone-generated-ts-fetch/control/apis/ManageIndexesApi.ts b/src/pinecone-generated-ts-fetch/control/apis/ManageIndexesApi.ts new file mode 100644 index 00000000..aec84d36 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/apis/ManageIndexesApi.ts @@ -0,0 +1,577 @@ +/* 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import * as runtime from '../runtime'; +import type { + CollectionList, + CollectionModel, + ConfigureIndexRequest, + CreateCollectionRequest, + CreateIndexRequest, + IndexList, + IndexModel, + ListIndexes401Response, +} from '../models/index'; +import { + CollectionListFromJSON, + CollectionListToJSON, + CollectionModelFromJSON, + CollectionModelToJSON, + ConfigureIndexRequestFromJSON, + ConfigureIndexRequestToJSON, + CreateCollectionRequestFromJSON, + CreateCollectionRequestToJSON, + CreateIndexRequestFromJSON, + CreateIndexRequestToJSON, + IndexListFromJSON, + IndexListToJSON, + IndexModelFromJSON, + IndexModelToJSON, + ListIndexes401ResponseFromJSON, + ListIndexes401ResponseToJSON, +} from '../models/index'; + +export interface ConfigureIndexOperationRequest { + indexName: string; + configureIndexRequest: ConfigureIndexRequest; +} + +export interface CreateCollectionOperationRequest { + createCollectionRequest: CreateCollectionRequest; +} + +export interface CreateIndexOperationRequest { + createIndexRequest: CreateIndexRequest; +} + +export interface DeleteCollectionRequest { + collectionName: string; +} + +export interface DeleteIndexRequest { + indexName: string; +} + +export interface DescribeCollectionRequest { + collectionName: string; +} + +export interface DescribeIndexRequest { + indexName: string; +} + +/** + * + */ +export class ManageIndexesApi extends runtime.BaseAPI { + /** + * 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 + ) { + throw new runtime.RequiredError( + 'indexName', + 'Required parameter requestParameters.indexName was null or undefined when calling configureIndex.' + ); + } + + if ( + requestParameters.configureIndexRequest === null || + requestParameters.configureIndexRequest === undefined + ) { + throw new runtime.RequiredError( + 'configureIndexRequest', + 'Required parameter requestParameters.configureIndexRequest was null or undefined when calling configureIndex.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/indexes/{index_name}`.replace( + `{${'index_name'}}`, + encodeURIComponent(String(requestParameters.indexName)) + ), + method: 'PATCH', + headers: headerParameters, + query: queryParameters, + body: ConfigureIndexRequestToJSON( + requestParameters.configureIndexRequest + ), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + IndexModelFromJSON(jsonValue) + ); + } + + /** + * 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 + ); + return await response.value(); + } + + /** + * This operation creates a Pinecone collection. Serverless indexes do not support collections. + * Create a collection + */ + async createCollectionRaw( + requestParameters: CreateCollectionOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.createCollectionRequest === null || + requestParameters.createCollectionRequest === undefined + ) { + throw new runtime.RequiredError( + 'createCollectionRequest', + 'Required parameter requestParameters.createCollectionRequest was null or undefined when calling createCollection.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/collections`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: CreateCollectionRequestToJSON( + requestParameters.createCollectionRequest + ), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + CollectionModelFromJSON(jsonValue) + ); + } + + /** + * This operation creates a Pinecone collection. Serverless indexes do not support collections. + * Create a collection + */ + async createCollection( + requestParameters: CreateCollectionOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.createCollectionRaw( + requestParameters, + initOverrides + ); + return await response.value(); + } + + /** + * 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/guides/indexes/create-an-index#create-a-serverless-index). + * Create an index + */ + async createIndexRaw( + requestParameters: CreateIndexOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.createIndexRequest === null || + requestParameters.createIndexRequest === undefined + ) { + throw new runtime.RequiredError( + 'createIndexRequest', + 'Required parameter requestParameters.createIndexRequest was null or undefined when calling createIndex.' + ); + } + + 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: `/indexes`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: CreateIndexRequestToJSON(requestParameters.createIndexRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + IndexModelFromJSON(jsonValue) + ); + } + + /** + * 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/guides/indexes/create-an-index#create-a-serverless-index). + * Create an index + */ + async createIndex( + requestParameters: CreateIndexOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.createIndexRaw( + requestParameters, + initOverrides + ); + return await response.value(); + } + + /** + * This operation deletes an existing collection. Serverless indexes do not support collections. + * Delete a collection + */ + async deleteCollectionRaw( + requestParameters: DeleteCollectionRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.collectionName === null || + requestParameters.collectionName === undefined + ) { + throw new runtime.RequiredError( + 'collectionName', + 'Required parameter requestParameters.collectionName was null or undefined when calling deleteCollection.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/collections/{collection_name}`.replace( + `{${'collection_name'}}`, + encodeURIComponent(String(requestParameters.collectionName)) + ), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.VoidApiResponse(response); + } + + /** + * This operation deletes an existing collection. Serverless indexes do not support collections. + * Delete a collection + */ + async deleteCollection( + requestParameters: DeleteCollectionRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + await this.deleteCollectionRaw(requestParameters, initOverrides); + } + + /** + * 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 + ) { + throw new runtime.RequiredError( + 'indexName', + 'Required parameter requestParameters.indexName was null or undefined when calling deleteIndex.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/indexes/{index_name}`.replace( + `{${'index_name'}}`, + encodeURIComponent(String(requestParameters.indexName)) + ), + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.VoidApiResponse(response); + } + + /** + * 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. Serverless indexes do not support collections. + * Describe a collection + */ + async describeCollectionRaw( + requestParameters: DescribeCollectionRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.collectionName === null || + requestParameters.collectionName === undefined + ) { + throw new runtime.RequiredError( + 'collectionName', + 'Required parameter requestParameters.collectionName was null or undefined when calling describeCollection.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/collections/{collection_name}`.replace( + `{${'collection_name'}}`, + encodeURIComponent(String(requestParameters.collectionName)) + ), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + CollectionModelFromJSON(jsonValue) + ); + } + + /** + * This operation gets a description of a collection. Serverless indexes do not support collections. + * Describe a collection + */ + async describeCollection( + requestParameters: DescribeCollectionRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.describeCollectionRaw( + requestParameters, + initOverrides + ); + return await response.value(); + } + + /** + * Get a description of an index. + * Describe an index + */ + async describeIndexRaw( + requestParameters: DescribeIndexRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.indexName === null || + requestParameters.indexName === undefined + ) { + throw new runtime.RequiredError( + 'indexName', + 'Required parameter requestParameters.indexName was null or undefined when calling describeIndex.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/indexes/{index_name}`.replace( + `{${'index_name'}}`, + encodeURIComponent(String(requestParameters.indexName)) + ), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + IndexModelFromJSON(jsonValue) + ); + } + + /** + * 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 + ); + return await response.value(); + } + + /** + * This operation returns a list of all collections in a project. Serverless indexes do not support collections. + * List collections + */ + async listCollectionsRaw( + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/collections`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + CollectionListFromJSON(jsonValue) + ); + } + + /** + * This operation returns a list of all collections in a project. Serverless indexes do not support collections. + * List collections + */ + async listCollections( + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.listCollectionsRaw(initOverrides); + return await response.value(); + } + + /** + * This operation returns a list of all indexes in a project. + * List indexes + */ + async listIndexesRaw( + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/indexes`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + IndexListFromJSON(jsonValue) + ); + } + + /** + * 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); + return await response.value(); + } +} diff --git a/src/pinecone-generated-ts-fetch/apis/index.ts b/src/pinecone-generated-ts-fetch/control/apis/index.ts similarity index 70% rename from src/pinecone-generated-ts-fetch/apis/index.ts rename to src/pinecone-generated-ts-fetch/control/apis/index.ts index b86b509b..d5d78cf5 100644 --- a/src/pinecone-generated-ts-fetch/apis/index.ts +++ b/src/pinecone-generated-ts-fetch/control/apis/index.ts @@ -1,4 +1,4 @@ /* tslint:disable */ /* eslint-disable */ -export * from './DataPlaneApi'; +export * from './InferenceApi'; export * from './ManageIndexesApi'; diff --git a/src/pinecone-generated-ts-fetch/index.ts b/src/pinecone-generated-ts-fetch/control/index.ts similarity index 80% rename from src/pinecone-generated-ts-fetch/index.ts rename to src/pinecone-generated-ts-fetch/control/index.ts index bebe8bbb..91e0ae58 100644 --- a/src/pinecone-generated-ts-fetch/index.ts +++ b/src/pinecone-generated-ts-fetch/control/index.ts @@ -3,3 +3,4 @@ export * from './runtime'; export * from './apis/index'; export * from './models/index'; +export * from './api_version'; diff --git a/src/pinecone-generated-ts-fetch/control/models/CollectionList.ts b/src/pinecone-generated-ts-fetch/control/models/CollectionList.ts new file mode 100644 index 00000000..7baaa8b5 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/CollectionList.ts @@ -0,0 +1,77 @@ +/* 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: 2024-07 + * 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 { CollectionModel } from './CollectionModel'; +import { + CollectionModelFromJSON, + CollectionModelFromJSONTyped, + CollectionModelToJSON, +} from './CollectionModel'; + +/** + * The list of collections that exist in the project. + * @export + * @interface CollectionList + */ +export interface CollectionList { + /** + * + * @type {Array} + * @memberof CollectionList + */ + collections?: Array; +} + +/** + * Check if a given object implements the CollectionList interface. + */ +export function instanceOfCollectionList(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function CollectionListFromJSON(json: any): CollectionList { + return CollectionListFromJSONTyped(json, false); +} + +export function CollectionListFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): CollectionList { + if (json === undefined || json === null) { + return json; + } + return { + collections: !exists(json, 'collections') + ? undefined + : (json['collections'] as Array).map(CollectionModelFromJSON), + }; +} + +export function CollectionListToJSON(value?: CollectionList | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + collections: + value.collections === undefined + ? undefined + : (value.collections as Array).map(CollectionModelToJSON), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/CollectionModel.ts b/src/pinecone-generated-ts-fetch/control/models/CollectionModel.ts new file mode 100644 index 00000000..2c24b784 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/CollectionModel.ts @@ -0,0 +1,121 @@ +/* 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * The CollectionModel describes the configuration and status of a Pinecone collection. + * @export + * @interface CollectionModel + */ +export interface CollectionModel { + /** + * The name of the collection. + * @type {string} + * @memberof CollectionModel + */ + name: string; + /** + * The size of the collection in bytes. + * @type {number} + * @memberof CollectionModel + */ + size?: number; + /** + * The status of the collection. + * @type {string} + * @memberof CollectionModel + */ + status: CollectionModelStatusEnum; + /** + * 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. + * @type {number} + * @memberof CollectionModel + */ + vectorCount?: number; + /** + * The environment where the collection is hosted. + * @type {string} + * @memberof CollectionModel + */ + environment: string; +} + +/** + * @export + */ +export const CollectionModelStatusEnum = { + Initializing: 'Initializing', + Ready: 'Ready', + Terminating: 'Terminating', +} as const; +export type CollectionModelStatusEnum = + (typeof CollectionModelStatusEnum)[keyof typeof CollectionModelStatusEnum]; + +/** + * Check if a given object implements the CollectionModel interface. + */ +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; +} + +export function CollectionModelFromJSON(json: any): CollectionModel { + return CollectionModelFromJSONTyped(json, false); +} + +export function CollectionModelFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): CollectionModel { + if (json === undefined || json === null) { + return json; + } + return { + name: json['name'], + size: !exists(json, 'size') ? undefined : json['size'], + status: json['status'], + dimension: !exists(json, 'dimension') ? undefined : json['dimension'], + vectorCount: !exists(json, 'vector_count') + ? undefined + : json['vector_count'], + environment: json['environment'], + }; +} + +export function CollectionModelToJSON(value?: CollectionModel | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + name: value.name, + size: value.size, + status: value.status, + dimension: value.dimension, + vector_count: value.vectorCount, + environment: value.environment, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequest.ts b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequest.ts new file mode 100644 index 00000000..8419330b --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequest.ts @@ -0,0 +1,77 @@ +/* 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: 2024-07 + * 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 { ConfigureIndexRequestSpec } from './ConfigureIndexRequestSpec'; +import { + ConfigureIndexRequestSpecFromJSON, + ConfigureIndexRequestSpecFromJSONTyped, + ConfigureIndexRequestSpecToJSON, +} from './ConfigureIndexRequestSpec'; + +/** + * Configuration used to scale an index. + * @export + * @interface ConfigureIndexRequest + */ +export interface ConfigureIndexRequest { + /** + * + * @type {ConfigureIndexRequestSpec} + * @memberof ConfigureIndexRequest + */ + spec: ConfigureIndexRequestSpec; +} + +/** + * Check if a given object implements the ConfigureIndexRequest interface. + */ +export function instanceOfConfigureIndexRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'spec' in value; + + return isInstance; +} + +export function ConfigureIndexRequestFromJSON( + json: any +): ConfigureIndexRequest { + return ConfigureIndexRequestFromJSONTyped(json, false); +} + +export function ConfigureIndexRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ConfigureIndexRequest { + if (json === undefined || json === null) { + return json; + } + return { + spec: ConfigureIndexRequestSpecFromJSON(json['spec']), + }; +} + +export function ConfigureIndexRequestToJSON( + value?: ConfigureIndexRequest | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + spec: ConfigureIndexRequestSpecToJSON(value.spec), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpec.ts b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpec.ts new file mode 100644 index 00000000..32806945 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpec.ts @@ -0,0 +1,77 @@ +/* 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: 2024-07 + * 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 { ConfigureIndexRequestSpecPod } from './ConfigureIndexRequestSpecPod'; +import { + ConfigureIndexRequestSpecPodFromJSON, + ConfigureIndexRequestSpecPodFromJSONTyped, + ConfigureIndexRequestSpecPodToJSON, +} from './ConfigureIndexRequestSpecPod'; + +/** + * + * @export + * @interface ConfigureIndexRequestSpec + */ +export interface ConfigureIndexRequestSpec { + /** + * + * @type {ConfigureIndexRequestSpecPod} + * @memberof ConfigureIndexRequestSpec + */ + pod: ConfigureIndexRequestSpecPod; +} + +/** + * Check if a given object implements the ConfigureIndexRequestSpec interface. + */ +export function instanceOfConfigureIndexRequestSpec(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'pod' in value; + + return isInstance; +} + +export function ConfigureIndexRequestSpecFromJSON( + json: any +): ConfigureIndexRequestSpec { + return ConfigureIndexRequestSpecFromJSONTyped(json, false); +} + +export function ConfigureIndexRequestSpecFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ConfigureIndexRequestSpec { + if (json === undefined || json === null) { + return json; + } + return { + pod: ConfigureIndexRequestSpecPodFromJSON(json['pod']), + }; +} + +export function ConfigureIndexRequestSpecToJSON( + value?: ConfigureIndexRequestSpec | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + pod: ConfigureIndexRequestSpecPodToJSON(value.pod), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpecPod.ts b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpecPod.ts new file mode 100644 index 00000000..3f0e1961 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ConfigureIndexRequestSpecPod.ts @@ -0,0 +1,77 @@ +/* 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: 2024-07 + * 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 ConfigureIndexRequestSpecPod + */ +export interface ConfigureIndexRequestSpecPod { + /** + * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. + * @type {number} + * @memberof ConfigureIndexRequestSpecPod + */ + replicas?: number; + /** + * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. + * @type {string} + * @memberof ConfigureIndexRequestSpecPod + */ + podType?: string; +} + +/** + * Check if a given object implements the ConfigureIndexRequestSpecPod interface. + */ +export function instanceOfConfigureIndexRequestSpecPod(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ConfigureIndexRequestSpecPodFromJSON( + json: any +): ConfigureIndexRequestSpecPod { + return ConfigureIndexRequestSpecPodFromJSONTyped(json, false); +} + +export function ConfigureIndexRequestSpecPodFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ConfigureIndexRequestSpecPod { + if (json === undefined || json === null) { + return json; + } + return { + replicas: !exists(json, 'replicas') ? undefined : json['replicas'], + podType: !exists(json, 'pod_type') ? undefined : json['pod_type'], + }; +} + +export function ConfigureIndexRequestSpecPodToJSON( + value?: ConfigureIndexRequestSpecPod | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + replicas: value.replicas, + pod_type: value.podType, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/CreateCollectionRequest.ts b/src/pinecone-generated-ts-fetch/control/models/CreateCollectionRequest.ts new file mode 100644 index 00000000..acba28da --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/CreateCollectionRequest.ts @@ -0,0 +1,79 @@ +/* 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * The configuration needed to create a Pinecone collection. + * @export + * @interface CreateCollectionRequest + */ +export interface CreateCollectionRequest { + /** + * 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 + */ + name: string; + /** + * The name of the index to be used as the source for the collection. + * @type {string} + * @memberof CreateCollectionRequest + */ + source: string; +} + +/** + * Check if a given object implements the CreateCollectionRequest interface. + */ +export function instanceOfCreateCollectionRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'name' in value; + isInstance = isInstance && 'source' in value; + + return isInstance; +} + +export function CreateCollectionRequestFromJSON( + json: any +): CreateCollectionRequest { + return CreateCollectionRequestFromJSONTyped(json, false); +} + +export function CreateCollectionRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): CreateCollectionRequest { + if (json === undefined || json === null) { + return json; + } + return { + name: json['name'], + source: json['source'], + }; +} + +export function CreateCollectionRequestToJSON( + value?: CreateCollectionRequest | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + name: value.name, + source: value.source, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/CreateIndexRequest.ts b/src/pinecone-generated-ts-fetch/control/models/CreateIndexRequest.ts new file mode 100644 index 00000000..8be4def8 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/CreateIndexRequest.ts @@ -0,0 +1,112 @@ +/* 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: 2024-07 + * 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 { IndexSpec } from './IndexSpec'; +import { + IndexSpecFromJSON, + IndexSpecFromJSONTyped, + IndexSpecToJSON, +} from './IndexSpec'; + +/** + * The configuration needed to create a Pinecone index. + * @export + * @interface CreateIndexRequest + */ +export interface CreateIndexRequest { + /** + * 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. + * @type {number} + * @memberof CreateIndexRequest + */ + dimension: number; + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * @type {string} + * @memberof CreateIndexRequest + */ + metric?: CreateIndexRequestMetricEnum; + /** + * + * @type {IndexSpec} + * @memberof CreateIndexRequest + */ + spec: IndexSpec | null; +} + +/** + * @export + */ +export const CreateIndexRequestMetricEnum = { + Cosine: 'cosine', + Euclidean: 'euclidean', + Dotproduct: 'dotproduct', +} as const; +export type CreateIndexRequestMetricEnum = + (typeof CreateIndexRequestMetricEnum)[keyof typeof CreateIndexRequestMetricEnum]; + +/** + * Check if a given object implements the CreateIndexRequest interface. + */ +export function instanceOfCreateIndexRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'name' in value; + isInstance = isInstance && 'dimension' in value; + isInstance = isInstance && 'spec' in value; + + return isInstance; +} + +export function CreateIndexRequestFromJSON(json: any): CreateIndexRequest { + return CreateIndexRequestFromJSONTyped(json, false); +} + +export function CreateIndexRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): CreateIndexRequest { + if (json === undefined || json === null) { + return json; + } + return { + name: json['name'], + dimension: json['dimension'], + metric: !exists(json, 'metric') ? undefined : json['metric'], + spec: IndexSpecFromJSON(json['spec']), + }; +} + +export function CreateIndexRequestToJSON( + value?: CreateIndexRequest | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + name: value.name, + dimension: value.dimension, + metric: value.metric, + spec: IndexSpecToJSON(value.spec), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/EmbedRequest.ts b/src/pinecone-generated-ts-fetch/control/models/EmbedRequest.ts new file mode 100644 index 00000000..263afc2b --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/EmbedRequest.ts @@ -0,0 +1,98 @@ +/* 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: 2024-07 + * 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 { EmbedRequestInputsInner } from './EmbedRequestInputsInner'; +import { + EmbedRequestInputsInnerFromJSON, + EmbedRequestInputsInnerFromJSONTyped, + EmbedRequestInputsInnerToJSON, +} from './EmbedRequestInputsInner'; +import type { EmbedRequestParameters } from './EmbedRequestParameters'; +import { + EmbedRequestParametersFromJSON, + EmbedRequestParametersFromJSONTyped, + EmbedRequestParametersToJSON, +} from './EmbedRequestParameters'; + +/** + * Generate embeddings for inputs + * @export + * @interface EmbedRequest + */ +export interface EmbedRequest { + /** + * + * @type {string} + * @memberof EmbedRequest + */ + model: string; + /** + * + * @type {EmbedRequestParameters} + * @memberof EmbedRequest + */ + parameters?: EmbedRequestParameters; + /** + * + * @type {Array} + * @memberof EmbedRequest + */ + inputs: Array; +} + +/** + * Check if a given object implements the EmbedRequest interface. + */ +export function instanceOfEmbedRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'model' in value; + isInstance = isInstance && 'inputs' in value; + + return isInstance; +} + +export function EmbedRequestFromJSON(json: any): EmbedRequest { + return EmbedRequestFromJSONTyped(json, false); +} + +export function EmbedRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): EmbedRequest { + if (json === undefined || json === null) { + return json; + } + return { + model: json['model'], + parameters: !exists(json, 'parameters') + ? undefined + : EmbedRequestParametersFromJSON(json['parameters']), + inputs: (json['inputs'] as Array).map(EmbedRequestInputsInnerFromJSON), + }; +} + +export function EmbedRequestToJSON(value?: EmbedRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + model: value.model, + parameters: EmbedRequestParametersToJSON(value.parameters), + inputs: (value.inputs as Array).map(EmbedRequestInputsInnerToJSON), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/EmbedRequestInputsInner.ts b/src/pinecone-generated-ts-fetch/control/models/EmbedRequestInputsInner.ts new file mode 100644 index 00000000..3543258c --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/EmbedRequestInputsInner.ts @@ -0,0 +1,69 @@ +/* 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: 2024-07 + * 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 EmbedRequestInputsInner + */ +export interface EmbedRequestInputsInner { + /** + * + * @type {string} + * @memberof EmbedRequestInputsInner + */ + text?: string; +} + +/** + * Check if a given object implements the EmbedRequestInputsInner interface. + */ +export function instanceOfEmbedRequestInputsInner(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function EmbedRequestInputsInnerFromJSON( + json: any +): EmbedRequestInputsInner { + return EmbedRequestInputsInnerFromJSONTyped(json, false); +} + +export function EmbedRequestInputsInnerFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): EmbedRequestInputsInner { + if (json === undefined || json === null) { + return json; + } + return { + text: !exists(json, 'text') ? undefined : json['text'], + }; +} + +export function EmbedRequestInputsInnerToJSON( + value?: EmbedRequestInputsInner | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + text: value.text, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/EmbedRequestParameters.ts b/src/pinecone-generated-ts-fetch/control/models/EmbedRequestParameters.ts new file mode 100644 index 00000000..72e1cc6f --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/EmbedRequestParameters.ts @@ -0,0 +1,77 @@ +/* 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: 2024-07 + * 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'; +/** + * Model-specific parameters. + * @export + * @interface EmbedRequestParameters + */ +export interface EmbedRequestParameters { + /** + * Common property used to distinguish between types of data. + * @type {string} + * @memberof EmbedRequestParameters + */ + inputType?: string; + /** + * How to handle inputs longer than those supported by the model. If NONE, when the input exceeds the maximum input token length an error will be returned. + * @type {string} + * @memberof EmbedRequestParameters + */ + truncate?: string; +} + +/** + * Check if a given object implements the EmbedRequestParameters interface. + */ +export function instanceOfEmbedRequestParameters(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function EmbedRequestParametersFromJSON( + json: any +): EmbedRequestParameters { + return EmbedRequestParametersFromJSONTyped(json, false); +} + +export function EmbedRequestParametersFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): EmbedRequestParameters { + if (json === undefined || json === null) { + return json; + } + return { + inputType: !exists(json, 'input_type') ? undefined : json['input_type'], + truncate: !exists(json, 'truncate') ? undefined : json['truncate'], + }; +} + +export function EmbedRequestParametersToJSON( + value?: EmbedRequestParameters | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + input_type: value.inputType, + truncate: value.truncate, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/Embedding.ts b/src/pinecone-generated-ts-fetch/control/models/Embedding.ts new file mode 100644 index 00000000..ac280b84 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/Embedding.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: 2024-07 + * 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'; +/** + * Embedding of a single input + * @export + * @interface Embedding + */ +export interface Embedding { + /** + * The embedding values. + * @type {Array} + * @memberof Embedding + */ + values?: Array; +} + +/** + * Check if a given object implements the Embedding interface. + */ +export function instanceOfEmbedding(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function EmbeddingFromJSON(json: any): Embedding { + return EmbeddingFromJSONTyped(json, false); +} + +export function EmbeddingFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): Embedding { + if (json === undefined || json === null) { + return json; + } + return { + values: !exists(json, 'values') ? undefined : json['values'], + }; +} + +export function EmbeddingToJSON(value?: Embedding | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + values: value.values, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/EmbeddingsList.ts b/src/pinecone-generated-ts-fetch/control/models/EmbeddingsList.ts new file mode 100644 index 00000000..c42e20b6 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/EmbeddingsList.ts @@ -0,0 +1,101 @@ +/* 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: 2024-07 + * 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 { Embedding } from './Embedding'; +import { + EmbeddingFromJSON, + EmbeddingFromJSONTyped, + EmbeddingToJSON, +} from './Embedding'; +import type { EmbeddingsListUsage } from './EmbeddingsListUsage'; +import { + EmbeddingsListUsageFromJSON, + EmbeddingsListUsageFromJSONTyped, + EmbeddingsListUsageToJSON, +} from './EmbeddingsListUsage'; + +/** + * Embeddings generated for the input + * @export + * @interface EmbeddingsList + */ +export interface EmbeddingsList { + /** + * + * @type {string} + * @memberof EmbeddingsList + */ + model?: string; + /** + * + * @type {Array} + * @memberof EmbeddingsList + */ + data?: Array; + /** + * + * @type {EmbeddingsListUsage} + * @memberof EmbeddingsList + */ + usage?: EmbeddingsListUsage; +} + +/** + * Check if a given object implements the EmbeddingsList interface. + */ +export function instanceOfEmbeddingsList(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function EmbeddingsListFromJSON(json: any): EmbeddingsList { + return EmbeddingsListFromJSONTyped(json, false); +} + +export function EmbeddingsListFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): EmbeddingsList { + if (json === undefined || json === null) { + return json; + } + return { + model: !exists(json, 'model') ? undefined : json['model'], + data: !exists(json, 'data') + ? undefined + : (json['data'] as Array).map(EmbeddingFromJSON), + usage: !exists(json, 'usage') + ? undefined + : EmbeddingsListUsageFromJSON(json['usage']), + }; +} + +export function EmbeddingsListToJSON(value?: EmbeddingsList | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + model: value.model, + data: + value.data === undefined + ? undefined + : (value.data as Array).map(EmbeddingToJSON), + usage: EmbeddingsListUsageToJSON(value.usage), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/EmbeddingsListUsage.ts b/src/pinecone-generated-ts-fetch/control/models/EmbeddingsListUsage.ts new file mode 100644 index 00000000..bcbc6cc4 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/EmbeddingsListUsage.ts @@ -0,0 +1,69 @@ +/* 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: 2024-07 + * 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'; +/** + * Usage statistics for model inference including any instruction prefixes + * @export + * @interface EmbeddingsListUsage + */ +export interface EmbeddingsListUsage { + /** + * + * @type {number} + * @memberof EmbeddingsListUsage + */ + totalTokens?: number; +} + +/** + * Check if a given object implements the EmbeddingsListUsage interface. + */ +export function instanceOfEmbeddingsListUsage(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function EmbeddingsListUsageFromJSON(json: any): EmbeddingsListUsage { + return EmbeddingsListUsageFromJSONTyped(json, false); +} + +export function EmbeddingsListUsageFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): EmbeddingsListUsage { + if (json === undefined || json === null) { + return json; + } + return { + totalTokens: !exists(json, 'total_tokens') + ? undefined + : json['total_tokens'], + }; +} + +export function EmbeddingsListUsageToJSON( + value?: EmbeddingsListUsage | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + total_tokens: value.totalTokens, + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/IndexList.ts b/src/pinecone-generated-ts-fetch/control/models/IndexList.ts similarity index 50% rename from src/pinecone-generated-ts-fetch/models/IndexList.ts rename to src/pinecone-generated-ts-fetch/control/models/IndexList.ts index b85c3a82..ed11d1e0 100644 --- a/src/pinecone-generated-ts-fetch/models/IndexList.ts +++ b/src/pinecone-generated-ts-fetch/control/models/IndexList.ts @@ -4,7 +4,7 @@ * 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 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -15,9 +15,9 @@ import { exists, mapValues } from '../runtime'; import type { IndexModel } from './IndexModel'; import { - IndexModelFromJSON, - IndexModelFromJSONTyped, - IndexModelToJSON, + IndexModelFromJSON, + IndexModelFromJSONTyped, + IndexModelToJSON, } from './IndexModel'; /** @@ -26,47 +26,52 @@ import { * @interface IndexList */ export interface IndexList { - /** - * - * @type {Array} - * @memberof IndexList - */ - indexes?: Array; + /** + * + * @type {Array} + * @memberof IndexList + */ + indexes?: Array; } /** * Check if a given object implements the IndexList interface. */ export function instanceOfIndexList(value: object): boolean { - let isInstance = true; + let isInstance = true; - return isInstance; + return isInstance; } export function IndexListFromJSON(json: any): IndexList { - return IndexListFromJSONTyped(json, false); + return IndexListFromJSONTyped(json, false); } -export function IndexListFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexList { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'indexes': !exists(json, 'indexes') ? undefined : ((json['indexes'] as Array).map(IndexModelFromJSON)), - }; +export function IndexListFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): IndexList { + if (json === undefined || json === null) { + return json; + } + return { + indexes: !exists(json, 'indexes') + ? undefined + : (json['indexes'] as Array).map(IndexModelFromJSON), + }; } export function IndexListToJSON(value?: IndexList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'indexes': value.indexes === undefined ? undefined : ((value.indexes as Array).map(IndexModelToJSON)), - }; + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + indexes: + value.indexes === undefined + ? undefined + : (value.indexes as Array).map(IndexModelToJSON), + }; } - diff --git a/src/pinecone-generated-ts-fetch/control/models/IndexModel.ts b/src/pinecone-generated-ts-fetch/control/models/IndexModel.ts new file mode 100644 index 00000000..6314f1e5 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/IndexModel.ts @@ -0,0 +1,135 @@ +/* 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: 2024-07 + * 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 { IndexModelSpec } from './IndexModelSpec'; +import { + IndexModelSpecFromJSON, + IndexModelSpecFromJSONTyped, + IndexModelSpecToJSON, +} from './IndexModelSpec'; +import type { IndexModelStatus } from './IndexModelStatus'; +import { + IndexModelStatusFromJSON, + IndexModelStatusFromJSONTyped, + IndexModelStatusToJSON, +} from './IndexModelStatus'; + +/** + * The IndexModel describes the configuration and status of a Pinecone index. + * @export + * @interface IndexModel + */ +export interface IndexModel { + /** + * 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. + * @type {number} + * @memberof IndexModel + */ + dimension: number; + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * @type {string} + * @memberof IndexModel + */ + metric: IndexModelMetricEnum; + /** + * The URL address where the index is hosted. + * @type {string} + * @memberof IndexModel + */ + host: string; + /** + * + * @type {IndexModelSpec} + * @memberof IndexModel + */ + spec: IndexModelSpec; + /** + * + * @type {IndexModelStatus} + * @memberof IndexModel + */ + status: IndexModelStatus; +} + +/** + * @export + */ +export const IndexModelMetricEnum = { + Cosine: 'cosine', + Euclidean: 'euclidean', + Dotproduct: 'dotproduct', +} as const; +export type IndexModelMetricEnum = + (typeof IndexModelMetricEnum)[keyof typeof IndexModelMetricEnum]; + +/** + * Check if a given object implements the IndexModel interface. + */ +export function instanceOfIndexModel(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'name' in value; + isInstance = isInstance && 'dimension' in value; + isInstance = isInstance && 'metric' in value; + isInstance = isInstance && 'host' in value; + isInstance = isInstance && 'spec' in value; + isInstance = isInstance && 'status' in value; + + return isInstance; +} + +export function IndexModelFromJSON(json: any): IndexModel { + return IndexModelFromJSONTyped(json, false); +} + +export function IndexModelFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): IndexModel { + if (json === undefined || json === null) { + return json; + } + return { + name: json['name'], + dimension: json['dimension'], + metric: json['metric'], + host: json['host'], + spec: IndexModelSpecFromJSON(json['spec']), + status: IndexModelStatusFromJSON(json['status']), + }; +} + +export function IndexModelToJSON(value?: IndexModel | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + name: value.name, + dimension: value.dimension, + metric: value.metric, + host: value.host, + spec: IndexModelSpecToJSON(value.spec), + status: IndexModelStatusToJSON(value.status), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/IndexModelSpec.ts b/src/pinecone-generated-ts-fetch/control/models/IndexModelSpec.ts new file mode 100644 index 00000000..e06de03e --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/IndexModelSpec.ts @@ -0,0 +1,88 @@ +/* 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: 2024-07 + * 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 { PodSpec } from './PodSpec'; +import { + PodSpecFromJSON, + PodSpecFromJSONTyped, + PodSpecToJSON, +} from './PodSpec'; +import type { ServerlessSpec } from './ServerlessSpec'; +import { + ServerlessSpecFromJSON, + ServerlessSpecFromJSONTyped, + ServerlessSpecToJSON, +} from './ServerlessSpec'; + +/** + * + * @export + * @interface IndexModelSpec + */ +export interface IndexModelSpec { + /** + * + * @type {PodSpec} + * @memberof IndexModelSpec + */ + pod?: PodSpec; + /** + * + * @type {ServerlessSpec} + * @memberof IndexModelSpec + */ + serverless?: ServerlessSpec; +} + +/** + * Check if a given object implements the IndexModelSpec interface. + */ +export function instanceOfIndexModelSpec(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function IndexModelSpecFromJSON(json: any): IndexModelSpec { + return IndexModelSpecFromJSONTyped(json, false); +} + +export function IndexModelSpecFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): IndexModelSpec { + if (json === undefined || json === null) { + return json; + } + return { + pod: !exists(json, 'pod') ? undefined : PodSpecFromJSON(json['pod']), + serverless: !exists(json, 'serverless') + ? undefined + : ServerlessSpecFromJSON(json['serverless']), + }; +} + +export function IndexModelSpecToJSON(value?: IndexModelSpec | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + pod: PodSpecToJSON(value.pod), + serverless: ServerlessSpecToJSON(value.serverless), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/IndexModelStatus.ts b/src/pinecone-generated-ts-fetch/control/models/IndexModelStatus.ts new file mode 100644 index 00000000..db5c4df1 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/IndexModelStatus.ts @@ -0,0 +1,91 @@ +/* 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: 2024-07 + * 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 IndexModelStatus + */ +export interface IndexModelStatus { + /** + * + * @type {boolean} + * @memberof IndexModelStatus + */ + ready: boolean; + /** + * + * @type {string} + * @memberof IndexModelStatus + */ + state: IndexModelStatusStateEnum; +} + +/** + * @export + */ +export const IndexModelStatusStateEnum = { + Initializing: 'Initializing', + InitializationFailed: 'InitializationFailed', + ScalingUp: 'ScalingUp', + ScalingDown: 'ScalingDown', + ScalingUpPodSize: 'ScalingUpPodSize', + ScalingDownPodSize: 'ScalingDownPodSize', + Terminating: 'Terminating', + Ready: 'Ready', +} as const; +export type IndexModelStatusStateEnum = + (typeof IndexModelStatusStateEnum)[keyof typeof IndexModelStatusStateEnum]; + +/** + * Check if a given object implements the IndexModelStatus interface. + */ +export function instanceOfIndexModelStatus(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'ready' in value; + isInstance = isInstance && 'state' in value; + + return isInstance; +} + +export function IndexModelStatusFromJSON(json: any): IndexModelStatus { + return IndexModelStatusFromJSONTyped(json, false); +} + +export function IndexModelStatusFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): IndexModelStatus { + if (json === undefined || json === null) { + return json; + } + return { + ready: json['ready'], + state: json['state'], + }; +} + +export function IndexModelStatusToJSON(value?: IndexModelStatus | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + ready: value.ready, + state: value.state, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/IndexSpec.ts b/src/pinecone-generated-ts-fetch/control/models/IndexSpec.ts new file mode 100644 index 00000000..9fb595cf --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/IndexSpec.ts @@ -0,0 +1,90 @@ +/* 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: 2024-07 + * 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 { PodSpec } from './PodSpec'; +import { + PodSpecFromJSON, + PodSpecFromJSONTyped, + PodSpecToJSON, +} from './PodSpec'; +import type { ServerlessSpec } from './ServerlessSpec'; +import { + ServerlessSpecFromJSON, + ServerlessSpecFromJSONTyped, + ServerlessSpecToJSON, +} from './ServerlessSpec'; + +/** + * 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. + * @export + * @interface IndexSpec + */ +export interface IndexSpec { + /** + * + * @type {ServerlessSpec} + * @memberof IndexSpec + */ + serverless?: ServerlessSpec; + /** + * + * @type {PodSpec} + * @memberof IndexSpec + */ + pod?: PodSpec; +} + +/** + * Check if a given object implements the IndexSpec interface. + */ +export function instanceOfIndexSpec(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function IndexSpecFromJSON(json: any): IndexSpec { + return IndexSpecFromJSONTyped(json, false); +} + +export function IndexSpecFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): IndexSpec { + if (json === undefined || json === null) { + return json; + } + return { + serverless: !exists(json, 'serverless') + ? undefined + : ServerlessSpecFromJSON(json['serverless']), + pod: !exists(json, 'pod') ? undefined : PodSpecFromJSON(json['pod']), + }; +} + +export function IndexSpecToJSON(value?: IndexSpec | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + serverless: ServerlessSpecToJSON(value.serverless), + pod: PodSpecToJSON(value.pod), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ListIndexes401Response.ts b/src/pinecone-generated-ts-fetch/control/models/ListIndexes401Response.ts new file mode 100644 index 00000000..52d1303c --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ListIndexes401Response.ts @@ -0,0 +1,86 @@ +/* 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: 2024-07 + * 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 { ListIndexes401ResponseError } from './ListIndexes401ResponseError'; +import { + ListIndexes401ResponseErrorFromJSON, + ListIndexes401ResponseErrorFromJSONTyped, + ListIndexes401ResponseErrorToJSON, +} from './ListIndexes401ResponseError'; + +/** + * The response shape used for all error responses. + * @export + * @interface ListIndexes401Response + */ +export interface ListIndexes401Response { + /** + * The HTTP status code of the error. + * @type {number} + * @memberof ListIndexes401Response + */ + status: number; + /** + * + * @type {ListIndexes401ResponseError} + * @memberof ListIndexes401Response + */ + error: ListIndexes401ResponseError; +} + +/** + * Check if a given object implements the ListIndexes401Response interface. + */ +export function instanceOfListIndexes401Response(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'status' in value; + isInstance = isInstance && 'error' in value; + + return isInstance; +} + +export function ListIndexes401ResponseFromJSON( + json: any +): ListIndexes401Response { + return ListIndexes401ResponseFromJSONTyped(json, false); +} + +export function ListIndexes401ResponseFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ListIndexes401Response { + if (json === undefined || json === null) { + return json; + } + return { + status: json['status'], + error: ListIndexes401ResponseErrorFromJSON(json['error']), + }; +} + +export function ListIndexes401ResponseToJSON( + value?: ListIndexes401Response | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + status: value.status, + error: ListIndexes401ResponseErrorToJSON(value.error), + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ListIndexes401ResponseError.ts b/src/pinecone-generated-ts-fetch/control/models/ListIndexes401ResponseError.ts new file mode 100644 index 00000000..4bd34fcc --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ListIndexes401ResponseError.ts @@ -0,0 +1,113 @@ +/* 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: 2024-07 + * 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'; +/** + * Detailed information about the error that occurred. + * @export + * @interface ListIndexes401ResponseError + */ +export interface ListIndexes401ResponseError { + /** + * + * @type {string} + * @memberof ListIndexes401ResponseError + */ + code: ListIndexes401ResponseErrorCodeEnum; + /** + * + * @type {string} + * @memberof ListIndexes401ResponseError + */ + message: string; + /** + * Additional information about the error. This field is not guaranteed to be present. + * @type {object} + * @memberof ListIndexes401ResponseError + */ + details?: object; +} + +/** + * @export + */ +export const ListIndexes401ResponseErrorCodeEnum = { + Ok: 'OK', + Unknown: 'UNKNOWN', + InvalidArgument: 'INVALID_ARGUMENT', + DeadlineExceeded: 'DEADLINE_EXCEEDED', + QuotaExceeded: 'QUOTA_EXCEEDED', + NotFound: 'NOT_FOUND', + AlreadyExists: 'ALREADY_EXISTS', + PermissionDenied: 'PERMISSION_DENIED', + Unauthenticated: 'UNAUTHENTICATED', + ResourceExhausted: 'RESOURCE_EXHAUSTED', + FailedPrecondition: 'FAILED_PRECONDITION', + Aborted: 'ABORTED', + OutOfRange: 'OUT_OF_RANGE', + Unimplemented: 'UNIMPLEMENTED', + Internal: 'INTERNAL', + Unavailable: 'UNAVAILABLE', + DataLoss: 'DATA_LOSS', + Forbidden: 'FORBIDDEN', +} as const; +export type ListIndexes401ResponseErrorCodeEnum = + (typeof ListIndexes401ResponseErrorCodeEnum)[keyof typeof ListIndexes401ResponseErrorCodeEnum]; + +/** + * Check if a given object implements the ListIndexes401ResponseError interface. + */ +export function instanceOfListIndexes401ResponseError(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'code' in value; + isInstance = isInstance && 'message' in value; + + return isInstance; +} + +export function ListIndexes401ResponseErrorFromJSON( + json: any +): ListIndexes401ResponseError { + return ListIndexes401ResponseErrorFromJSONTyped(json, false); +} + +export function ListIndexes401ResponseErrorFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ListIndexes401ResponseError { + if (json === undefined || json === null) { + return json; + } + return { + code: json['code'], + message: json['message'], + details: !exists(json, 'details') ? undefined : json['details'], + }; +} + +export function ListIndexes401ResponseErrorToJSON( + value?: ListIndexes401ResponseError | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + code: value.code, + message: value.message, + details: value.details, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/PodSpec.ts b/src/pinecone-generated-ts-fetch/control/models/PodSpec.ts new file mode 100644 index 00000000..53c57a2b --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/PodSpec.ts @@ -0,0 +1,127 @@ +/* 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: 2024-07 + * 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 { PodSpecMetadataConfig } from './PodSpecMetadataConfig'; +import { + PodSpecMetadataConfigFromJSON, + PodSpecMetadataConfigFromJSONTyped, + PodSpecMetadataConfigToJSON, +} from './PodSpecMetadataConfig'; + +/** + * Configuration needed to deploy a pod-based index. + * @export + * @interface PodSpec + */ +export interface PodSpec { + /** + * The environment where the index is hosted. + * @type {string} + * @memberof PodSpec + */ + environment: string; + /** + * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. + * @type {number} + * @memberof PodSpec + */ + replicas?: number; + /** + * The number of shards. Shards split your data across multiple pods so you can fit more data into an index. + * @type {number} + * @memberof PodSpec + */ + shards?: number; + /** + * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. + * @type {string} + * @memberof PodSpec + */ + podType: string; + /** + * The number of pods to be used in the index. This should be equal to `shards` x `replicas`.' + * @type {number} + * @memberof PodSpec + */ + pods: number; + /** + * + * @type {PodSpecMetadataConfig} + * @memberof PodSpec + */ + metadataConfig?: PodSpecMetadataConfig; + /** + * The name of the collection to be used as the source for the index. + * @type {string} + * @memberof PodSpec + */ + sourceCollection?: string; +} + +/** + * Check if a given object implements the PodSpec interface. + */ +export function instanceOfPodSpec(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'environment' in value; + isInstance = isInstance && 'podType' in value; + isInstance = isInstance && 'pods' in value; + + return isInstance; +} + +export function PodSpecFromJSON(json: any): PodSpec { + return PodSpecFromJSONTyped(json, false); +} + +export function PodSpecFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): PodSpec { + if (json === undefined || json === null) { + return json; + } + return { + environment: json['environment'], + replicas: !exists(json, 'replicas') ? undefined : json['replicas'], + shards: !exists(json, 'shards') ? undefined : json['shards'], + podType: json['pod_type'], + pods: json['pods'], + metadataConfig: !exists(json, 'metadata_config') + ? undefined + : PodSpecMetadataConfigFromJSON(json['metadata_config']), + sourceCollection: !exists(json, 'source_collection') + ? undefined + : json['source_collection'], + }; +} + +export function PodSpecToJSON(value?: PodSpec | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + environment: value.environment, + replicas: value.replicas, + shards: value.shards, + pod_type: value.podType, + pods: value.pods, + metadata_config: PodSpecMetadataConfigToJSON(value.metadataConfig), + source_collection: value.sourceCollection, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/PodSpecMetadataConfig.ts b/src/pinecone-generated-ts-fetch/control/models/PodSpecMetadataConfig.ts new file mode 100644 index 00000000..46c39ec8 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/PodSpecMetadataConfig.ts @@ -0,0 +1,69 @@ +/* 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: 2024-07 + * 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 PodSpecMetadataConfig + */ +export interface PodSpecMetadataConfig { + /** + * 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 + */ + indexed?: Array; +} + +/** + * Check if a given object implements the PodSpecMetadataConfig interface. + */ +export function instanceOfPodSpecMetadataConfig(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function PodSpecMetadataConfigFromJSON( + json: any +): PodSpecMetadataConfig { + return PodSpecMetadataConfigFromJSONTyped(json, false); +} + +export function PodSpecMetadataConfigFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): PodSpecMetadataConfig { + if (json === undefined || json === null) { + return json; + } + return { + indexed: !exists(json, 'indexed') ? undefined : json['indexed'], + }; +} + +export function PodSpecMetadataConfigToJSON( + value?: PodSpecMetadataConfig | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + indexed: value.indexed, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/ServerlessSpec.ts b/src/pinecone-generated-ts-fetch/control/models/ServerlessSpec.ts new file mode 100644 index 00000000..99d6cc40 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/ServerlessSpec.ts @@ -0,0 +1,86 @@ +/* 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: 2024-07 + * 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 needed to deploy a serverless index. + * @export + * @interface ServerlessSpec + */ +export interface ServerlessSpec { + /** + * 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. Serverless indexes can be created only in the us-east-1,us-west-2, and eu-west-1 regions of AWS at this time. + * @type {string} + * @memberof ServerlessSpec + */ + region: string; +} + +/** + * @export + */ +export const ServerlessSpecCloudEnum = { + Gcp: 'gcp', + Aws: 'aws', + Azure: 'azure', +} as const; +export type ServerlessSpecCloudEnum = + (typeof ServerlessSpecCloudEnum)[keyof typeof ServerlessSpecCloudEnum]; + +/** + * Check if a given object implements the ServerlessSpec interface. + */ +export function instanceOfServerlessSpec(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'cloud' in value; + isInstance = isInstance && 'region' in value; + + return isInstance; +} + +export function ServerlessSpecFromJSON(json: any): ServerlessSpec { + return ServerlessSpecFromJSONTyped(json, false); +} + +export function ServerlessSpecFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ServerlessSpec { + if (json === undefined || json === null) { + return json; + } + return { + cloud: json['cloud'], + region: json['region'], + }; +} + +export function ServerlessSpecToJSON(value?: ServerlessSpec | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + cloud: value.cloud, + region: value.region, + }; +} diff --git a/src/pinecone-generated-ts-fetch/control/models/index.ts b/src/pinecone-generated-ts-fetch/control/models/index.ts new file mode 100644 index 00000000..d8668822 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/models/index.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './CollectionList'; +export * from './CollectionModel'; +export * from './ConfigureIndexRequest'; +export * from './ConfigureIndexRequestSpec'; +export * from './ConfigureIndexRequestSpecPod'; +export * from './CreateCollectionRequest'; +export * from './CreateIndexRequest'; +export * from './EmbedRequest'; +export * from './EmbedRequestInputsInner'; +export * from './EmbedRequestParameters'; +export * from './Embedding'; +export * from './EmbeddingsList'; +export * from './EmbeddingsListUsage'; +export * from './IndexList'; +export * from './IndexModel'; +export * from './IndexModelSpec'; +export * from './IndexModelStatus'; +export * from './IndexSpec'; +export * from './ListIndexes401Response'; +export * from './ListIndexes401ResponseError'; +export * from './PodSpec'; +export * from './PodSpecMetadataConfig'; +export * from './ServerlessSpec'; diff --git a/src/pinecone-generated-ts-fetch/control/runtime.ts b/src/pinecone-generated-ts-fetch/control/runtime.ts new file mode 100644 index 00000000..22f06425 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/control/runtime.ts @@ -0,0 +1,519 @@ +/* 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export const BASE_PATH = 'https://api.pinecone.io'.replace(/\/+$/, ''); + +export interface ConfigurationParameters { + basePath?: string; // override base path + fetchApi?: FetchAPI; // override for fetch implementation + middleware?: Middleware[]; // middleware to apply before/after fetch requests + queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings + username?: string; // parameter for basic security + password?: string; // parameter for basic security + apiKey?: string | ((name: string) => string); // parameter for apiKey security + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security + headers?: HTTPHeaders; //header params we want to use on every request + credentials?: RequestCredentials; //value for the credentials param we want to use on each request +} + +export class Configuration { + constructor(private configuration: ConfigurationParameters = {}) {} + + set config(configuration: Configuration) { + this.configuration = configuration; + } + + get basePath(): string { + return this.configuration.basePath != null + ? this.configuration.basePath + : BASE_PATH; + } + + get fetchApi(): FetchAPI | undefined { + return this.configuration.fetchApi; + } + + get middleware(): Middleware[] { + return this.configuration.middleware || []; + } + + get queryParamsStringify(): (params: HTTPQuery) => string { + return this.configuration.queryParamsStringify || querystring; + } + + get username(): string | undefined { + return this.configuration.username; + } + + get password(): string | undefined { + return this.configuration.password; + } + + get apiKey(): ((name: string) => string) | undefined { + const apiKey = this.configuration.apiKey; + if (apiKey) { + return typeof apiKey === 'function' ? apiKey : () => apiKey; + } + return undefined; + } + + get accessToken(): + | ((name?: string, scopes?: string[]) => string | Promise) + | undefined { + const accessToken = this.configuration.accessToken; + if (accessToken) { + return typeof accessToken === 'function' + ? accessToken + : async () => accessToken; + } + return undefined; + } + + get headers(): HTTPHeaders | undefined { + return this.configuration.headers; + } + + get credentials(): RequestCredentials | undefined { + return this.configuration.credentials; + } +} + +export const DefaultConfig = new Configuration(); + +/** + * This is the base class for all generated API classes. + */ +export class BaseAPI { + private static readonly jsonRegex = new RegExp( + '^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', + 'i' + ); + private middleware: Middleware[]; + + constructor(protected configuration = DefaultConfig) { + this.middleware = configuration.middleware; + } + + withMiddleware(this: T, ...middlewares: Middleware[]) { + const next = this.clone(); + next.middleware = next.middleware.concat(...middlewares); + return next; + } + + withPreMiddleware( + this: T, + ...preMiddlewares: Array + ) { + const middlewares = preMiddlewares.map((pre) => ({ pre })); + return this.withMiddleware(...middlewares); + } + + withPostMiddleware( + this: T, + ...postMiddlewares: Array + ) { + const middlewares = postMiddlewares.map((post) => ({ post })); + return this.withMiddleware(...middlewares); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + + protected async request( + context: RequestOpts, + initOverrides?: RequestInit | InitOverrideFunction + ): Promise { + const { url, init } = await this.createFetchParams(context, initOverrides); + const response = await this.fetchApi(url, init); + if (response && response.status >= 200 && response.status < 300) { + return response; + } + throw new ResponseError(response, 'Response returned an error code'); + } + + private async createFetchParams( + context: RequestOpts, + initOverrides?: RequestInit | InitOverrideFunction + ) { + let url = this.configuration.basePath + context.path; + if ( + context.query !== undefined && + Object.keys(context.query).length !== 0 + ) { + // only add the querystring to the URL if there are query parameters. + // this is done to avoid urls ending with a "?" character which buggy webservers + // do not handle correctly sometimes. + url += '?' + this.configuration.queryParamsStringify(context.query); + } + + const headers = Object.assign( + {}, + this.configuration.headers, + context.headers + ); + Object.keys(headers).forEach((key) => + headers[key] === undefined ? delete headers[key] : {} + ); + + const initOverrideFn = + typeof initOverrides === 'function' + ? initOverrides + : async () => initOverrides; + + const initParams = { + method: context.method, + headers, + body: context.body, + credentials: this.configuration.credentials, + }; + + const overriddenInit: RequestInit = { + ...initParams, + ...(await initOverrideFn({ + init: initParams, + context, + })), + }; + + let body: any; + if ( + isFormData(overriddenInit.body) || + overriddenInit.body instanceof URLSearchParams || + isBlob(overriddenInit.body) + ) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + + const init: RequestInit = { + ...overriddenInit, + body, + }; + + return { url, init }; + } + + private fetchApi = async (url: string, init: RequestInit) => { + let fetchParams = { url, init }; + for (const middleware of this.middleware) { + if (middleware.pre) { + fetchParams = + (await middleware.pre({ + fetch: this.fetchApi, + ...fetchParams, + })) || fetchParams; + } + } + let response: Response | undefined = undefined; + try { + response = await (this.configuration.fetchApi || fetch)( + fetchParams.url, + fetchParams.init + ); + } catch (e) { + for (const middleware of this.middleware) { + if (middleware.onError) { + response = + (await middleware.onError({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + error: e, + response: response ? response.clone() : undefined, + })) || response; + } + } + if (response === undefined) { + if (e instanceof Error) { + throw new FetchError( + e, + 'The request failed and the interceptors did not return an alternative response' + ); + } else { + throw e; + } + } + } + for (const middleware of this.middleware) { + if (middleware.post) { + response = + (await middleware.post({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + response: response.clone(), + })) || response; + } + } + return response; + }; + + /** + * Create a shallow clone of `this` by constructing a new instance + * and then shallow cloning data members. + */ + private clone(this: T): T { + const constructor = this.constructor as any; + const next = new constructor(this.configuration); + next.middleware = this.middleware.slice(); + return next; + } +} + +function isBlob(value: any): value is Blob { + return typeof Blob !== 'undefined' && value instanceof Blob; +} + +function isFormData(value: any): value is FormData { + return typeof FormData !== 'undefined' && value instanceof FormData; +} + +export class ResponseError extends Error { + override name: 'ResponseError' = 'ResponseError'; + constructor(public response: Response, msg?: string) { + super(msg); + } +} + +export class FetchError extends Error { + override name: 'FetchError' = 'FetchError'; + constructor(public cause: Error, msg?: string) { + super(msg); + } +} + +export class RequiredError extends Error { + override name: 'RequiredError' = 'RequiredError'; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +export const COLLECTION_FORMATS = { + csv: ',', + ssv: ' ', + tsv: '\t', + pipes: '|', +}; + +export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; + +export type Json = any; +export type HTTPMethod = + | 'GET' + | 'POST' + | 'PUT' + | 'PATCH' + | 'DELETE' + | 'OPTIONS' + | 'HEAD'; +export type HTTPHeaders = { [key: string]: string }; +export type HTTPQuery = { + [key: string]: + | string + | number + | null + | boolean + | Array + | Set + | HTTPQuery; +}; +export type HTTPBody = Json | FormData | URLSearchParams; +export type HTTPRequestInit = { + headers?: HTTPHeaders; + method: HTTPMethod; + credentials?: RequestCredentials; + body?: HTTPBody; +}; +export type ModelPropertyNaming = + | 'camelCase' + | 'snake_case' + | 'PascalCase' + | 'original'; + +export type InitOverrideFunction = (requestContext: { + init: HTTPRequestInit; + context: RequestOpts; +}) => Promise; + +export interface FetchParams { + url: string; + init: RequestInit; +} + +export interface RequestOpts { + path: string; + method: HTTPMethod; + headers: HTTPHeaders; + query?: HTTPQuery; + body?: HTTPBody; +} + +export function exists(json: any, key: string) { + const value = json[key]; + return value !== null && value !== undefined; +} + +export function querystring(params: HTTPQuery, prefix: string = ''): string { + return Object.keys(params) + .map((key) => querystringSingleKey(key, params[key], prefix)) + .filter((part) => part.length > 0) + .join('&'); +} + +function querystringSingleKey( + key: string, + value: + | string + | number + | null + | undefined + | boolean + | Array + | Set + | HTTPQuery, + keyPrefix: string = '' +): string { + const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); + if (value instanceof Array) { + const multiValue = value + .map((singleValue) => encodeURIComponent(String(singleValue))) + .join(`&${encodeURIComponent(fullKey)}=`); + return `${encodeURIComponent(fullKey)}=${multiValue}`; + } + if (value instanceof Set) { + const valueAsArray = Array.from(value); + return querystringSingleKey(key, valueAsArray, keyPrefix); + } + if (value instanceof Date) { + return `${encodeURIComponent(fullKey)}=${encodeURIComponent( + value.toISOString() + )}`; + } + if (value instanceof Object) { + return querystring(value as HTTPQuery, fullKey); + } + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; +} + +export function mapValues(data: any, fn: (item: any) => any) { + return Object.keys(data).reduce( + (acc, key) => ({ ...acc, [key]: fn(data[key]) }), + {} + ); +} + +export function canConsumeForm(consumes: Consume[]): boolean { + for (const consume of consumes) { + if ('multipart/form-data' === consume.contentType) { + return true; + } + } + return false; +} + +export interface Consume { + contentType: string; +} + +export interface RequestContext { + fetch: FetchAPI; + url: string; + init: RequestInit; +} + +export interface ResponseContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + response: Response; +} + +export interface ErrorContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + error: unknown; + response?: Response; +} + +export interface Middleware { + pre?(context: RequestContext): Promise; + post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; +} + +export interface ApiResponse { + raw: Response; + value(): Promise; +} + +export interface ResponseTransformer { + (json: any): T; +} + +export class JSONApiResponse { + constructor( + public raw: Response, + private transformer: ResponseTransformer = (jsonValue: any) => jsonValue + ) {} + + async value(): Promise { + return this.transformer(await this.raw.json()); + } +} + +export class VoidApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return undefined; + } +} + +export class BlobApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.blob(); + } +} + +export class TextApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.text(); + } +} diff --git a/src/pinecone-generated-ts-fetch/data/api_version.ts b/src/pinecone-generated-ts-fetch/data/api_version.ts new file mode 100644 index 00000000..d0567824 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/api_version.ts @@ -0,0 +1 @@ +export const X_PINECONE_API_VERSION = '2024-07'; diff --git a/src/pinecone-generated-ts-fetch/data/apis/DataPlaneApi.ts b/src/pinecone-generated-ts-fetch/data/apis/DataPlaneApi.ts new file mode 100644 index 00000000..33a9b146 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/apis/DataPlaneApi.ts @@ -0,0 +1,587 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import * as runtime from '../runtime'; +import type { + DeleteRequest, + DescribeIndexStatsRequest, + DescribeIndexStatsResponse, + FetchResponse, + ListResponse, + QueryRequest, + QueryResponse, + RpcStatus, + UpdateRequest, + UpsertRequest, + UpsertResponse, +} from '../models/index'; +import { + DeleteRequestFromJSON, + DeleteRequestToJSON, + DescribeIndexStatsRequestFromJSON, + DescribeIndexStatsRequestToJSON, + DescribeIndexStatsResponseFromJSON, + DescribeIndexStatsResponseToJSON, + FetchResponseFromJSON, + FetchResponseToJSON, + ListResponseFromJSON, + ListResponseToJSON, + QueryRequestFromJSON, + QueryRequestToJSON, + QueryResponseFromJSON, + QueryResponseToJSON, + RpcStatusFromJSON, + RpcStatusToJSON, + UpdateRequestFromJSON, + UpdateRequestToJSON, + UpsertRequestFromJSON, + UpsertRequestToJSON, + UpsertResponseFromJSON, + UpsertResponseToJSON, +} from '../models/index'; + +export interface DeleteOperationRequest { + deleteRequest: DeleteRequest; +} + +export interface AltDeleteRequest { + ids?: Array; + deleteAll?: boolean; + namespace?: string; +} + +export interface DescribeIndexStatsOperationRequest { + describeIndexStatsRequest: DescribeIndexStatsRequest; +} + +export interface FetchRequest { + ids: Array; + namespace?: string; +} + +export interface ListRequest { + prefix?: string; + limit?: number; + paginationToken?: string; + namespace?: string; +} + +export interface QueryOperationRequest { + queryRequest: QueryRequest; +} + +export interface UpdateOperationRequest { + updateRequest: UpdateRequest; +} + +export interface UpsertOperationRequest { + upsertRequest: UpsertRequest; +} + +/** + * + */ +export class DataPlaneApi extends runtime.BaseAPI { + /** + * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + * Delete vectors + */ + async _deleteRaw( + requestParameters: DeleteOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.deleteRequest === null || + requestParameters.deleteRequest === undefined + ) { + throw new runtime.RequiredError( + 'deleteRequest', + 'Required parameter requestParameters.deleteRequest was null or undefined when calling _delete.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/vectors/delete`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: DeleteRequestToJSON(requestParameters.deleteRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response); + } + + /** + * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + * Delete vectors + */ + async _delete( + requestParameters: DeleteOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this._deleteRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/api/data-plane/delete) instead. + * Delete vectors + */ + async altDeleteRaw( + requestParameters: AltDeleteRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + const queryParameters: any = {}; + + if (requestParameters.ids) { + queryParameters['ids'] = requestParameters.ids; + } + + if (requestParameters.deleteAll !== undefined) { + queryParameters['deleteAll'] = requestParameters.deleteAll; + } + + if (requestParameters.namespace !== undefined) { + queryParameters['namespace'] = requestParameters.namespace; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/vectors/delete`, + method: 'DELETE', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response); + } + + /** + * DEPRECATED. Use [`POST /delete`](https://docs.pinecone.io/reference/api/data-plane/delete) instead. + * Delete vectors + */ + async altDelete( + requestParameters: AltDeleteRequest = {}, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.altDeleteRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/api/data-plane/describeindexstats) instead. + * Get index stats + */ + async altDescribeIndexStatsRaw( + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/describe_index_stats`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + DescribeIndexStatsResponseFromJSON(jsonValue) + ); + } + + /** + * DEPRECATED. Use [`POST /describe_index_stats`](https://docs.pinecone.io/reference/api/data-plane/describeindexstats) instead. + * Get index stats + */ + async altDescribeIndexStats( + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.altDescribeIndexStatsRaw(initOverrides); + return await response.value(); + } + + /** + * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, 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://docs.pinecone.io/reference/api/control-plane/describe_index). + * 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.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/describe_index_stats`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: DescribeIndexStatsRequestToJSON( + requestParameters.describeIndexStatsRequest + ), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + DescribeIndexStatsResponseFromJSON(jsonValue) + ); + } + + /** + * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, 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://docs.pinecone.io/reference/api/control-plane/describe_index). + * Get index stats + */ + 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. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + * Fetch vectors + */ + async fetchRaw( + requestParameters: FetchRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if (requestParameters.ids === null || requestParameters.ids === undefined) { + throw new runtime.RequiredError( + 'ids', + 'Required parameter requestParameters.ids was null or undefined when calling fetch.' + ); + } + + const queryParameters: any = {}; + + if (requestParameters.ids) { + queryParameters['ids'] = requestParameters.ids; + } + + if (requestParameters.namespace !== undefined) { + queryParameters['namespace'] = requestParameters.namespace; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/vectors/fetch`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + FetchResponseFromJSON(jsonValue) + ); + } + + /** + * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + * Fetch vectors + */ + async fetch( + requestParameters: FetchRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.fetchRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * 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 [List record IDs](https://docs.pinecone.io/guides/data/list-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 [List record IDs](https://docs.pinecone.io/guides/data/list-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/guides/data/query-data). + * Query vectors + */ + async queryRaw( + requestParameters: QueryOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.queryRequest === null || + requestParameters.queryRequest === undefined + ) { + throw new runtime.RequiredError( + 'queryRequest', + 'Required parameter requestParameters.queryRequest was null or undefined when calling query.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/query`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: QueryRequestToJSON(requestParameters.queryRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + QueryResponseFromJSON(jsonValue) + ); + } + + /** + * The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + * Query vectors + */ + async query( + requestParameters: QueryOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.queryRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * 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/guides/data/update-data). + * Update a vector + */ + async updateRaw( + requestParameters: UpdateOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.updateRequest === null || + requestParameters.updateRequest === undefined + ) { + throw new runtime.RequiredError( + 'updateRequest', + 'Required parameter requestParameters.updateRequest was null or undefined when calling update.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/vectors/update`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UpdateRequestToJSON(requestParameters.updateRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response); + } + + /** + * The `update` operation updates 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/guides/data/update-data). + * Update a vector + */ + async update( + requestParameters: UpdateOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.updateRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + * Upsert vectors + */ + async upsertRaw( + requestParameters: UpsertOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise> { + if ( + requestParameters.upsertRequest === null || + requestParameters.upsertRequest === undefined + ) { + throw new runtime.RequiredError( + 'upsertRequest', + 'Required parameter requestParameters.upsertRequest was null or undefined when calling upsert.' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + if (this.configuration && this.configuration.apiKey) { + headerParameters['Api-Key'] = this.configuration.apiKey('Api-Key'); // ApiKeyAuth authentication + } + + const response = await this.request( + { + path: `/vectors/upsert`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: UpsertRequestToJSON(requestParameters.upsertRequest), + }, + initOverrides + ); + + return new runtime.JSONApiResponse(response, (jsonValue) => + UpsertResponseFromJSON(jsonValue) + ); + } + + /** + * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + * Upsert vectors + */ + async upsert( + requestParameters: UpsertOperationRequest, + initOverrides?: RequestInit | runtime.InitOverrideFunction + ): Promise { + const response = await this.upsertRaw(requestParameters, initOverrides); + return await response.value(); + } +} diff --git a/src/pinecone-generated-ts-fetch/data/apis/index.ts b/src/pinecone-generated-ts-fetch/data/apis/index.ts new file mode 100644 index 00000000..cc6cc1ac --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/apis/index.ts @@ -0,0 +1,3 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './DataPlaneApi'; diff --git a/src/pinecone-generated-ts-fetch/data/index.ts b/src/pinecone-generated-ts-fetch/data/index.ts new file mode 100644 index 00000000..91e0ae58 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/index.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './apis/index'; +export * from './models/index'; +export * from './api_version'; diff --git a/src/pinecone-generated-ts-fetch/data/models/DeleteRequest.ts b/src/pinecone-generated-ts-fetch/data/models/DeleteRequest.ts new file mode 100644 index 00000000..8c362170 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/DeleteRequest.ts @@ -0,0 +1,90 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * The request for the `Delete` operation. + * @export + * @interface DeleteRequest + */ +export interface DeleteRequest { + /** + * Vectors to delete. + * @type {Array} + * @memberof DeleteRequest + */ + ids?: Array; + /** + * This indicates that all vectors in the index namespace should be deleted. + * @type {boolean} + * @memberof DeleteRequest + */ + deleteAll?: boolean; + /** + * The namespace to delete vectors from, if applicable. + * @type {string} + * @memberof DeleteRequest + */ + namespace?: string; + /** + * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). + * Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID. + * @type {object} + * @memberof DeleteRequest + */ + filter?: object; +} + +/** + * Check if a given object implements the DeleteRequest interface. + */ +export function instanceOfDeleteRequest(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function DeleteRequestFromJSON(json: any): DeleteRequest { + return DeleteRequestFromJSONTyped(json, false); +} + +export function DeleteRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): DeleteRequest { + if (json === undefined || json === null) { + return json; + } + return { + ids: !exists(json, 'ids') ? undefined : json['ids'], + deleteAll: !exists(json, 'deleteAll') ? undefined : json['deleteAll'], + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + filter: !exists(json, 'filter') ? undefined : json['filter'], + }; +} + +export function DeleteRequestToJSON(value?: DeleteRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + ids: value.ids, + deleteAll: value.deleteAll, + namespace: value.namespace, + filter: value.filter, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsRequest.ts b/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsRequest.ts new file mode 100644 index 00000000..b9845de6 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsRequest.ts @@ -0,0 +1,71 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * The request for the `describe_index_stats` operation. + * @export + * @interface DescribeIndexStatsRequest + */ +export interface DescribeIndexStatsRequest { + /** + * If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). + * + * Serverless indexes do not support filtering `describe_index_stats` by metadata. + * @type {object} + * @memberof DescribeIndexStatsRequest + */ + filter?: object; +} + +/** + * Check if a given object implements the DescribeIndexStatsRequest interface. + */ +export function instanceOfDescribeIndexStatsRequest(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function DescribeIndexStatsRequestFromJSON( + json: any +): DescribeIndexStatsRequest { + return DescribeIndexStatsRequestFromJSONTyped(json, false); +} + +export function DescribeIndexStatsRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): DescribeIndexStatsRequest { + if (json === undefined || json === null) { + return json; + } + return { + filter: !exists(json, 'filter') ? undefined : json['filter'], + }; +} + +export function DescribeIndexStatsRequestToJSON( + value?: DescribeIndexStatsRequest | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + filter: value.filter, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsResponse.ts b/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsResponse.ts new file mode 100644 index 00000000..1be71c56 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/DescribeIndexStatsResponse.ts @@ -0,0 +1,113 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { NamespaceSummary } from './NamespaceSummary'; +import { + NamespaceSummaryFromJSON, + NamespaceSummaryFromJSONTyped, + NamespaceSummaryToJSON, +} from './NamespaceSummary'; + +/** + * The response for the `describe_index_stats` operation. + * @export + * @interface DescribeIndexStatsResponse + */ +export interface DescribeIndexStatsResponse { + /** + * A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression. + * @type {{ [key: string]: NamespaceSummary; }} + * @memberof DescribeIndexStatsResponse + */ + namespaces?: { [key: string]: NamespaceSummary }; + /** + * The dimension of the indexed vectors. + * @type {number} + * @memberof DescribeIndexStatsResponse + */ + dimension?: number; + /** + * The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. + * + * Serverless indexes scale automatically as needed, so index fullness is relevant only 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://docs.pinecone.io/reference/api/control-plane/describe_index). + * @type {number} + * @memberof DescribeIndexStatsResponse + */ + indexFullness?: number; + /** + * The total number of vectors in the index, regardless of whether a metadata filter expression was passed + * @type {number} + * @memberof DescribeIndexStatsResponse + */ + totalVectorCount?: number; +} + +/** + * Check if a given object implements the DescribeIndexStatsResponse interface. + */ +export function instanceOfDescribeIndexStatsResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function DescribeIndexStatsResponseFromJSON( + json: any +): DescribeIndexStatsResponse { + return DescribeIndexStatsResponseFromJSONTyped(json, false); +} + +export function DescribeIndexStatsResponseFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): DescribeIndexStatsResponse { + if (json === undefined || json === null) { + return json; + } + return { + namespaces: !exists(json, 'namespaces') + ? undefined + : mapValues(json['namespaces'], NamespaceSummaryFromJSON), + dimension: !exists(json, 'dimension') ? undefined : json['dimension'], + indexFullness: !exists(json, 'indexFullness') + ? undefined + : json['indexFullness'], + totalVectorCount: !exists(json, 'totalVectorCount') + ? undefined + : json['totalVectorCount'], + }; +} + +export function DescribeIndexStatsResponseToJSON( + value?: DescribeIndexStatsResponse | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + namespaces: + value.namespaces === undefined + ? undefined + : mapValues(value.namespaces, NamespaceSummaryToJSON), + dimension: value.dimension, + indexFullness: value.indexFullness, + totalVectorCount: value.totalVectorCount, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/FetchResponse.ts b/src/pinecone-generated-ts-fetch/data/models/FetchResponse.ts new file mode 100644 index 00000000..bdd0b4c3 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/FetchResponse.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * 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 { Usage } from './Usage'; +import { UsageFromJSON, UsageFromJSONTyped, UsageToJSON } from './Usage'; +import type { Vector } from './Vector'; +import { VectorFromJSON, VectorFromJSONTyped, VectorToJSON } from './Vector'; + +/** + * The response for the `fetch` operation. + * @export + * @interface FetchResponse + */ +export interface FetchResponse { + /** + * + * @type {{ [key: string]: Vector; }} + * @memberof FetchResponse + */ + vectors?: { [key: string]: Vector }; + /** + * The namespace of the vectors. + * @type {string} + * @memberof FetchResponse + */ + namespace?: string; + /** + * + * @type {Usage} + * @memberof FetchResponse + */ + usage?: Usage; +} + +/** + * Check if a given object implements the FetchResponse interface. + */ +export function instanceOfFetchResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function FetchResponseFromJSON(json: any): FetchResponse { + return FetchResponseFromJSONTyped(json, false); +} + +export function FetchResponseFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): FetchResponse { + if (json === undefined || json === null) { + return json; + } + return { + vectors: !exists(json, 'vectors') + ? undefined + : mapValues(json['vectors'], VectorFromJSON), + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + usage: !exists(json, 'usage') ? undefined : UsageFromJSON(json['usage']), + }; +} + +export function FetchResponseToJSON(value?: FetchResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + vectors: + value.vectors === undefined + ? undefined + : mapValues(value.vectors, VectorToJSON), + namespace: value.namespace, + usage: UsageToJSON(value.usage), + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/ListItem.ts b/src/pinecone-generated-ts-fetch/data/models/ListItem.ts similarity index 51% rename from src/pinecone-generated-ts-fetch/models/ListItem.ts rename to src/pinecone-generated-ts-fetch/data/models/ListItem.ts index e222522b..b5536c60 100644 --- a/src/pinecone-generated-ts-fetch/models/ListItem.ts +++ b/src/pinecone-generated-ts-fetch/data/models/ListItem.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pinecone Control Plane API + * Pinecone Data 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 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -14,52 +14,52 @@ import { exists, mapValues } from '../runtime'; /** - * + * * @export * @interface ListItem */ export interface ListItem { - /** - * - * @type {string} - * @memberof ListItem - */ - id?: string; + /** + * + * @type {string} + * @memberof ListItem + */ + id?: string; } /** * Check if a given object implements the ListItem interface. */ export function instanceOfListItem(value: object): boolean { - let isInstance = true; + let isInstance = true; - return isInstance; + return isInstance; } export function ListItemFromJSON(json: any): ListItem { - return ListItemFromJSONTyped(json, false); + 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 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, - }; + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + id: value.id, + }; } - diff --git a/src/pinecone-generated-ts-fetch/data/models/ListResponse.ts b/src/pinecone-generated-ts-fetch/data/models/ListResponse.ts new file mode 100644 index 00000000..804bf736 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/ListResponse.ts @@ -0,0 +1,111 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * 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/data/models/NamespaceSummary.ts b/src/pinecone-generated-ts-fetch/data/models/NamespaceSummary.ts new file mode 100644 index 00000000..d09426de --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/NamespaceSummary.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * A summary of the contents of a namespace. + * @export + * @interface NamespaceSummary + */ +export interface NamespaceSummary { + /** + * The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the underlying index and corresponding query results, etc. + * @type {number} + * @memberof NamespaceSummary + */ + vectorCount?: number; +} + +/** + * Check if a given object implements the NamespaceSummary interface. + */ +export function instanceOfNamespaceSummary(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function NamespaceSummaryFromJSON(json: any): NamespaceSummary { + return NamespaceSummaryFromJSONTyped(json, false); +} + +export function NamespaceSummaryFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): NamespaceSummary { + if (json === undefined || json === null) { + return json; + } + return { + vectorCount: !exists(json, 'vectorCount') ? undefined : json['vectorCount'], + }; +} + +export function NamespaceSummaryToJSON(value?: NamespaceSummary | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + vectorCount: value.vectorCount, + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/Pagination.ts b/src/pinecone-generated-ts-fetch/data/models/Pagination.ts similarity index 51% rename from src/pinecone-generated-ts-fetch/models/Pagination.ts rename to src/pinecone-generated-ts-fetch/data/models/Pagination.ts index ef7762ea..c2fc48ad 100644 --- a/src/pinecone-generated-ts-fetch/models/Pagination.ts +++ b/src/pinecone-generated-ts-fetch/data/models/Pagination.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pinecone Control Plane API + * Pinecone Data 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 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -14,52 +14,52 @@ import { exists, mapValues } from '../runtime'; /** - * + * * @export * @interface Pagination */ export interface Pagination { - /** - * - * @type {string} - * @memberof Pagination - */ - next?: string; + /** + * + * @type {string} + * @memberof Pagination + */ + next?: string; } /** * Check if a given object implements the Pagination interface. */ export function instanceOfPagination(value: object): boolean { - let isInstance = true; + let isInstance = true; - return isInstance; + return isInstance; } export function PaginationFromJSON(json: any): Pagination { - return PaginationFromJSONTyped(json, false); + 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 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, - }; + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + next: value.next, + }; } - diff --git a/src/pinecone-generated-ts-fetch/data/models/ProtobufAny.ts b/src/pinecone-generated-ts-fetch/data/models/ProtobufAny.ts new file mode 100644 index 00000000..64951a24 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/ProtobufAny.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * + * @export + * @interface ProtobufAny + */ +export interface ProtobufAny { + /** + * + * @type {string} + * @memberof ProtobufAny + */ + typeUrl?: string; + /** + * + * @type {string} + * @memberof ProtobufAny + */ + value?: string; +} + +/** + * Check if a given object implements the ProtobufAny interface. + */ +export function instanceOfProtobufAny(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function ProtobufAnyFromJSON(json: any): ProtobufAny { + return ProtobufAnyFromJSONTyped(json, false); +} + +export function ProtobufAnyFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ProtobufAny { + if (json === undefined || json === null) { + return json; + } + return { + typeUrl: !exists(json, 'typeUrl') ? undefined : json['typeUrl'], + value: !exists(json, 'value') ? undefined : json['value'], + }; +} + +export function ProtobufAnyToJSON(value?: ProtobufAny | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + typeUrl: value.typeUrl, + value: value.value, + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts b/src/pinecone-generated-ts-fetch/data/models/ProtobufNullValue.ts similarity index 54% rename from src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts rename to src/pinecone-generated-ts-fetch/data/models/ProtobufNullValue.ts index 2ee75dbc..144f8610 100644 --- a/src/pinecone-generated-ts-fetch/models/ProtobufNullValue.ts +++ b/src/pinecone-generated-ts-fetch/data/models/ProtobufNullValue.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pinecone Control Plane API + * Pinecone Data 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 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -12,31 +12,28 @@ * Do not edit the class manually. */ - /** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - * - * - NULL_VALUE: Null value. + * `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. + * The JSON representation for `NullValue` is JSON `null`. * @export */ export const ProtobufNullValue = { - NullValue: 'NULL_VALUE' + NullValue: 'NULL_VALUE', } as const; -export type ProtobufNullValue = typeof ProtobufNullValue[keyof typeof ProtobufNullValue]; - +export type ProtobufNullValue = + (typeof ProtobufNullValue)[keyof typeof ProtobufNullValue]; export function ProtobufNullValueFromJSON(json: any): ProtobufNullValue { - return ProtobufNullValueFromJSONTyped(json, false); + return ProtobufNullValueFromJSONTyped(json, false); } -export function ProtobufNullValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProtobufNullValue { - return json as ProtobufNullValue; +export function ProtobufNullValueFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ProtobufNullValue { + return json as ProtobufNullValue; } export function ProtobufNullValueToJSON(value?: ProtobufNullValue | null): any { - return value as any; + return value as any; } - diff --git a/src/pinecone-generated-ts-fetch/data/models/QueryRequest.ts b/src/pinecone-generated-ts-fetch/data/models/QueryRequest.ts new file mode 100644 index 00000000..f112ae77 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/QueryRequest.ts @@ -0,0 +1,155 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { QueryVector } from './QueryVector'; +import { + QueryVectorFromJSON, + QueryVectorFromJSONTyped, + QueryVectorToJSON, +} from './QueryVector'; +import type { SparseValues } from './SparseValues'; +import { + SparseValuesFromJSON, + SparseValuesFromJSONTyped, + SparseValuesToJSON, +} from './SparseValues'; + +/** + * The request for the `query` operation. + * @export + * @interface QueryRequest + */ +export interface QueryRequest { + /** + * The namespace to query. + * @type {string} + * @memberof QueryRequest + */ + namespace?: string; + /** + * The number of results to return for each query. + * @type {number} + * @memberof QueryRequest + */ + topK: number; + /** + * The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). + * @type {object} + * @memberof QueryRequest + */ + filter?: object; + /** + * Indicates whether vector values are included in the response. + * @type {boolean} + * @memberof QueryRequest + */ + includeValues?: boolean; + /** + * Indicates whether metadata is included in the response as well as the ids. + * @type {boolean} + * @memberof QueryRequest + */ + includeMetadata?: boolean; + /** + * DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. + * @type {Array} + * @memberof QueryRequest + * @deprecated + */ + queries?: Array; + /** + * The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`. + * @type {Array} + * @memberof QueryRequest + */ + vector?: Array; + /** + * + * @type {SparseValues} + * @memberof QueryRequest + */ + sparseVector?: SparseValues; + /** + * The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. + * @type {string} + * @memberof QueryRequest + */ + id?: string; +} + +/** + * Check if a given object implements the QueryRequest interface. + */ +export function instanceOfQueryRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'topK' in value; + + return isInstance; +} + +export function QueryRequestFromJSON(json: any): QueryRequest { + return QueryRequestFromJSONTyped(json, false); +} + +export function QueryRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): QueryRequest { + if (json === undefined || json === null) { + return json; + } + return { + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + topK: json['topK'], + filter: !exists(json, 'filter') ? undefined : json['filter'], + includeValues: !exists(json, 'includeValues') + ? undefined + : json['includeValues'], + includeMetadata: !exists(json, 'includeMetadata') + ? undefined + : json['includeMetadata'], + queries: !exists(json, 'queries') + ? undefined + : (json['queries'] as Array).map(QueryVectorFromJSON), + vector: !exists(json, 'vector') ? undefined : json['vector'], + sparseVector: !exists(json, 'sparseVector') + ? undefined + : SparseValuesFromJSON(json['sparseVector']), + id: !exists(json, 'id') ? undefined : json['id'], + }; +} + +export function QueryRequestToJSON(value?: QueryRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + namespace: value.namespace, + topK: value.topK, + filter: value.filter, + includeValues: value.includeValues, + includeMetadata: value.includeMetadata, + queries: + value.queries === undefined + ? undefined + : (value.queries as Array).map(QueryVectorToJSON), + vector: value.vector, + sparseVector: SparseValuesToJSON(value.sparseVector), + id: value.id, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/QueryResponse.ts b/src/pinecone-generated-ts-fetch/data/models/QueryResponse.ts new file mode 100644 index 00000000..1a7ae75d --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/QueryResponse.ts @@ -0,0 +1,115 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { ScoredVector } from './ScoredVector'; +import { + ScoredVectorFromJSON, + ScoredVectorFromJSONTyped, + ScoredVectorToJSON, +} from './ScoredVector'; +import type { SingleQueryResults } from './SingleQueryResults'; +import { + SingleQueryResultsFromJSON, + SingleQueryResultsFromJSONTyped, + SingleQueryResultsToJSON, +} from './SingleQueryResults'; +import type { Usage } from './Usage'; +import { UsageFromJSON, UsageFromJSONTyped, UsageToJSON } 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. + * @export + * @interface QueryResponse + */ +export interface QueryResponse { + /** + * DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`. + * @type {Array} + * @memberof QueryResponse + * @deprecated + */ + results?: Array; + /** + * The matches for the vectors. + * @type {Array} + * @memberof QueryResponse + */ + matches?: Array; + /** + * The namespace for the vectors. + * @type {string} + * @memberof QueryResponse + */ + namespace?: string; + /** + * + * @type {Usage} + * @memberof QueryResponse + */ + usage?: Usage; +} + +/** + * Check if a given object implements the QueryResponse interface. + */ +export function instanceOfQueryResponse(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function QueryResponseFromJSON(json: any): QueryResponse { + return QueryResponseFromJSONTyped(json, false); +} + +export function QueryResponseFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): QueryResponse { + if (json === undefined || json === null) { + return json; + } + return { + results: !exists(json, 'results') + ? undefined + : (json['results'] as Array).map(SingleQueryResultsFromJSON), + matches: !exists(json, 'matches') + ? undefined + : (json['matches'] as Array).map(ScoredVectorFromJSON), + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + usage: !exists(json, 'usage') ? undefined : UsageFromJSON(json['usage']), + }; +} + +export function QueryResponseToJSON(value?: QueryResponse | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + results: + value.results === undefined + ? undefined + : (value.results as Array).map(SingleQueryResultsToJSON), + matches: + value.matches === undefined + ? undefined + : (value.matches as Array).map(ScoredVectorToJSON), + namespace: value.namespace, + usage: UsageToJSON(value.usage), + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/QueryVector.ts b/src/pinecone-generated-ts-fetch/data/models/QueryVector.ts new file mode 100644 index 00000000..1a6786ee --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/QueryVector.ts @@ -0,0 +1,107 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { SparseValues } from './SparseValues'; +import { + SparseValuesFromJSON, + SparseValuesFromJSONTyped, + SparseValuesToJSON, +} from './SparseValues'; + +/** + * A single query vector within a `QueryRequest`. + * @export + * @interface QueryVector + */ +export interface QueryVector { + /** + * The query vector values. This should be the same length as the dimension of the index being queried. + * @type {Array} + * @memberof QueryVector + */ + values: Array; + /** + * + * @type {SparseValues} + * @memberof QueryVector + */ + sparseValues?: SparseValues; + /** + * An override for the number of results to return for this query vector. + * @type {number} + * @memberof QueryVector + */ + topK?: number; + /** + * An override the namespace to search. + * @type {string} + * @memberof QueryVector + */ + namespace?: string; + /** + * An override for the metadata filter to apply. This replaces the request-level filter. + * @type {object} + * @memberof QueryVector + */ + filter?: object; +} + +/** + * Check if a given object implements the QueryVector interface. + */ +export function instanceOfQueryVector(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'values' in value; + + return isInstance; +} + +export function QueryVectorFromJSON(json: any): QueryVector { + return QueryVectorFromJSONTyped(json, false); +} + +export function QueryVectorFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): QueryVector { + if (json === undefined || json === null) { + return json; + } + return { + values: json['values'], + sparseValues: !exists(json, 'sparseValues') + ? undefined + : SparseValuesFromJSON(json['sparseValues']), + topK: !exists(json, 'topK') ? undefined : json['topK'], + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + filter: !exists(json, 'filter') ? undefined : json['filter'], + }; +} + +export function QueryVectorToJSON(value?: QueryVector | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + values: value.values, + sparseValues: SparseValuesToJSON(value.sparseValues), + topK: value.topK, + namespace: value.namespace, + filter: value.filter, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/RpcStatus.ts b/src/pinecone-generated-ts-fetch/data/models/RpcStatus.ts new file mode 100644 index 00000000..66d73a44 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/RpcStatus.ts @@ -0,0 +1,93 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { ProtobufAny } from './ProtobufAny'; +import { + ProtobufAnyFromJSON, + ProtobufAnyFromJSONTyped, + ProtobufAnyToJSON, +} from './ProtobufAny'; + +/** + * + * @export + * @interface RpcStatus + */ +export interface RpcStatus { + /** + * + * @type {number} + * @memberof RpcStatus + */ + code?: number; + /** + * + * @type {string} + * @memberof RpcStatus + */ + message?: string; + /** + * + * @type {Array} + * @memberof RpcStatus + */ + details?: Array; +} + +/** + * Check if a given object implements the RpcStatus interface. + */ +export function instanceOfRpcStatus(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function RpcStatusFromJSON(json: any): RpcStatus { + return RpcStatusFromJSONTyped(json, false); +} + +export function RpcStatusFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): RpcStatus { + if (json === undefined || json === null) { + return json; + } + return { + code: !exists(json, 'code') ? undefined : json['code'], + message: !exists(json, 'message') ? undefined : json['message'], + details: !exists(json, 'details') + ? undefined + : (json['details'] as Array).map(ProtobufAnyFromJSON), + }; +} + +export function RpcStatusToJSON(value?: RpcStatus | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + code: value.code, + message: value.message, + details: + value.details === undefined + ? undefined + : (value.details as Array).map(ProtobufAnyToJSON), + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/ScoredVector.ts b/src/pinecone-generated-ts-fetch/data/models/ScoredVector.ts new file mode 100644 index 00000000..22282ce9 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/ScoredVector.ts @@ -0,0 +1,107 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { SparseValues } from './SparseValues'; +import { + SparseValuesFromJSON, + SparseValuesFromJSONTyped, + SparseValuesToJSON, +} from './SparseValues'; + +/** + * + * @export + * @interface ScoredVector + */ +export interface ScoredVector { + /** + * This is the vector's unique id. + * @type {string} + * @memberof ScoredVector + */ + id: string; + /** + * This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. + * @type {number} + * @memberof ScoredVector + */ + score?: number; + /** + * This is the vector data, if it is requested. + * @type {Array} + * @memberof ScoredVector + */ + values?: Array; + /** + * + * @type {SparseValues} + * @memberof ScoredVector + */ + sparseValues?: SparseValues; + /** + * This is the metadata, if it is requested. + * @type {object} + * @memberof ScoredVector + */ + metadata?: object; +} + +/** + * Check if a given object implements the ScoredVector interface. + */ +export function instanceOfScoredVector(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'id' in value; + + return isInstance; +} + +export function ScoredVectorFromJSON(json: any): ScoredVector { + return ScoredVectorFromJSONTyped(json, false); +} + +export function ScoredVectorFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): ScoredVector { + if (json === undefined || json === null) { + return json; + } + return { + id: json['id'], + score: !exists(json, 'score') ? undefined : json['score'], + values: !exists(json, 'values') ? undefined : json['values'], + sparseValues: !exists(json, 'sparseValues') + ? undefined + : SparseValuesFromJSON(json['sparseValues']), + metadata: !exists(json, 'metadata') ? undefined : json['metadata'], + }; +} + +export function ScoredVectorToJSON(value?: ScoredVector | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + id: value.id, + score: value.score, + values: value.values, + sparseValues: SparseValuesToJSON(value.sparseValues), + metadata: value.metadata, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/SingleQueryResults.ts b/src/pinecone-generated-ts-fetch/data/models/SingleQueryResults.ts new file mode 100644 index 00000000..7db435ca --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/SingleQueryResults.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { ScoredVector } from './ScoredVector'; +import { + ScoredVectorFromJSON, + ScoredVectorFromJSONTyped, + ScoredVectorToJSON, +} from './ScoredVector'; + +/** + * + * @export + * @interface SingleQueryResults + */ +export interface SingleQueryResults { + /** + * The matches for the vectors. + * @type {Array} + * @memberof SingleQueryResults + */ + matches?: Array; + /** + * The namespace for the vectors. + * @type {string} + * @memberof SingleQueryResults + */ + namespace?: string; +} + +/** + * Check if a given object implements the SingleQueryResults interface. + */ +export function instanceOfSingleQueryResults(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function SingleQueryResultsFromJSON(json: any): SingleQueryResults { + return SingleQueryResultsFromJSONTyped(json, false); +} + +export function SingleQueryResultsFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): SingleQueryResults { + if (json === undefined || json === null) { + return json; + } + return { + matches: !exists(json, 'matches') + ? undefined + : (json['matches'] as Array).map(ScoredVectorFromJSON), + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + }; +} + +export function SingleQueryResultsToJSON( + value?: SingleQueryResults | null +): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + matches: + value.matches === undefined + ? undefined + : (value.matches as Array).map(ScoredVectorToJSON), + namespace: value.namespace, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/SparseValues.ts b/src/pinecone-generated-ts-fetch/data/models/SparseValues.ts new file mode 100644 index 00000000..d3c76d1f --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/SparseValues.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +/** + * Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. + * @export + * @interface SparseValues + */ +export interface SparseValues { + /** + * The indices of the sparse data. + * @type {Array} + * @memberof SparseValues + */ + indices: Array; + /** + * The corresponding values of the sparse data, which must be with the same length as the indices. + * @type {Array} + * @memberof SparseValues + */ + values: Array; +} + +/** + * Check if a given object implements the SparseValues interface. + */ +export function instanceOfSparseValues(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'indices' in value; + isInstance = isInstance && 'values' in value; + + return isInstance; +} + +export function SparseValuesFromJSON(json: any): SparseValues { + return SparseValuesFromJSONTyped(json, false); +} + +export function SparseValuesFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): SparseValues { + if (json === undefined || json === null) { + return json; + } + return { + indices: json['indices'], + values: json['values'], + }; +} + +export function SparseValuesToJSON(value?: SparseValues | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + indices: value.indices, + values: value.values, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/UpdateRequest.ts b/src/pinecone-generated-ts-fetch/data/models/UpdateRequest.ts new file mode 100644 index 00000000..1076bedb --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/UpdateRequest.ts @@ -0,0 +1,107 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { SparseValues } from './SparseValues'; +import { + SparseValuesFromJSON, + SparseValuesFromJSONTyped, + SparseValuesToJSON, +} from './SparseValues'; + +/** + * The request for the `update` operation. + * @export + * @interface UpdateRequest + */ +export interface UpdateRequest { + /** + * Vector's unique id. + * @type {string} + * @memberof UpdateRequest + */ + id: string; + /** + * Vector data. + * @type {Array} + * @memberof UpdateRequest + */ + values?: Array; + /** + * + * @type {SparseValues} + * @memberof UpdateRequest + */ + sparseValues?: SparseValues; + /** + * Metadata to set for the vector. + * @type {object} + * @memberof UpdateRequest + */ + setMetadata?: object; + /** + * The namespace containing the vector to update. + * @type {string} + * @memberof UpdateRequest + */ + namespace?: string; +} + +/** + * Check if a given object implements the UpdateRequest interface. + */ +export function instanceOfUpdateRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'id' in value; + + return isInstance; +} + +export function UpdateRequestFromJSON(json: any): UpdateRequest { + return UpdateRequestFromJSONTyped(json, false); +} + +export function UpdateRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): UpdateRequest { + if (json === undefined || json === null) { + return json; + } + return { + id: json['id'], + values: !exists(json, 'values') ? undefined : json['values'], + sparseValues: !exists(json, 'sparseValues') + ? undefined + : SparseValuesFromJSON(json['sparseValues']), + setMetadata: !exists(json, 'setMetadata') ? undefined : json['setMetadata'], + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + }; +} + +export function UpdateRequestToJSON(value?: UpdateRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + id: value.id, + values: value.values, + sparseValues: SparseValuesToJSON(value.sparseValues), + setMetadata: value.setMetadata, + namespace: value.namespace, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/UpsertRequest.ts b/src/pinecone-generated-ts-fetch/data/models/UpsertRequest.ts new file mode 100644 index 00000000..66faae92 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/UpsertRequest.ts @@ -0,0 +1,77 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { Vector } from './Vector'; +import { VectorFromJSON, VectorFromJSONTyped, VectorToJSON } from './Vector'; + +/** + * The request for the `upsert` operation. + * @export + * @interface UpsertRequest + */ +export interface UpsertRequest { + /** + * An array containing the vectors to upsert. Recommended batch limit is 100 vectors. + * @type {Array} + * @memberof UpsertRequest + */ + vectors: Array; + /** + * The namespace where you upsert vectors. + * @type {string} + * @memberof UpsertRequest + */ + namespace?: string; +} + +/** + * Check if a given object implements the UpsertRequest interface. + */ +export function instanceOfUpsertRequest(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'vectors' in value; + + return isInstance; +} + +export function UpsertRequestFromJSON(json: any): UpsertRequest { + return UpsertRequestFromJSONTyped(json, false); +} + +export function UpsertRequestFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): UpsertRequest { + if (json === undefined || json === null) { + return json; + } + return { + vectors: (json['vectors'] as Array).map(VectorFromJSON), + namespace: !exists(json, 'namespace') ? undefined : json['namespace'], + }; +} + +export function UpsertRequestToJSON(value?: UpsertRequest | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + vectors: (value.vectors as Array).map(VectorToJSON), + namespace: value.namespace, + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts b/src/pinecone-generated-ts-fetch/data/models/UpsertResponse.ts similarity index 50% rename from src/pinecone-generated-ts-fetch/models/UpsertResponse.ts rename to src/pinecone-generated-ts-fetch/data/models/UpsertResponse.ts index bbdf27af..0d976b48 100644 --- a/src/pinecone-generated-ts-fetch/models/UpsertResponse.ts +++ b/src/pinecone-generated-ts-fetch/data/models/UpsertResponse.ts @@ -1,10 +1,10 @@ /* tslint:disable */ /* eslint-disable */ /** - * Pinecone Control Plane API + * Pinecone Data 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 + * The version of the OpenAPI document: 2024-07 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -19,47 +19,49 @@ import { exists, mapValues } from '../runtime'; * @interface UpsertResponse */ export interface UpsertResponse { - /** - * The number of vectors upserted. - * @type {number} - * @memberof UpsertResponse - */ - upsertedCount?: number; + /** + * The number of vectors upserted. + * @type {number} + * @memberof UpsertResponse + */ + upsertedCount?: number; } /** * Check if a given object implements the UpsertResponse interface. */ export function instanceOfUpsertResponse(value: object): boolean { - let isInstance = true; + let isInstance = true; - return isInstance; + return isInstance; } export function UpsertResponseFromJSON(json: any): UpsertResponse { - return UpsertResponseFromJSONTyped(json, false); + return UpsertResponseFromJSONTyped(json, false); } -export function UpsertResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpsertResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'upsertedCount': !exists(json, 'upsertedCount') ? undefined : json['upsertedCount'], - }; +export function UpsertResponseFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): UpsertResponse { + if (json === undefined || json === null) { + return json; + } + return { + upsertedCount: !exists(json, 'upsertedCount') + ? undefined + : json['upsertedCount'], + }; } export function UpsertResponseToJSON(value?: UpsertResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'upsertedCount': value.upsertedCount, - }; + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + upsertedCount: value.upsertedCount, + }; } - diff --git a/src/pinecone-generated-ts-fetch/data/models/Usage.ts b/src/pinecone-generated-ts-fetch/data/models/Usage.ts new file mode 100644 index 00000000..5e8232ea --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/Usage.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * 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 Usage + */ +export interface Usage { + /** + * The number of read units consumed by this operation. + * @type {number} + * @memberof Usage + */ + readUnits?: number; +} + +/** + * Check if a given object implements the Usage interface. + */ +export function instanceOfUsage(value: object): boolean { + let isInstance = true; + + return isInstance; +} + +export function UsageFromJSON(json: any): Usage { + return UsageFromJSONTyped(json, false); +} + +export function UsageFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): Usage { + if (json === undefined || json === null) { + return json; + } + return { + readUnits: !exists(json, 'readUnits') ? undefined : json['readUnits'], + }; +} + +export function UsageToJSON(value?: Usage | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + readUnits: value.readUnits, + }; +} diff --git a/src/pinecone-generated-ts-fetch/data/models/Vector.ts b/src/pinecone-generated-ts-fetch/data/models/Vector.ts new file mode 100644 index 00000000..cf17d13b --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/models/Vector.ts @@ -0,0 +1,100 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { exists, mapValues } from '../runtime'; +import type { SparseValues } from './SparseValues'; +import { + SparseValuesFromJSON, + SparseValuesFromJSONTyped, + SparseValuesToJSON, +} from './SparseValues'; + +/** + * + * @export + * @interface Vector + */ +export interface Vector { + /** + * This is the vector's unique id. + * @type {string} + * @memberof Vector + */ + id: string; + /** + * This is the vector data included in the request. + * @type {Array} + * @memberof Vector + */ + values: Array; + /** + * + * @type {SparseValues} + * @memberof Vector + */ + sparseValues?: SparseValues; + /** + * This is the metadata included in the request. + * @type {object} + * @memberof Vector + */ + metadata?: object; +} + +/** + * Check if a given object implements the Vector interface. + */ +export function instanceOfVector(value: object): boolean { + let isInstance = true; + isInstance = isInstance && 'id' in value; + isInstance = isInstance && 'values' in value; + + return isInstance; +} + +export function VectorFromJSON(json: any): Vector { + return VectorFromJSONTyped(json, false); +} + +export function VectorFromJSONTyped( + json: any, + ignoreDiscriminator: boolean +): Vector { + if (json === undefined || json === null) { + return json; + } + return { + id: json['id'], + values: json['values'], + sparseValues: !exists(json, 'sparseValues') + ? undefined + : SparseValuesFromJSON(json['sparseValues']), + metadata: !exists(json, 'metadata') ? undefined : json['metadata'], + }; +} + +export function VectorToJSON(value?: Vector | null): any { + if (value === undefined) { + return undefined; + } + if (value === null) { + return null; + } + return { + id: value.id, + values: value.values, + sparseValues: SparseValuesToJSON(value.sparseValues), + metadata: value.metadata, + }; +} diff --git a/src/pinecone-generated-ts-fetch/models/index.ts b/src/pinecone-generated-ts-fetch/data/models/index.ts similarity index 51% rename from src/pinecone-generated-ts-fetch/models/index.ts rename to src/pinecone-generated-ts-fetch/data/models/index.ts index b2e7dbe6..5ba2b902 100644 --- a/src/pinecone-generated-ts-fetch/models/index.ts +++ b/src/pinecone-generated-ts-fetch/data/models/index.ts @@ -1,31 +1,13 @@ /* tslint:disable */ /* eslint-disable */ -export * from './CollectionList'; -export * from './CollectionModel'; -export * from './ConfigureIndexRequest'; -export * from './ConfigureIndexRequestSpec'; -export * from './ConfigureIndexRequestSpecPod'; -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 './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'; export * from './ProtobufNullValue'; export * from './QueryRequest'; @@ -33,7 +15,6 @@ export * from './QueryResponse'; export * from './QueryVector'; export * from './RpcStatus'; export * from './ScoredVector'; -export * from './ServerlessSpec'; export * from './SingleQueryResults'; export * from './SparseValues'; export * from './UpdateRequest'; diff --git a/src/pinecone-generated-ts-fetch/data/runtime.ts b/src/pinecone-generated-ts-fetch/data/runtime.ts new file mode 100644 index 00000000..19c137e0 --- /dev/null +++ b/src/pinecone-generated-ts-fetch/data/runtime.ts @@ -0,0 +1,519 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Pinecone Data 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: 2024-07 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +export const BASE_PATH = 'https://unknown'.replace(/\/+$/, ''); + +export interface ConfigurationParameters { + basePath?: string; // override base path + fetchApi?: FetchAPI; // override for fetch implementation + middleware?: Middleware[]; // middleware to apply before/after fetch requests + queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings + username?: string; // parameter for basic security + password?: string; // parameter for basic security + apiKey?: string | ((name: string) => string); // parameter for apiKey security + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security + headers?: HTTPHeaders; //header params we want to use on every request + credentials?: RequestCredentials; //value for the credentials param we want to use on each request +} + +export class Configuration { + constructor(private configuration: ConfigurationParameters = {}) {} + + set config(configuration: Configuration) { + this.configuration = configuration; + } + + get basePath(): string { + return this.configuration.basePath != null + ? this.configuration.basePath + : BASE_PATH; + } + + get fetchApi(): FetchAPI | undefined { + return this.configuration.fetchApi; + } + + get middleware(): Middleware[] { + return this.configuration.middleware || []; + } + + get queryParamsStringify(): (params: HTTPQuery) => string { + return this.configuration.queryParamsStringify || querystring; + } + + get username(): string | undefined { + return this.configuration.username; + } + + get password(): string | undefined { + return this.configuration.password; + } + + get apiKey(): ((name: string) => string) | undefined { + const apiKey = this.configuration.apiKey; + if (apiKey) { + return typeof apiKey === 'function' ? apiKey : () => apiKey; + } + return undefined; + } + + get accessToken(): + | ((name?: string, scopes?: string[]) => string | Promise) + | undefined { + const accessToken = this.configuration.accessToken; + if (accessToken) { + return typeof accessToken === 'function' + ? accessToken + : async () => accessToken; + } + return undefined; + } + + get headers(): HTTPHeaders | undefined { + return this.configuration.headers; + } + + get credentials(): RequestCredentials | undefined { + return this.configuration.credentials; + } +} + +export const DefaultConfig = new Configuration(); + +/** + * This is the base class for all generated API classes. + */ +export class BaseAPI { + private static readonly jsonRegex = new RegExp( + '^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', + 'i' + ); + private middleware: Middleware[]; + + constructor(protected configuration = DefaultConfig) { + this.middleware = configuration.middleware; + } + + withMiddleware(this: T, ...middlewares: Middleware[]) { + const next = this.clone(); + next.middleware = next.middleware.concat(...middlewares); + return next; + } + + withPreMiddleware( + this: T, + ...preMiddlewares: Array + ) { + const middlewares = preMiddlewares.map((pre) => ({ pre })); + return this.withMiddleware(...middlewares); + } + + withPostMiddleware( + this: T, + ...postMiddlewares: Array + ) { + const middlewares = postMiddlewares.map((post) => ({ post })); + return this.withMiddleware(...middlewares); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + + protected async request( + context: RequestOpts, + initOverrides?: RequestInit | InitOverrideFunction + ): Promise { + const { url, init } = await this.createFetchParams(context, initOverrides); + const response = await this.fetchApi(url, init); + if (response && response.status >= 200 && response.status < 300) { + return response; + } + throw new ResponseError(response, 'Response returned an error code'); + } + + private async createFetchParams( + context: RequestOpts, + initOverrides?: RequestInit | InitOverrideFunction + ) { + let url = this.configuration.basePath + context.path; + if ( + context.query !== undefined && + Object.keys(context.query).length !== 0 + ) { + // only add the querystring to the URL if there are query parameters. + // this is done to avoid urls ending with a "?" character which buggy webservers + // do not handle correctly sometimes. + url += '?' + this.configuration.queryParamsStringify(context.query); + } + + const headers = Object.assign( + {}, + this.configuration.headers, + context.headers + ); + Object.keys(headers).forEach((key) => + headers[key] === undefined ? delete headers[key] : {} + ); + + const initOverrideFn = + typeof initOverrides === 'function' + ? initOverrides + : async () => initOverrides; + + const initParams = { + method: context.method, + headers, + body: context.body, + credentials: this.configuration.credentials, + }; + + const overriddenInit: RequestInit = { + ...initParams, + ...(await initOverrideFn({ + init: initParams, + context, + })), + }; + + let body: any; + if ( + isFormData(overriddenInit.body) || + overriddenInit.body instanceof URLSearchParams || + isBlob(overriddenInit.body) + ) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + + const init: RequestInit = { + ...overriddenInit, + body, + }; + + return { url, init }; + } + + private fetchApi = async (url: string, init: RequestInit) => { + let fetchParams = { url, init }; + for (const middleware of this.middleware) { + if (middleware.pre) { + fetchParams = + (await middleware.pre({ + fetch: this.fetchApi, + ...fetchParams, + })) || fetchParams; + } + } + let response: Response | undefined = undefined; + try { + response = await (this.configuration.fetchApi || fetch)( + fetchParams.url, + fetchParams.init + ); + } catch (e) { + for (const middleware of this.middleware) { + if (middleware.onError) { + response = + (await middleware.onError({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + error: e, + response: response ? response.clone() : undefined, + })) || response; + } + } + if (response === undefined) { + if (e instanceof Error) { + throw new FetchError( + e, + 'The request failed and the interceptors did not return an alternative response' + ); + } else { + throw e; + } + } + } + for (const middleware of this.middleware) { + if (middleware.post) { + response = + (await middleware.post({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + response: response.clone(), + })) || response; + } + } + return response; + }; + + /** + * Create a shallow clone of `this` by constructing a new instance + * and then shallow cloning data members. + */ + private clone(this: T): T { + const constructor = this.constructor as any; + const next = new constructor(this.configuration); + next.middleware = this.middleware.slice(); + return next; + } +} + +function isBlob(value: any): value is Blob { + return typeof Blob !== 'undefined' && value instanceof Blob; +} + +function isFormData(value: any): value is FormData { + return typeof FormData !== 'undefined' && value instanceof FormData; +} + +export class ResponseError extends Error { + override name: 'ResponseError' = 'ResponseError'; + constructor(public response: Response, msg?: string) { + super(msg); + } +} + +export class FetchError extends Error { + override name: 'FetchError' = 'FetchError'; + constructor(public cause: Error, msg?: string) { + super(msg); + } +} + +export class RequiredError extends Error { + override name: 'RequiredError' = 'RequiredError'; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +export const COLLECTION_FORMATS = { + csv: ',', + ssv: ' ', + tsv: '\t', + pipes: '|', +}; + +export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; + +export type Json = any; +export type HTTPMethod = + | 'GET' + | 'POST' + | 'PUT' + | 'PATCH' + | 'DELETE' + | 'OPTIONS' + | 'HEAD'; +export type HTTPHeaders = { [key: string]: string }; +export type HTTPQuery = { + [key: string]: + | string + | number + | null + | boolean + | Array + | Set + | HTTPQuery; +}; +export type HTTPBody = Json | FormData | URLSearchParams; +export type HTTPRequestInit = { + headers?: HTTPHeaders; + method: HTTPMethod; + credentials?: RequestCredentials; + body?: HTTPBody; +}; +export type ModelPropertyNaming = + | 'camelCase' + | 'snake_case' + | 'PascalCase' + | 'original'; + +export type InitOverrideFunction = (requestContext: { + init: HTTPRequestInit; + context: RequestOpts; +}) => Promise; + +export interface FetchParams { + url: string; + init: RequestInit; +} + +export interface RequestOpts { + path: string; + method: HTTPMethod; + headers: HTTPHeaders; + query?: HTTPQuery; + body?: HTTPBody; +} + +export function exists(json: any, key: string) { + const value = json[key]; + return value !== null && value !== undefined; +} + +export function querystring(params: HTTPQuery, prefix: string = ''): string { + return Object.keys(params) + .map((key) => querystringSingleKey(key, params[key], prefix)) + .filter((part) => part.length > 0) + .join('&'); +} + +function querystringSingleKey( + key: string, + value: + | string + | number + | null + | undefined + | boolean + | Array + | Set + | HTTPQuery, + keyPrefix: string = '' +): string { + const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); + if (value instanceof Array) { + const multiValue = value + .map((singleValue) => encodeURIComponent(String(singleValue))) + .join(`&${encodeURIComponent(fullKey)}=`); + return `${encodeURIComponent(fullKey)}=${multiValue}`; + } + if (value instanceof Set) { + const valueAsArray = Array.from(value); + return querystringSingleKey(key, valueAsArray, keyPrefix); + } + if (value instanceof Date) { + return `${encodeURIComponent(fullKey)}=${encodeURIComponent( + value.toISOString() + )}`; + } + if (value instanceof Object) { + return querystring(value as HTTPQuery, fullKey); + } + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; +} + +export function mapValues(data: any, fn: (item: any) => any) { + return Object.keys(data).reduce( + (acc, key) => ({ ...acc, [key]: fn(data[key]) }), + {} + ); +} + +export function canConsumeForm(consumes: Consume[]): boolean { + for (const consume of consumes) { + if ('multipart/form-data' === consume.contentType) { + return true; + } + } + return false; +} + +export interface Consume { + contentType: string; +} + +export interface RequestContext { + fetch: FetchAPI; + url: string; + init: RequestInit; +} + +export interface ResponseContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + response: Response; +} + +export interface ErrorContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + error: unknown; + response?: Response; +} + +export interface Middleware { + pre?(context: RequestContext): Promise; + post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; +} + +export interface ApiResponse { + raw: Response; + value(): Promise; +} + +export interface ResponseTransformer { + (json: any): T; +} + +export class JSONApiResponse { + constructor( + public raw: Response, + private transformer: ResponseTransformer = (jsonValue: any) => jsonValue + ) {} + + async value(): Promise { + return this.transformer(await this.raw.json()); + } +} + +export class VoidApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return undefined; + } +} + +export class BlobApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.blob(); + } +} + +export class TextApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.text(); + } +} diff --git a/src/pinecone-generated-ts-fetch/models/CollectionList.ts b/src/pinecone-generated-ts-fetch/models/CollectionList.ts deleted file mode 100644 index a1b311b9..00000000 --- a/src/pinecone-generated-ts-fetch/models/CollectionList.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* 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 { CollectionModel } from './CollectionModel'; -import { - CollectionModelFromJSON, - CollectionModelFromJSONTyped, - CollectionModelToJSON, -} from './CollectionModel'; - -/** - * The list of collections that exist in the project. - * @export - * @interface CollectionList - */ -export interface CollectionList { - /** - * - * @type {Array} - * @memberof CollectionList - */ - collections?: Array; -} - -/** - * Check if a given object implements the CollectionList interface. - */ -export function instanceOfCollectionList(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function CollectionListFromJSON(json: any): CollectionList { - return CollectionListFromJSONTyped(json, false); -} - -export function CollectionListFromJSONTyped(json: any, ignoreDiscriminator: boolean): CollectionList { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'collections': !exists(json, 'collections') ? undefined : ((json['collections'] as Array).map(CollectionModelFromJSON)), - }; -} - -export function CollectionListToJSON(value?: CollectionList | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'collections': value.collections === undefined ? undefined : ((value.collections as Array).map(CollectionModelToJSON)), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CollectionModel.ts b/src/pinecone-generated-ts-fetch/models/CollectionModel.ts deleted file mode 100644 index 7105a3be..00000000 --- a/src/pinecone-generated-ts-fetch/models/CollectionModel.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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'; -/** - * The CollectionModel describes the configuration and status of a Pinecone collection. - * @export - * @interface CollectionModel - */ -export interface CollectionModel { - /** - * - * @type {string} - * @memberof CollectionModel - */ - name: string; - /** - * The size of the collection in bytes. - * @type {number} - * @memberof CollectionModel - */ - size?: number; - /** - * The status of the collection. - * @type {string} - * @memberof CollectionModel - */ - status: CollectionModelStatusEnum; - /** - * 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. - * @type {number} - * @memberof CollectionModel - */ - vectorCount?: number; - /** - * The environment where the collection is hosted. - * @type {string} - * @memberof CollectionModel - */ - environment: string; -} - - -/** - * @export - */ -export const CollectionModelStatusEnum = { - Initializing: 'Initializing', - Ready: 'Ready', - Terminating: 'Terminating' -} as const; -export type CollectionModelStatusEnum = typeof CollectionModelStatusEnum[keyof typeof CollectionModelStatusEnum]; - - -/** - * Check if a given object implements the CollectionModel interface. - */ -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; -} - -export function CollectionModelFromJSON(json: any): CollectionModel { - return CollectionModelFromJSONTyped(json, false); -} - -export function CollectionModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): CollectionModel { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'size': !exists(json, 'size') ? undefined : json['size'], - 'status': json['status'], - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], - 'vectorCount': !exists(json, 'vector_count') ? undefined : json['vector_count'], - 'environment': json['environment'], - }; -} - -export function CollectionModelToJSON(value?: CollectionModel | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'size': value.size, - 'status': value.status, - 'dimension': value.dimension, - 'vector_count': value.vectorCount, - 'environment': value.environment, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts deleted file mode 100644 index 22e8d80f..00000000 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequest.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { ConfigureIndexRequestSpec } from './ConfigureIndexRequestSpec'; -import { - ConfigureIndexRequestSpecFromJSON, - ConfigureIndexRequestSpecFromJSONTyped, - ConfigureIndexRequestSpecToJSON, -} from './ConfigureIndexRequestSpec'; - -/** - * Configuration used to scale an index. - * @export - * @interface ConfigureIndexRequest - */ -export interface ConfigureIndexRequest { - /** - * - * @type {ConfigureIndexRequestSpec} - * @memberof ConfigureIndexRequest - */ - spec: ConfigureIndexRequestSpec; -} - -/** - * Check if a given object implements the ConfigureIndexRequest interface. - */ -export function instanceOfConfigureIndexRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "spec" in value; - - return isInstance; -} - -export function ConfigureIndexRequestFromJSON(json: any): ConfigureIndexRequest { - return ConfigureIndexRequestFromJSONTyped(json, false); -} - -export function ConfigureIndexRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConfigureIndexRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'spec': ConfigureIndexRequestSpecFromJSON(json['spec']), - }; -} - -export function ConfigureIndexRequestToJSON(value?: ConfigureIndexRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'spec': ConfigureIndexRequestSpecToJSON(value.spec), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts deleted file mode 100644 index 8eb8cc10..00000000 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpec.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 { ConfigureIndexRequestSpecPod } from './ConfigureIndexRequestSpecPod'; -import { - ConfigureIndexRequestSpecPodFromJSON, - ConfigureIndexRequestSpecPodFromJSONTyped, - ConfigureIndexRequestSpecPodToJSON, -} from './ConfigureIndexRequestSpecPod'; - -/** - * - * @export - * @interface ConfigureIndexRequestSpec - */ -export interface ConfigureIndexRequestSpec { - /** - * - * @type {ConfigureIndexRequestSpecPod} - * @memberof ConfigureIndexRequestSpec - */ - pod: ConfigureIndexRequestSpecPod; -} - -/** - * Check if a given object implements the ConfigureIndexRequestSpec interface. - */ -export function instanceOfConfigureIndexRequestSpec(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "pod" in value; - - return isInstance; -} - -export function ConfigureIndexRequestSpecFromJSON(json: any): ConfigureIndexRequestSpec { - return ConfigureIndexRequestSpecFromJSONTyped(json, false); -} - -export function ConfigureIndexRequestSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConfigureIndexRequestSpec { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'pod': ConfigureIndexRequestSpecPodFromJSON(json['pod']), - }; -} - -export function ConfigureIndexRequestSpecToJSON(value?: ConfigureIndexRequestSpec | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'pod': ConfigureIndexRequestSpecPodToJSON(value.pod), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts b/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts deleted file mode 100644 index 84854b17..00000000 --- a/src/pinecone-generated-ts-fetch/models/ConfigureIndexRequestSpecPod.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 ConfigureIndexRequestSpecPod - */ -export interface ConfigureIndexRequestSpecPod { - /** - * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. - * @type {number} - * @memberof ConfigureIndexRequestSpecPod - */ - replicas?: number; - /** - * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. - * @type {string} - * @memberof ConfigureIndexRequestSpecPod - */ - podType?: string; -} - -/** - * Check if a given object implements the ConfigureIndexRequestSpecPod interface. - */ -export function instanceOfConfigureIndexRequestSpecPod(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function ConfigureIndexRequestSpecPodFromJSON(json: any): ConfigureIndexRequestSpecPod { - return ConfigureIndexRequestSpecPodFromJSONTyped(json, false); -} - -export function ConfigureIndexRequestSpecPodFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConfigureIndexRequestSpecPod { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], - 'podType': !exists(json, 'pod_type') ? undefined : json['pod_type'], - }; -} - -export function ConfigureIndexRequestSpecPodToJSON(value?: ConfigureIndexRequestSpecPod | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'replicas': value.replicas, - 'pod_type': value.podType, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts deleted file mode 100644 index 31708bbc..00000000 --- a/src/pinecone-generated-ts-fetch/models/CreateCollectionRequest.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* 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'; -/** - * The configuration needed to create a Pinecone collection. - * @export - * @interface CreateCollectionRequest - */ -export interface CreateCollectionRequest { - /** - * 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 - */ - name: string; - /** - * The name of the index to be used as the source for the collection. - * @type {string} - * @memberof CreateCollectionRequest - */ - source: string; -} - -/** - * Check if a given object implements the CreateCollectionRequest interface. - */ -export function instanceOfCreateCollectionRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "source" in value; - - return isInstance; -} - -export function CreateCollectionRequestFromJSON(json: any): CreateCollectionRequest { - return CreateCollectionRequestFromJSONTyped(json, false); -} - -export function CreateCollectionRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateCollectionRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'source': json['source'], - }; -} - -export function CreateCollectionRequestToJSON(value?: CreateCollectionRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'source': value.source, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts deleted file mode 100644 index 00ed10d1..00000000 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequest.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* 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 { CreateIndexRequestSpec } from './CreateIndexRequestSpec'; -import { - CreateIndexRequestSpecFromJSON, - CreateIndexRequestSpecFromJSONTyped, - CreateIndexRequestSpecToJSON, -} from './CreateIndexRequestSpec'; - -/** - * The configuration needed to create a Pinecone index. - * @export - * @interface CreateIndexRequest - */ -export interface CreateIndexRequest { - /** - * 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. - * @type {number} - * @memberof CreateIndexRequest - */ - dimension: number; - /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. - * @type {string} - * @memberof CreateIndexRequest - */ - metric?: CreateIndexRequestMetricEnum; - /** - * - * @type {CreateIndexRequestSpec} - * @memberof CreateIndexRequest - */ - spec: CreateIndexRequestSpec | null; -} - - -/** - * @export - */ -export const CreateIndexRequestMetricEnum = { - Cosine: 'cosine', - Euclidean: 'euclidean', - Dotproduct: 'dotproduct' -} as const; -export type CreateIndexRequestMetricEnum = typeof CreateIndexRequestMetricEnum[keyof typeof CreateIndexRequestMetricEnum]; - - -/** - * Check if a given object implements the CreateIndexRequest interface. - */ -export function instanceOfCreateIndexRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "dimension" in value; - isInstance = isInstance && "spec" in value; - - return isInstance; -} - -export function CreateIndexRequestFromJSON(json: any): CreateIndexRequest { - return CreateIndexRequestFromJSONTyped(json, false); -} - -export function CreateIndexRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateIndexRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'dimension': json['dimension'], - 'metric': !exists(json, 'metric') ? undefined : json['metric'], - 'spec': CreateIndexRequestSpecFromJSON(json['spec']), - }; -} - -export function CreateIndexRequestToJSON(value?: CreateIndexRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'dimension': value.dimension, - 'metric': value.metric, - 'spec': CreateIndexRequestSpecToJSON(value.spec), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts deleted file mode 100644 index 43dca801..00000000 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpec.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* 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 { CreateIndexRequestSpecPod } from './CreateIndexRequestSpecPod'; -import { - CreateIndexRequestSpecPodFromJSON, - CreateIndexRequestSpecPodFromJSONTyped, - CreateIndexRequestSpecPodToJSON, -} from './CreateIndexRequestSpecPod'; -import type { ServerlessSpec } from './ServerlessSpec'; -import { - ServerlessSpecFromJSON, - ServerlessSpecFromJSONTyped, - ServerlessSpecToJSON, -} from './ServerlessSpec'; - -/** - * 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. For more information on creating indexes, - * see [Understanding indexes](https://docs.pinecone.io/guides/indexes/understanding-indexes). - * - * @export - * @interface CreateIndexRequestSpec - */ -export interface CreateIndexRequestSpec { - /** - * - * @type {ServerlessSpec} - * @memberof CreateIndexRequestSpec - */ - serverless?: ServerlessSpec; - /** - * - * @type {CreateIndexRequestSpecPod} - * @memberof CreateIndexRequestSpec - */ - pod?: CreateIndexRequestSpecPod; -} - -/** - * Check if a given object implements the CreateIndexRequestSpec interface. - */ -export function instanceOfCreateIndexRequestSpec(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function CreateIndexRequestSpecFromJSON(json: any): CreateIndexRequestSpec { - return CreateIndexRequestSpecFromJSONTyped(json, false); -} - -export function CreateIndexRequestSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateIndexRequestSpec { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'serverless': !exists(json, 'serverless') ? undefined : ServerlessSpecFromJSON(json['serverless']), - 'pod': !exists(json, 'pod') ? undefined : CreateIndexRequestSpecPodFromJSON(json['pod']), - }; -} - -export function CreateIndexRequestSpecToJSON(value?: CreateIndexRequestSpec | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'serverless': ServerlessSpecToJSON(value.serverless), - 'pod': CreateIndexRequestSpecPodToJSON(value.pod), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts b/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts deleted file mode 100644 index 7c394fc0..00000000 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPod.ts +++ /dev/null @@ -1,122 +0,0 @@ -/* 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 { CreateIndexRequestSpecPodMetadataConfig } from './CreateIndexRequestSpecPodMetadataConfig'; -import { - CreateIndexRequestSpecPodMetadataConfigFromJSON, - CreateIndexRequestSpecPodMetadataConfigFromJSONTyped, - CreateIndexRequestSpecPodMetadataConfigToJSON, -} from './CreateIndexRequestSpecPodMetadataConfig'; - -/** - * Configuration needed to deploy a pod-based index. - * @export - * @interface CreateIndexRequestSpecPod - */ -export interface CreateIndexRequestSpecPod { - /** - * The environment where the index is hosted. - * @type {string} - * @memberof CreateIndexRequestSpecPod - */ - environment: string; - /** - * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. - * @type {number} - * @memberof CreateIndexRequestSpecPod - */ - replicas?: number; - /** - * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. - * @type {string} - * @memberof CreateIndexRequestSpecPod - */ - podType: string; - /** - * The number of pods to be used in the index. This should be equal to `shards` x `replicas`. - * @type {number} - * @memberof CreateIndexRequestSpecPod - */ - pods?: number; - /** - * The number of shards. Shards split your data across multiple pods so you can fit more data into an index. - * @type {number} - * @memberof CreateIndexRequestSpecPod - */ - shards?: number; - /** - * - * @type {CreateIndexRequestSpecPodMetadataConfig} - * @memberof CreateIndexRequestSpecPod - */ - metadataConfig?: CreateIndexRequestSpecPodMetadataConfig; - /** - * The name of the collection to be used as the source for the index. - * @type {string} - * @memberof CreateIndexRequestSpecPod - */ - sourceCollection?: string; -} - -/** - * Check if a given object implements the CreateIndexRequestSpecPod interface. - */ -export function instanceOfCreateIndexRequestSpecPod(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "environment" in value; - isInstance = isInstance && "podType" in value; - - return isInstance; -} - -export function CreateIndexRequestSpecPodFromJSON(json: any): CreateIndexRequestSpecPod { - return CreateIndexRequestSpecPodFromJSONTyped(json, false); -} - -export function CreateIndexRequestSpecPodFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateIndexRequestSpecPod { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'environment': json['environment'], - 'replicas': !exists(json, 'replicas') ? undefined : json['replicas'], - 'podType': json['pod_type'], - 'pods': !exists(json, 'pods') ? undefined : json['pods'], - 'shards': !exists(json, 'shards') ? undefined : json['shards'], - 'metadataConfig': !exists(json, 'metadata_config') ? undefined : CreateIndexRequestSpecPodMetadataConfigFromJSON(json['metadata_config']), - 'sourceCollection': !exists(json, 'source_collection') ? undefined : json['source_collection'], - }; -} - -export function CreateIndexRequestSpecPodToJSON(value?: CreateIndexRequestSpecPod | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'environment': value.environment, - 'replicas': value.replicas, - 'pod_type': value.podType, - 'pods': value.pods, - 'shards': value.shards, - '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 deleted file mode 100644 index 3de52f1d..00000000 --- a/src/pinecone-generated-ts-fetch/models/CreateIndexRequestSpecPodMetadataConfig.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 deleted file mode 100644 index 6f5545d5..00000000 --- a/src/pinecone-generated-ts-fetch/models/DeleteRequest.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* 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'; -/** - * The request for the `Delete` operation. - * @export - * @interface DeleteRequest - */ -export interface DeleteRequest { - /** - * Vectors to delete. - * @type {Array} - * @memberof DeleteRequest - */ - ids?: Array; - /** - * This indicates that all vectors in the index namespace should be deleted. - * @type {boolean} - * @memberof DeleteRequest - */ - deleteAll?: boolean; - /** - * The namespace to delete vectors from, if applicable. - * @type {string} - * @memberof DeleteRequest - */ - namespace?: string; - /** - * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive - * with specifying ids to delete in the ids param or using delete_all=True. - * See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof DeleteRequest - */ - filter?: object; -} - -/** - * Check if a given object implements the DeleteRequest interface. - */ -export function instanceOfDeleteRequest(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DeleteRequestFromJSON(json: any): DeleteRequest { - return DeleteRequestFromJSONTyped(json, false); -} - -export function DeleteRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeleteRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'ids': !exists(json, 'ids') ? undefined : json['ids'], - 'deleteAll': !exists(json, 'deleteAll') ? undefined : json['deleteAll'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function DeleteRequestToJSON(value?: DeleteRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ids': value.ids, - 'deleteAll': value.deleteAll, - 'namespace': value.namespace, - 'filter': value.filter, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts deleted file mode 100644 index f3043f07..00000000 --- a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsRequest.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* 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'; -/** - * The request for the `describe_index_stats` operation. - * @export - * @interface DescribeIndexStatsRequest - */ -export interface DescribeIndexStatsRequest { - /** - * If this parameter is present, the operation only returns statistics - * for vectors that satisfy the filter. - * See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof DescribeIndexStatsRequest - */ - filter?: object; -} - -/** - * Check if a given object implements the DescribeIndexStatsRequest interface. - */ -export function instanceOfDescribeIndexStatsRequest(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DescribeIndexStatsRequestFromJSON(json: any): DescribeIndexStatsRequest { - return DescribeIndexStatsRequestFromJSONTyped(json, false); -} - -export function DescribeIndexStatsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DescribeIndexStatsRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function DescribeIndexStatsRequestToJSON(value?: DescribeIndexStatsRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'filter': value.filter, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts b/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts deleted file mode 100644 index bcfdcfa5..00000000 --- a/src/pinecone-generated-ts-fetch/models/DescribeIndexStatsResponse.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* 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 { NamespaceSummary } from './NamespaceSummary'; -import { - NamespaceSummaryFromJSON, - NamespaceSummaryFromJSONTyped, - NamespaceSummaryToJSON, -} from './NamespaceSummary'; - -/** - * The response for the `describe_index_stats` operation. - * @export - * @interface DescribeIndexStatsResponse - */ -export interface DescribeIndexStatsResponse { - /** - * A mapping for each namespace in the index from the namespace name to a - * summary of its contents. If a metadata filter expression is present, the - * summary will reflect only vectors matching that expression. - * @type {{ [key: string]: NamespaceSummary; }} - * @memberof DescribeIndexStatsResponse - */ - namespaces?: { [key: string]: NamespaceSummary; }; - /** - * The dimension of the indexed vectors. - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - dimension?: number; - /** - * The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - indexFullness?: number; - /** - * - * @type {number} - * @memberof DescribeIndexStatsResponse - */ - totalVectorCount?: number; -} - -/** - * Check if a given object implements the DescribeIndexStatsResponse interface. - */ -export function instanceOfDescribeIndexStatsResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function DescribeIndexStatsResponseFromJSON(json: any): DescribeIndexStatsResponse { - return DescribeIndexStatsResponseFromJSONTyped(json, false); -} - -export function DescribeIndexStatsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DescribeIndexStatsResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'namespaces': !exists(json, 'namespaces') ? undefined : (mapValues(json['namespaces'], NamespaceSummaryFromJSON)), - 'dimension': !exists(json, 'dimension') ? undefined : json['dimension'], - 'indexFullness': !exists(json, 'indexFullness') ? undefined : json['indexFullness'], - 'totalVectorCount': !exists(json, 'totalVectorCount') ? undefined : json['totalVectorCount'], - }; -} - -export function DescribeIndexStatsResponseToJSON(value?: DescribeIndexStatsResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'namespaces': value.namespaces === undefined ? undefined : (mapValues(value.namespaces, NamespaceSummaryToJSON)), - 'dimension': value.dimension, - 'indexFullness': value.indexFullness, - 'totalVectorCount': value.totalVectorCount, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts b/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts deleted file mode 100644 index 61cb9fa5..00000000 --- a/src/pinecone-generated-ts-fetch/models/ErrorResponse.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* 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 { ErrorResponseError } from './ErrorResponseError'; -import { - ErrorResponseErrorFromJSON, - ErrorResponseErrorFromJSONTyped, - ErrorResponseErrorToJSON, -} from './ErrorResponseError'; - -/** - * The response shape used for all error responses. - * @export - * @interface ErrorResponse - */ -export interface ErrorResponse { - /** - * The HTTP status code of the error. - * @type {number} - * @memberof ErrorResponse - */ - status: number; - /** - * - * @type {ErrorResponseError} - * @memberof ErrorResponse - */ - error: ErrorResponseError; -} - -/** - * Check if a given object implements the ErrorResponse interface. - */ -export function instanceOfErrorResponse(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "status" in value; - isInstance = isInstance && "error" in value; - - return isInstance; -} - -export function ErrorResponseFromJSON(json: any): ErrorResponse { - return ErrorResponseFromJSONTyped(json, false); -} - -export function ErrorResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ErrorResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'status': json['status'], - 'error': ErrorResponseErrorFromJSON(json['error']), - }; -} - -export function ErrorResponseToJSON(value?: ErrorResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'status': value.status, - 'error': ErrorResponseErrorToJSON(value.error), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts b/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts deleted file mode 100644 index b8374867..00000000 --- a/src/pinecone-generated-ts-fetch/models/ErrorResponseError.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* 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'; -/** - * Detailed information about the error that occurred. - * @export - * @interface ErrorResponseError - */ -export interface ErrorResponseError { - /** - * - * @type {string} - * @memberof ErrorResponseError - */ - code: ErrorResponseErrorCodeEnum; - /** - * - * @type {string} - * @memberof ErrorResponseError - */ - message: string; - /** - * Additional information about the error. This field is not guaranteed to be present. - * @type {object} - * @memberof ErrorResponseError - */ - details?: object; -} - - -/** - * @export - */ -export const ErrorResponseErrorCodeEnum = { - Ok: 'OK', - Unknown: 'UNKNOWN', - InvalidArgument: 'INVALID_ARGUMENT', - DeadlineExceeded: 'DEADLINE_EXCEEDED', - QuotaExceeded: 'QUOTA_EXCEEDED', - NotFound: 'NOT_FOUND', - AlreadyExists: 'ALREADY_EXISTS', - PermissionDenied: 'PERMISSION_DENIED', - Unauthenticated: 'UNAUTHENTICATED', - ResourceExhausted: 'RESOURCE_EXHAUSTED', - FailedPrecondition: 'FAILED_PRECONDITION', - Aborted: 'ABORTED', - OutOfRange: 'OUT_OF_RANGE', - Unimplemented: 'UNIMPLEMENTED', - Internal: 'INTERNAL', - Unavailable: 'UNAVAILABLE', - DataLoss: 'DATA_LOSS', - Forbidden: 'FORBIDDEN' -} as const; -export type ErrorResponseErrorCodeEnum = typeof ErrorResponseErrorCodeEnum[keyof typeof ErrorResponseErrorCodeEnum]; - - -/** - * Check if a given object implements the ErrorResponseError interface. - */ -export function instanceOfErrorResponseError(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "code" in value; - isInstance = isInstance && "message" in value; - - return isInstance; -} - -export function ErrorResponseErrorFromJSON(json: any): ErrorResponseError { - return ErrorResponseErrorFromJSONTyped(json, false); -} - -export function ErrorResponseErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ErrorResponseError { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'code': json['code'], - 'message': json['message'], - 'details': !exists(json, 'details') ? undefined : json['details'], - }; -} - -export function ErrorResponseErrorToJSON(value?: ErrorResponseError | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'code': value.code, - 'message': value.message, - 'details': value.details, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/FetchResponse.ts b/src/pinecone-generated-ts-fetch/models/FetchResponse.ts deleted file mode 100644 index a2d6d551..00000000 --- a/src/pinecone-generated-ts-fetch/models/FetchResponse.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 { Usage } from './Usage'; -import { - UsageFromJSON, - UsageFromJSONTyped, - UsageToJSON, -} from './Usage'; -import type { Vector } from './Vector'; -import { - VectorFromJSON, - VectorFromJSONTyped, - VectorToJSON, -} from './Vector'; - -/** - * The response for the `fetch` operation. - * @export - * @interface FetchResponse - */ -export interface FetchResponse { - /** - * - * @type {{ [key: string]: Vector; }} - * @memberof FetchResponse - */ - vectors?: { [key: string]: Vector; }; - /** - * The namespace of the vectors. - * @type {string} - * @memberof FetchResponse - */ - namespace?: string; - /** - * - * @type {Usage} - * @memberof FetchResponse - */ - usage?: Usage; -} - -/** - * Check if a given object implements the FetchResponse interface. - */ -export function instanceOfFetchResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function FetchResponseFromJSON(json: any): FetchResponse { - return FetchResponseFromJSONTyped(json, false); -} - -export function FetchResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FetchResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectors': !exists(json, 'vectors') ? undefined : (mapValues(json['vectors'], VectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'usage': !exists(json, 'usage') ? undefined : UsageFromJSON(json['usage']), - }; -} - -export function FetchResponseToJSON(value?: FetchResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectors': value.vectors === undefined ? undefined : (mapValues(value.vectors, VectorToJSON)), - 'namespace': value.namespace, - 'usage': UsageToJSON(value.usage), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/IndexModel.ts b/src/pinecone-generated-ts-fetch/models/IndexModel.ts deleted file mode 100644 index 804606a0..00000000 --- a/src/pinecone-generated-ts-fetch/models/IndexModel.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* 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 { IndexModelSpec } from './IndexModelSpec'; -import { - IndexModelSpecFromJSON, - IndexModelSpecFromJSONTyped, - IndexModelSpecToJSON, -} from './IndexModelSpec'; -import type { IndexModelStatus } from './IndexModelStatus'; -import { - IndexModelStatusFromJSON, - IndexModelStatusFromJSONTyped, - IndexModelStatusToJSON, -} from './IndexModelStatus'; - -/** - * The IndexModel describes the configuration and status of a Pinecone index. - * @export - * @interface IndexModel - */ -export interface IndexModel { - /** - * 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. - * @type {number} - * @memberof IndexModel - */ - dimension: number; - /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. - * @type {string} - * @memberof IndexModel - */ - metric: IndexModelMetricEnum; - /** - * The URL address where the index is hosted. - * @type {string} - * @memberof IndexModel - */ - host: string; - /** - * - * @type {IndexModelSpec} - * @memberof IndexModel - */ - spec: IndexModelSpec; - /** - * - * @type {IndexModelStatus} - * @memberof IndexModel - */ - status: IndexModelStatus; -} - - -/** - * @export - */ -export const IndexModelMetricEnum = { - Cosine: 'cosine', - Euclidean: 'euclidean', - Dotproduct: 'dotproduct' -} as const; -export type IndexModelMetricEnum = typeof IndexModelMetricEnum[keyof typeof IndexModelMetricEnum]; - - -/** - * Check if a given object implements the IndexModel interface. - */ -export function instanceOfIndexModel(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "name" in value; - isInstance = isInstance && "dimension" in value; - isInstance = isInstance && "metric" in value; - isInstance = isInstance && "host" in value; - isInstance = isInstance && "spec" in value; - isInstance = isInstance && "status" in value; - - return isInstance; -} - -export function IndexModelFromJSON(json: any): IndexModel { - return IndexModelFromJSONTyped(json, false); -} - -export function IndexModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexModel { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'name': json['name'], - 'dimension': json['dimension'], - 'metric': json['metric'], - 'host': json['host'], - 'spec': IndexModelSpecFromJSON(json['spec']), - 'status': IndexModelStatusFromJSON(json['status']), - }; -} - -export function IndexModelToJSON(value?: IndexModel | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'name': value.name, - 'dimension': value.dimension, - 'metric': value.metric, - 'host': value.host, - 'spec': IndexModelSpecToJSON(value.spec), - 'status': IndexModelStatusToJSON(value.status), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts b/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts deleted file mode 100644 index 563aaac6..00000000 --- a/src/pinecone-generated-ts-fetch/models/IndexModelSpec.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 { PodSpec } from './PodSpec'; -import { - PodSpecFromJSON, - PodSpecFromJSONTyped, - PodSpecToJSON, -} from './PodSpec'; -import type { ServerlessSpec } from './ServerlessSpec'; -import { - ServerlessSpecFromJSON, - ServerlessSpecFromJSONTyped, - ServerlessSpecToJSON, -} from './ServerlessSpec'; - -/** - * - * @export - * @interface IndexModelSpec - */ -export interface IndexModelSpec { - /** - * - * @type {PodSpec} - * @memberof IndexModelSpec - */ - pod?: PodSpec; - /** - * - * @type {ServerlessSpec} - * @memberof IndexModelSpec - */ - serverless?: ServerlessSpec; -} - -/** - * Check if a given object implements the IndexModelSpec interface. - */ -export function instanceOfIndexModelSpec(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function IndexModelSpecFromJSON(json: any): IndexModelSpec { - return IndexModelSpecFromJSONTyped(json, false); -} - -export function IndexModelSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexModelSpec { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'pod': !exists(json, 'pod') ? undefined : PodSpecFromJSON(json['pod']), - 'serverless': !exists(json, 'serverless') ? undefined : ServerlessSpecFromJSON(json['serverless']), - }; -} - -export function IndexModelSpecToJSON(value?: IndexModelSpec | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'pod': PodSpecToJSON(value.pod), - 'serverless': ServerlessSpecToJSON(value.serverless), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts b/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts deleted file mode 100644 index 348b1613..00000000 --- a/src/pinecone-generated-ts-fetch/models/IndexModelStatus.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* 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 IndexModelStatus - */ -export interface IndexModelStatus { - /** - * - * @type {boolean} - * @memberof IndexModelStatus - */ - ready: boolean; - /** - * - * @type {string} - * @memberof IndexModelStatus - */ - state: IndexModelStatusStateEnum; -} - - -/** - * @export - */ -export const IndexModelStatusStateEnum = { - Initializing: 'Initializing', - InitializationFailed: 'InitializationFailed', - ScalingUp: 'ScalingUp', - ScalingDown: 'ScalingDown', - ScalingUpPodSize: 'ScalingUpPodSize', - ScalingDownPodSize: 'ScalingDownPodSize', - Terminating: 'Terminating', - Ready: 'Ready' -} as const; -export type IndexModelStatusStateEnum = typeof IndexModelStatusStateEnum[keyof typeof IndexModelStatusStateEnum]; - - -/** - * Check if a given object implements the IndexModelStatus interface. - */ -export function instanceOfIndexModelStatus(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "ready" in value; - isInstance = isInstance && "state" in value; - - return isInstance; -} - -export function IndexModelStatusFromJSON(json: any): IndexModelStatus { - return IndexModelStatusFromJSONTyped(json, false); -} - -export function IndexModelStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): IndexModelStatus { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'ready': json['ready'], - 'state': json['state'], - }; -} - -export function IndexModelStatusToJSON(value?: IndexModelStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'ready': value.ready, - 'state': value.state, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ListResponse.ts b/src/pinecone-generated-ts-fetch/models/ListResponse.ts deleted file mode 100644 index 083a7eca..00000000 --- a/src/pinecone-generated-ts-fetch/models/ListResponse.ts +++ /dev/null @@ -1,108 +0,0 @@ -/* 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 deleted file mode 100644 index 4783f6d2..00000000 --- a/src/pinecone-generated-ts-fetch/models/NamespaceSummary.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* 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'; -/** - * A summary of the contents of a namespace. - * @export - * @interface NamespaceSummary - */ -export interface NamespaceSummary { - /** - * The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the - * underlying index and corresponding query results, etc. - * @type {number} - * @memberof NamespaceSummary - */ - vectorCount?: number; -} - -/** - * Check if a given object implements the NamespaceSummary interface. - */ -export function instanceOfNamespaceSummary(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function NamespaceSummaryFromJSON(json: any): NamespaceSummary { - return NamespaceSummaryFromJSONTyped(json, false); -} - -export function NamespaceSummaryFromJSONTyped(json: any, ignoreDiscriminator: boolean): NamespaceSummary { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectorCount': !exists(json, 'vectorCount') ? undefined : json['vectorCount'], - }; -} - -export function NamespaceSummaryToJSON(value?: NamespaceSummary | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectorCount': value.vectorCount, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/PodSpec.ts b/src/pinecone-generated-ts-fetch/models/PodSpec.ts deleted file mode 100644 index fd4737c8..00000000 --- a/src/pinecone-generated-ts-fetch/models/PodSpec.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* 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 { PodSpecMetadataConfig } from './PodSpecMetadataConfig'; -import { - PodSpecMetadataConfigFromJSON, - PodSpecMetadataConfigFromJSONTyped, - PodSpecMetadataConfigToJSON, -} from './PodSpecMetadataConfig'; - -/** - * Configuration needed to deploy a pod-based index. - * @export - * @interface PodSpec - */ -export interface PodSpec { - /** - * The environment where the index is hosted. - * @type {string} - * @memberof PodSpec - */ - environment: string; - /** - * The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change. - * @type {number} - * @memberof PodSpec - */ - replicas: number; - /** - * The number of shards. Shards split your data across multiple pods so you can fit more data into an index. - * @type {number} - * @memberof PodSpec - */ - shards: number; - /** - * The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`. - * @type {string} - * @memberof PodSpec - */ - podType: string; - /** - * The number of pods to be used in the index. This should be equal to `shards` x `replicas`.' - * @type {number} - * @memberof PodSpec - */ - pods: number; - /** - * - * @type {PodSpecMetadataConfig} - * @memberof PodSpec - */ - metadataConfig?: PodSpecMetadataConfig; - /** - * The name of the collection to be used as the source for the index. - * @type {string} - * @memberof PodSpec - */ - sourceCollection?: string; -} - -/** - * Check if a given object implements the PodSpec interface. - */ -export function instanceOfPodSpec(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "environment" in value; - isInstance = isInstance && "replicas" in value; - isInstance = isInstance && "shards" in value; - isInstance = isInstance && "podType" in value; - isInstance = isInstance && "pods" in value; - - return isInstance; -} - -export function PodSpecFromJSON(json: any): PodSpec { - return PodSpecFromJSONTyped(json, false); -} - -export function PodSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): PodSpec { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'environment': json['environment'], - 'replicas': json['replicas'], - 'shards': json['shards'], - 'podType': json['pod_type'], - 'pods': json['pods'], - 'metadataConfig': !exists(json, 'metadata_config') ? undefined : PodSpecMetadataConfigFromJSON(json['metadata_config']), - 'sourceCollection': !exists(json, 'source_collection') ? undefined : json['source_collection'], - }; -} - -export function PodSpecToJSON(value?: PodSpec | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'environment': value.environment, - 'replicas': value.replicas, - 'shards': value.shards, - 'pod_type': value.podType, - 'pods': value.pods, - 'metadata_config': PodSpecMetadataConfigToJSON(value.metadataConfig), - 'source_collection': value.sourceCollection, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts b/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts deleted file mode 100644 index a240f9d6..00000000 --- a/src/pinecone-generated-ts-fetch/models/PodSpecMetadataConfig.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 PodSpecMetadataConfig - */ -export interface PodSpecMetadataConfig { - /** - * 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 - */ - indexed?: Array; -} - -/** - * Check if a given object implements the PodSpecMetadataConfig interface. - */ -export function instanceOfPodSpecMetadataConfig(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function PodSpecMetadataConfigFromJSON(json: any): PodSpecMetadataConfig { - return PodSpecMetadataConfigFromJSONTyped(json, false); -} - -export function PodSpecMetadataConfigFromJSONTyped(json: any, ignoreDiscriminator: boolean): PodSpecMetadataConfig { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'indexed': !exists(json, 'indexed') ? undefined : json['indexed'], - }; -} - -export function PodSpecMetadataConfigToJSON(value?: PodSpecMetadataConfig | 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/ProtobufAny.ts b/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts deleted file mode 100644 index 3c66f9dc..00000000 --- a/src/pinecone-generated-ts-fetch/models/ProtobufAny.ts +++ /dev/null @@ -1,73 +0,0 @@ -/* 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 ProtobufAny - */ -export interface ProtobufAny { - /** - * - * @type {string} - * @memberof ProtobufAny - */ - typeUrl?: string; - /** - * - * @type {string} - * @memberof ProtobufAny - */ - value?: string; -} - -/** - * Check if a given object implements the ProtobufAny interface. - */ -export function instanceOfProtobufAny(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function ProtobufAnyFromJSON(json: any): ProtobufAny { - return ProtobufAnyFromJSONTyped(json, false); -} - -export function ProtobufAnyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProtobufAny { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'typeUrl': !exists(json, 'typeUrl') ? undefined : json['typeUrl'], - 'value': !exists(json, 'value') ? undefined : json['value'], - }; -} - -export function ProtobufAnyToJSON(value?: ProtobufAny | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'typeUrl': value.typeUrl, - 'value': value.value, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/QueryRequest.ts b/src/pinecone-generated-ts-fetch/models/QueryRequest.ts deleted file mode 100644 index 3f5c98d7..00000000 --- a/src/pinecone-generated-ts-fetch/models/QueryRequest.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* 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 { QueryVector } from './QueryVector'; -import { - QueryVectorFromJSON, - QueryVectorFromJSONTyped, - QueryVectorToJSON, -} from './QueryVector'; -import type { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * The request for the `query` operation. - * @export - * @interface QueryRequest - */ -export interface QueryRequest { - /** - * The namespace to query. - * @type {string} - * @memberof QueryRequest - */ - namespace?: string; - /** - * The number of results to return for each query. - * @type {number} - * @memberof QueryRequest - */ - topK: number; - /** - * The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/. - * @type {object} - * @memberof QueryRequest - */ - filter?: object; - /** - * Indicates whether vector values are included in the response. - * @type {boolean} - * @memberof QueryRequest - */ - includeValues?: boolean; - /** - * Indicates whether metadata is included in the response as well as the ids. - * @type {boolean} - * @memberof QueryRequest - */ - includeMetadata?: boolean; - /** - * DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. - * @type {Array} - * @memberof QueryRequest - * @deprecated - */ - queries?: Array; - /** - * The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`. - * @type {Array} - * @memberof QueryRequest - */ - vector?: Array; - /** - * - * @type {SparseValues} - * @memberof QueryRequest - */ - sparseVector?: SparseValues; - /** - * The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`. - * @type {string} - * @memberof QueryRequest - */ - id?: string; -} - -/** - * Check if a given object implements the QueryRequest interface. - */ -export function instanceOfQueryRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "topK" in value; - - return isInstance; -} - -export function QueryRequestFromJSON(json: any): QueryRequest { - return QueryRequestFromJSONTyped(json, false); -} - -export function QueryRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'topK': json['topK'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - 'includeValues': !exists(json, 'includeValues') ? undefined : json['includeValues'], - 'includeMetadata': !exists(json, 'includeMetadata') ? undefined : json['includeMetadata'], - 'queries': !exists(json, 'queries') ? undefined : ((json['queries'] as Array).map(QueryVectorFromJSON)), - 'vector': !exists(json, 'vector') ? undefined : json['vector'], - 'sparseVector': !exists(json, 'sparseVector') ? undefined : SparseValuesFromJSON(json['sparseVector']), - 'id': !exists(json, 'id') ? undefined : json['id'], - }; -} - -export function QueryRequestToJSON(value?: QueryRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'namespace': value.namespace, - 'topK': value.topK, - 'filter': value.filter, - 'includeValues': value.includeValues, - 'includeMetadata': value.includeMetadata, - 'queries': value.queries === undefined ? undefined : ((value.queries as Array).map(QueryVectorToJSON)), - 'vector': value.vector, - 'sparseVector': SparseValuesToJSON(value.sparseVector), - 'id': value.id, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/QueryResponse.ts b/src/pinecone-generated-ts-fetch/models/QueryResponse.ts deleted file mode 100644 index 57123a1d..00000000 --- a/src/pinecone-generated-ts-fetch/models/QueryResponse.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* 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 { ScoredVector } from './ScoredVector'; -import { - ScoredVectorFromJSON, - ScoredVectorFromJSONTyped, - ScoredVectorToJSON, -} from './ScoredVector'; -import type { SingleQueryResults } from './SingleQueryResults'; -import { - SingleQueryResultsFromJSON, - SingleQueryResultsFromJSONTyped, - SingleQueryResultsToJSON, -} from './SingleQueryResults'; -import type { Usage } from './Usage'; -import { - UsageFromJSON, - UsageFromJSONTyped, - UsageToJSON, -} 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. - * @export - * @interface QueryResponse - */ -export interface QueryResponse { - /** - * DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`. - * @type {Array} - * @memberof QueryResponse - * @deprecated - */ - results?: Array; - /** - * The matches for the vectors. - * @type {Array} - * @memberof QueryResponse - */ - matches?: Array; - /** - * The namespace for the vectors. - * @type {string} - * @memberof QueryResponse - */ - namespace?: string; - /** - * - * @type {Usage} - * @memberof QueryResponse - */ - usage?: Usage; -} - -/** - * Check if a given object implements the QueryResponse interface. - */ -export function instanceOfQueryResponse(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function QueryResponseFromJSON(json: any): QueryResponse { - return QueryResponseFromJSONTyped(json, false); -} - -export function QueryResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryResponse { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'results': !exists(json, 'results') ? undefined : ((json['results'] as Array).map(SingleQueryResultsFromJSON)), - 'matches': !exists(json, 'matches') ? undefined : ((json['matches'] as Array).map(ScoredVectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'usage': !exists(json, 'usage') ? undefined : UsageFromJSON(json['usage']), - }; -} - -export function QueryResponseToJSON(value?: QueryResponse | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'results': value.results === undefined ? undefined : ((value.results as Array).map(SingleQueryResultsToJSON)), - 'matches': value.matches === undefined ? undefined : ((value.matches as Array).map(ScoredVectorToJSON)), - 'namespace': value.namespace, - 'usage': UsageToJSON(value.usage), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/QueryVector.ts b/src/pinecone-generated-ts-fetch/models/QueryVector.ts deleted file mode 100644 index 2e7937bc..00000000 --- a/src/pinecone-generated-ts-fetch/models/QueryVector.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * A single query vector within a `QueryRequest`. - * @export - * @interface QueryVector - */ -export interface QueryVector { - /** - * The query vector values. This should be the same length as the dimension of the index being queried. - * @type {Array} - * @memberof QueryVector - */ - values: Array; - /** - * - * @type {SparseValues} - * @memberof QueryVector - */ - sparseValues?: SparseValues; - /** - * An override for the number of results to return for this query vector. - * @type {number} - * @memberof QueryVector - */ - topK?: number; - /** - * An override the namespace to search. - * @type {string} - * @memberof QueryVector - */ - namespace?: string; - /** - * An override for the metadata filter to apply. This replaces the request-level filter. - * @type {object} - * @memberof QueryVector - */ - filter?: object; -} - -/** - * Check if a given object implements the QueryVector interface. - */ -export function instanceOfQueryVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function QueryVectorFromJSON(json: any): QueryVector { - return QueryVectorFromJSONTyped(json, false); -} - -export function QueryVectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): QueryVector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'values': json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'topK': !exists(json, 'topK') ? undefined : json['topK'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - 'filter': !exists(json, 'filter') ? undefined : json['filter'], - }; -} - -export function QueryVectorToJSON(value?: QueryVector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'topK': value.topK, - 'namespace': value.namespace, - 'filter': value.filter, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/RpcStatus.ts b/src/pinecone-generated-ts-fetch/models/RpcStatus.ts deleted file mode 100644 index ce5f1046..00000000 --- a/src/pinecone-generated-ts-fetch/models/RpcStatus.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* 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 { ProtobufAny } from './ProtobufAny'; -import { - ProtobufAnyFromJSON, - ProtobufAnyFromJSONTyped, - ProtobufAnyToJSON, -} from './ProtobufAny'; - -/** - * - * @export - * @interface RpcStatus - */ -export interface RpcStatus { - /** - * - * @type {number} - * @memberof RpcStatus - */ - code?: number; - /** - * - * @type {string} - * @memberof RpcStatus - */ - message?: string; - /** - * - * @type {Array} - * @memberof RpcStatus - */ - details?: Array; -} - -/** - * Check if a given object implements the RpcStatus interface. - */ -export function instanceOfRpcStatus(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function RpcStatusFromJSON(json: any): RpcStatus { - return RpcStatusFromJSONTyped(json, false); -} - -export function RpcStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): RpcStatus { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'code': !exists(json, 'code') ? undefined : json['code'], - 'message': !exists(json, 'message') ? undefined : json['message'], - 'details': !exists(json, 'details') ? undefined : ((json['details'] as Array).map(ProtobufAnyFromJSON)), - }; -} - -export function RpcStatusToJSON(value?: RpcStatus | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'code': value.code, - 'message': value.message, - 'details': value.details === undefined ? undefined : ((value.details as Array).map(ProtobufAnyToJSON)), - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ScoredVector.ts b/src/pinecone-generated-ts-fetch/models/ScoredVector.ts deleted file mode 100644 index 7d238ab7..00000000 --- a/src/pinecone-generated-ts-fetch/models/ScoredVector.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * - * @export - * @interface ScoredVector - */ -export interface ScoredVector { - /** - * This is the vector's unique id. - * @type {string} - * @memberof ScoredVector - */ - id: string; - /** - * This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. - * @type {number} - * @memberof ScoredVector - */ - score?: number; - /** - * This is the vector data, if it is requested. - * @type {Array} - * @memberof ScoredVector - */ - values?: Array; - /** - * - * @type {SparseValues} - * @memberof ScoredVector - */ - sparseValues?: SparseValues; - /** - * This is the metadata, if it is requested. - * @type {object} - * @memberof ScoredVector - */ - metadata?: object; -} - -/** - * Check if a given object implements the ScoredVector interface. - */ -export function instanceOfScoredVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - - return isInstance; -} - -export function ScoredVectorFromJSON(json: any): ScoredVector { - return ScoredVectorFromJSONTyped(json, false); -} - -export function ScoredVectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ScoredVector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'score': !exists(json, 'score') ? undefined : json['score'], - 'values': !exists(json, 'values') ? undefined : json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function ScoredVectorToJSON(value?: ScoredVector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'score': value.score, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'metadata': value.metadata, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts b/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts deleted file mode 100644 index 24dc69dc..00000000 --- a/src/pinecone-generated-ts-fetch/models/ServerlessSpec.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 needed to deploy a serverless index. - * @export - * @interface ServerlessSpec - */ -export interface ServerlessSpec { - /** - * 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. Serverless indexes can be created only in the us-west-2 region of AWS at this time. - * @type {string} - * @memberof ServerlessSpec - */ - region: string; -} - - -/** - * @export - */ -export const ServerlessSpecCloudEnum = { - Gcp: 'gcp', - Aws: 'aws', - Azure: 'azure' -} as const; -export type ServerlessSpecCloudEnum = typeof ServerlessSpecCloudEnum[keyof typeof ServerlessSpecCloudEnum]; - - -/** - * Check if a given object implements the ServerlessSpec interface. - */ -export function instanceOfServerlessSpec(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "cloud" in value; - isInstance = isInstance && "region" in value; - - return isInstance; -} - -export function ServerlessSpecFromJSON(json: any): ServerlessSpec { - return ServerlessSpecFromJSONTyped(json, false); -} - -export function ServerlessSpecFromJSONTyped(json: any, ignoreDiscriminator: boolean): ServerlessSpec { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'cloud': json['cloud'], - 'region': json['region'], - }; -} - -export function ServerlessSpecToJSON(value?: ServerlessSpec | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'cloud': value.cloud, - 'region': value.region, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts b/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts deleted file mode 100644 index 2a6ab965..00000000 --- a/src/pinecone-generated-ts-fetch/models/SingleQueryResults.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 { ScoredVector } from './ScoredVector'; -import { - ScoredVectorFromJSON, - ScoredVectorFromJSONTyped, - ScoredVectorToJSON, -} from './ScoredVector'; - -/** - * - * @export - * @interface SingleQueryResults - */ -export interface SingleQueryResults { - /** - * The matches for the vectors. - * @type {Array} - * @memberof SingleQueryResults - */ - matches?: Array; - /** - * The namespace for the vectors. - * @type {string} - * @memberof SingleQueryResults - */ - namespace?: string; -} - -/** - * Check if a given object implements the SingleQueryResults interface. - */ -export function instanceOfSingleQueryResults(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function SingleQueryResultsFromJSON(json: any): SingleQueryResults { - return SingleQueryResultsFromJSONTyped(json, false); -} - -export function SingleQueryResultsFromJSONTyped(json: any, ignoreDiscriminator: boolean): SingleQueryResults { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'matches': !exists(json, 'matches') ? undefined : ((json['matches'] as Array).map(ScoredVectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function SingleQueryResultsToJSON(value?: SingleQueryResults | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'matches': value.matches === undefined ? undefined : ((value.matches as Array).map(ScoredVectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/SparseValues.ts b/src/pinecone-generated-ts-fetch/models/SparseValues.ts deleted file mode 100644 index a1df99ba..00000000 --- a/src/pinecone-generated-ts-fetch/models/SparseValues.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* 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 SparseValues - */ -export interface SparseValues { - /** - * - * @type {Array} - * @memberof SparseValues - */ - indices: Array; - /** - * - * @type {Array} - * @memberof SparseValues - */ - values: Array; -} - -/** - * Check if a given object implements the SparseValues interface. - */ -export function instanceOfSparseValues(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "indices" in value; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function SparseValuesFromJSON(json: any): SparseValues { - return SparseValuesFromJSONTyped(json, false); -} - -export function SparseValuesFromJSONTyped(json: any, ignoreDiscriminator: boolean): SparseValues { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'indices': json['indices'], - 'values': json['values'], - }; -} - -export function SparseValuesToJSON(value?: SparseValues | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'indices': value.indices, - 'values': value.values, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts b/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts deleted file mode 100644 index b86de27e..00000000 --- a/src/pinecone-generated-ts-fetch/models/UpdateRequest.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 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 { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * The request for the `update` operation. - * @export - * @interface UpdateRequest - */ -export interface UpdateRequest { - /** - * Vector's unique id. - * @type {string} - * @memberof UpdateRequest - */ - id: string; - /** - * Vector data. - * @type {Array} - * @memberof UpdateRequest - */ - values?: Array; - /** - * - * @type {SparseValues} - * @memberof UpdateRequest - */ - sparseValues?: SparseValues; - /** - * Metadata to *set* for the vector. - * @type {object} - * @memberof UpdateRequest - */ - setMetadata?: object; - /** - * Namespace name where to update the vector. - * @type {string} - * @memberof UpdateRequest - */ - namespace?: string; -} - -/** - * Check if a given object implements the UpdateRequest interface. - */ -export function instanceOfUpdateRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - - return isInstance; -} - -export function UpdateRequestFromJSON(json: any): UpdateRequest { - return UpdateRequestFromJSONTyped(json, false); -} - -export function UpdateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'values': !exists(json, 'values') ? undefined : json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'setMetadata': !exists(json, 'setMetadata') ? undefined : json['setMetadata'], - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function UpdateRequestToJSON(value?: UpdateRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'setMetadata': value.setMetadata, - 'namespace': value.namespace, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts b/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts deleted file mode 100644 index b34227d2..00000000 --- a/src/pinecone-generated-ts-fetch/models/UpsertRequest.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* 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 { Vector } from './Vector'; -import { - VectorFromJSON, - VectorFromJSONTyped, - VectorToJSON, -} from './Vector'; - -/** - * The request for the `upsert` operation. - * @export - * @interface UpsertRequest - */ -export interface UpsertRequest { - /** - * An array containing the vectors to upsert. Recommended batch limit is 100 vectors. - * @type {Array} - * @memberof UpsertRequest - */ - vectors: Array; - /** - * This is the namespace name where you upsert vectors. - * @type {string} - * @memberof UpsertRequest - */ - namespace?: string; -} - -/** - * Check if a given object implements the UpsertRequest interface. - */ -export function instanceOfUpsertRequest(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "vectors" in value; - - return isInstance; -} - -export function UpsertRequestFromJSON(json: any): UpsertRequest { - return UpsertRequestFromJSONTyped(json, false); -} - -export function UpsertRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpsertRequest { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'vectors': ((json['vectors'] as Array).map(VectorFromJSON)), - 'namespace': !exists(json, 'namespace') ? undefined : json['namespace'], - }; -} - -export function UpsertRequestToJSON(value?: UpsertRequest | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'vectors': ((value.vectors as Array).map(VectorToJSON)), - 'namespace': value.namespace, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/Usage.ts b/src/pinecone-generated-ts-fetch/models/Usage.ts deleted file mode 100644 index 27abe5c5..00000000 --- a/src/pinecone-generated-ts-fetch/models/Usage.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* 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 Usage - */ -export interface Usage { - /** - * The number of read units consumed by this operation. - * @type {number} - * @memberof Usage - */ - readUnits?: number; -} - -/** - * Check if a given object implements the Usage interface. - */ -export function instanceOfUsage(value: object): boolean { - let isInstance = true; - - return isInstance; -} - -export function UsageFromJSON(json: any): Usage { - return UsageFromJSONTyped(json, false); -} - -export function UsageFromJSONTyped(json: any, ignoreDiscriminator: boolean): Usage { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'readUnits': !exists(json, 'readUnits') ? undefined : json['readUnits'], - }; -} - -export function UsageToJSON(value?: Usage | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'readUnits': value.readUnits, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/models/Vector.ts b/src/pinecone-generated-ts-fetch/models/Vector.ts deleted file mode 100644 index e9307a46..00000000 --- a/src/pinecone-generated-ts-fetch/models/Vector.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* 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 { SparseValues } from './SparseValues'; -import { - SparseValuesFromJSON, - SparseValuesFromJSONTyped, - SparseValuesToJSON, -} from './SparseValues'; - -/** - * - * @export - * @interface Vector - */ -export interface Vector { - /** - * This is the vector's unique id. - * @type {string} - * @memberof Vector - */ - id: string; - /** - * This is the vector data included in the request. - * @type {Array} - * @memberof Vector - */ - values: Array; - /** - * - * @type {SparseValues} - * @memberof Vector - */ - sparseValues?: SparseValues; - /** - * This is the metadata included in the request. - * @type {object} - * @memberof Vector - */ - metadata?: object; -} - -/** - * Check if a given object implements the Vector interface. - */ -export function instanceOfVector(value: object): boolean { - let isInstance = true; - isInstance = isInstance && "id" in value; - isInstance = isInstance && "values" in value; - - return isInstance; -} - -export function VectorFromJSON(json: any): Vector { - return VectorFromJSONTyped(json, false); -} - -export function VectorFromJSONTyped(json: any, ignoreDiscriminator: boolean): Vector { - if ((json === undefined) || (json === null)) { - return json; - } - return { - - 'id': json['id'], - 'values': json['values'], - 'sparseValues': !exists(json, 'sparseValues') ? undefined : SparseValuesFromJSON(json['sparseValues']), - 'metadata': !exists(json, 'metadata') ? undefined : json['metadata'], - }; -} - -export function VectorToJSON(value?: Vector | null): any { - if (value === undefined) { - return undefined; - } - if (value === null) { - return null; - } - return { - - 'id': value.id, - 'values': value.values, - 'sparseValues': SparseValuesToJSON(value.sparseValues), - 'metadata': value.metadata, - }; -} - diff --git a/src/pinecone-generated-ts-fetch/runtime.ts b/src/pinecone-generated-ts-fetch/runtime.ts deleted file mode 100644 index 873d6933..00000000 --- a/src/pinecone-generated-ts-fetch/runtime.ts +++ /dev/null @@ -1,431 +0,0 @@ -/* 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. - */ - - -export const BASE_PATH = "https://api.pinecone.io".replace(/\/+$/, ""); - -export interface ConfigurationParameters { - basePath?: string; // override base path - fetchApi?: FetchAPI; // override for fetch implementation - middleware?: Middleware[]; // middleware to apply before/after fetch requests - queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings - username?: string; // parameter for basic security - password?: string; // parameter for basic security - apiKey?: string | ((name: string) => string); // parameter for apiKey security - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security - headers?: HTTPHeaders; //header params we want to use on every request - credentials?: RequestCredentials; //value for the credentials param we want to use on each request -} - -export class Configuration { - constructor(private configuration: ConfigurationParameters = {}) {} - - set config(configuration: Configuration) { - this.configuration = configuration; - } - - get basePath(): string { - return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; - } - - get fetchApi(): FetchAPI | undefined { - return this.configuration.fetchApi; - } - - get middleware(): Middleware[] { - return this.configuration.middleware || []; - } - - get queryParamsStringify(): (params: HTTPQuery) => string { - return this.configuration.queryParamsStringify || querystring; - } - - get username(): string | undefined { - return this.configuration.username; - } - - get password(): string | undefined { - return this.configuration.password; - } - - get apiKey(): ((name: string) => string) | undefined { - const apiKey = this.configuration.apiKey; - if (apiKey) { - return typeof apiKey === 'function' ? apiKey : () => apiKey; - } - return undefined; - } - - get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { - const accessToken = this.configuration.accessToken; - if (accessToken) { - return typeof accessToken === 'function' ? accessToken : async () => accessToken; - } - return undefined; - } - - get headers(): HTTPHeaders | undefined { - return this.configuration.headers; - } - - get credentials(): RequestCredentials | undefined { - return this.configuration.credentials; - } -} - -export const DefaultConfig = new Configuration(); - -/** - * This is the base class for all generated API classes. - */ -export class BaseAPI { - - private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); - private middleware: Middleware[]; - - constructor(protected configuration = DefaultConfig) { - this.middleware = configuration.middleware; - } - - withMiddleware(this: T, ...middlewares: Middleware[]) { - const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); - return next; - } - - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } - - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } - - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - protected isJsonMime(mime: string | null | undefined): boolean { - if (!mime) { - return false; - } - return BaseAPI.jsonRegex.test(mime); - } - - protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { - const { url, init } = await this.createFetchParams(context, initOverrides); - const response = await this.fetchApi(url, init); - if (response && (response.status >= 200 && response.status < 300)) { - return response; - } - throw new ResponseError(response, 'Response returned an error code'); - } - - private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { - let url = this.configuration.basePath + context.path; - if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. - // this is done to avoid urls ending with a "?" character which buggy webservers - // do not handle correctly sometimes. - url += '?' + this.configuration.queryParamsStringify(context.query); - } - - const headers = Object.assign({}, this.configuration.headers, context.headers); - Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); - - const initOverrideFn = - typeof initOverrides === "function" - ? initOverrides - : async () => initOverrides; - - const initParams = { - method: context.method, - headers, - body: context.body, - credentials: this.configuration.credentials, - }; - - const overriddenInit: RequestInit = { - ...initParams, - ...(await initOverrideFn({ - init: initParams, - context, - })) - }; - - let body: any; - if (isFormData(overriddenInit.body) - || (overriddenInit.body instanceof URLSearchParams) - || isBlob(overriddenInit.body)) { - body = overriddenInit.body; - } else if (this.isJsonMime(headers['Content-Type'])) { - body = JSON.stringify(overriddenInit.body); - } else { - body = overriddenInit.body; - } - - const init: RequestInit = { - ...overriddenInit, - body - }; - - return { url, init }; - } - - private fetchApi = async (url: string, init: RequestInit) => { - let fetchParams = { url, init }; - for (const middleware of this.middleware) { - if (middleware.pre) { - fetchParams = await middleware.pre({ - fetch: this.fetchApi, - ...fetchParams, - }) || fetchParams; - } - } - let response: Response | undefined = undefined; - try { - response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); - } catch (e) { - for (const middleware of this.middleware) { - if (middleware.onError) { - response = await middleware.onError({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - error: e, - response: response ? response.clone() : undefined, - }) || response; - } - } - if (response === undefined) { - if (e instanceof Error) { - throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); - } else { - throw e; - } - } - } - for (const middleware of this.middleware) { - if (middleware.post) { - response = await middleware.post({ - fetch: this.fetchApi, - url: fetchParams.url, - init: fetchParams.init, - response: response.clone(), - }) || response; - } - } - return response; - } - - /** - * Create a shallow clone of `this` by constructing a new instance - * and then shallow cloning data members. - */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } -}; - -function isBlob(value: any): value is Blob { - return typeof Blob !== 'undefined' && value instanceof Blob; -} - -function isFormData(value: any): value is FormData { - return typeof FormData !== "undefined" && value instanceof FormData; -} - -export class ResponseError extends Error { - override name: "ResponseError" = "ResponseError"; - constructor(public response: Response, msg?: string) { - super(msg); - } -} - -export class FetchError extends Error { - override name: "FetchError" = "FetchError"; - constructor(public cause: Error, msg?: string) { - super(msg); - } -} - -export class RequiredError extends Error { - override name: "RequiredError" = "RequiredError"; - constructor(public field: string, msg?: string) { - super(msg); - } -} - -export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", -}; - -export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; - -export type Json = any; -export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; -export type HTTPHeaders = { [key: string]: string }; -export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; -export type HTTPBody = Json | FormData | URLSearchParams; -export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; -export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; - -export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise - -export interface FetchParams { - url: string; - init: RequestInit; -} - -export interface RequestOpts { - path: string; - method: HTTPMethod; - headers: HTTPHeaders; - query?: HTTPQuery; - body?: HTTPBody; -} - -export function exists(json: any, key: string) { - const value = json[key]; - return value !== null && value !== undefined; -} - -export function querystring(params: HTTPQuery, prefix: string = ''): string { - return Object.keys(params) - .map(key => querystringSingleKey(key, params[key], prefix)) - .filter(part => part.length > 0) - .join('&'); -} - -function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { - const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); - if (value instanceof Array) { - const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) - .join(`&${encodeURIComponent(fullKey)}=`); - return `${encodeURIComponent(fullKey)}=${multiValue}`; - } - if (value instanceof Set) { - const valueAsArray = Array.from(value); - return querystringSingleKey(key, valueAsArray, keyPrefix); - } - if (value instanceof Date) { - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; - } - if (value instanceof Object) { - return querystring(value as HTTPQuery, fullKey); - } - return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; -} - -export function mapValues(data: any, fn: (item: any) => any) { - return Object.keys(data).reduce( - (acc, key) => ({ ...acc, [key]: fn(data[key]) }), - {} - ); -} - -export function canConsumeForm(consumes: Consume[]): boolean { - for (const consume of consumes) { - if ('multipart/form-data' === consume.contentType) { - return true; - } - } - return false; -} - -export interface Consume { - contentType: string; -} - -export interface RequestContext { - fetch: FetchAPI; - url: string; - init: RequestInit; -} - -export interface ResponseContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - response: Response; -} - -export interface ErrorContext { - fetch: FetchAPI; - url: string; - init: RequestInit; - error: unknown; - response?: Response; -} - -export interface Middleware { - pre?(context: RequestContext): Promise; - post?(context: ResponseContext): Promise; - onError?(context: ErrorContext): Promise; -} - -export interface ApiResponse { - raw: Response; - value(): Promise; -} - -export interface ResponseTransformer { - (json: any): T; -} - -export class JSONApiResponse { - constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} - - async value(): Promise { - return this.transformer(await this.raw.json()); - } -} - -export class VoidApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return undefined; - } -} - -export class BlobApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.blob(); - }; -} - -export class TextApiResponse { - constructor(public raw: Response) {} - - async value(): Promise { - return await this.raw.text(); - }; -} diff --git a/src/pinecone.ts b/src/pinecone.ts index 340b79bd..aab6fc3a 100644 --- a/src/pinecone.ts +++ b/src/pinecone.ts @@ -16,8 +16,8 @@ import { import { ConfigureIndexRequestSpecPod, CreateCollectionRequest, -} from './pinecone-generated-ts-fetch'; -import type { HTTPHeaders } from './pinecone-generated-ts-fetch'; +} from './pinecone-generated-ts-fetch/control'; +import type { HTTPHeaders } from './pinecone-generated-ts-fetch/control'; import { IndexHostSingleton } from './data/indexHostSingleton'; import { PineconeConfigurationError, diff --git a/src/utils/middleware.ts b/src/utils/middleware.ts index 704e3c5f..3f1f52d3 100644 --- a/src/utils/middleware.ts +++ b/src/utils/middleware.ts @@ -1,4 +1,7 @@ -import { Middleware, ResponseError } from '../pinecone-generated-ts-fetch'; +import { + Middleware, + ResponseError, +} from '../pinecone-generated-ts-fetch/control'; import { handleApiError } from '../errors'; const debugMiddleware: Middleware[] = []; diff --git a/src/utils/queryParamsStringify.ts b/src/utils/queryParamsStringify.ts index 224a0bb6..4ace537b 100644 --- a/src/utils/queryParamsStringify.ts +++ b/src/utils/queryParamsStringify.ts @@ -1,4 +1,4 @@ -import type { HTTPQuery } from '../pinecone-generated-ts-fetch'; +import type { HTTPQuery } from '../pinecone-generated-ts-fetch/control'; // Everything in this file is lifted from the generated openapi runtime. // I need to create a small modification of the generated queryParamStringify