├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── documentation.md │ └── feature_request.md ├── actions │ └── build-docs │ │ └── action.yml └── workflows │ ├── add-labels.yaml │ ├── build-and-publish-docs.yml │ ├── pr.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.gradle ├── codegen ├── buf.gen.yaml ├── buf.lock ├── buf.yaml ├── build-grpc.sh └── build-oas.sh ├── examples ├── build.gradle └── java-basic-mvn │ ├── README.md │ ├── pom.xml │ └── src │ └── main │ └── java │ └── pineconeexamples │ └── MinimalUpsertAndQueryExample.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── src ├── integration │ ├── java │ │ └── io │ │ │ └── pinecone │ │ │ ├── CleanupAllTestResourcesListener.java │ │ │ ├── clients │ │ │ └── ConnectionsMapTest.java │ │ │ ├── helpers │ │ │ ├── AssertRetry.java │ │ │ ├── BuildUpsertRequest.java │ │ │ ├── RandomStringBuilder.java │ │ │ ├── TestResourcesManager.java │ │ │ └── TestUtilities.java │ │ │ └── integration │ │ │ ├── controlPlane │ │ │ ├── pod │ │ │ │ ├── CollectionTest.java │ │ │ │ ├── ConfigureIndexTest.java │ │ │ │ ├── CreateDescribeListAndDeleteIndexTest.java │ │ │ │ └── DeletionProtectionTest.java │ │ │ └── serverless │ │ │ │ ├── CreateDescribeListAndDeleteIndexTest.java │ │ │ │ ├── DeletionProtectionTest.java │ │ │ │ └── SparseIndexTest.java │ │ │ ├── dataPlane │ │ │ ├── ListEndpointTest.java │ │ │ ├── NamespacesTest.java │ │ │ ├── QueryErrorTest.java │ │ │ ├── UpdateFetchAndQueryPodTest.java │ │ │ ├── UpdateFetchAndQueryServerlessTest.java │ │ │ ├── UpsertAndQueryPodTest.java │ │ │ ├── UpsertAndQueryServerlessTest.java │ │ │ ├── UpsertAndSearchRecordsTest.java │ │ │ ├── UpsertDescribeIndexStatsAndDeletePodTest.java │ │ │ ├── UpsertDescribeIndexStatsAndDeleteServerlessTest.java │ │ │ └── UpsertErrorTest.java │ │ │ └── inference │ │ │ ├── EmbedTest.java │ │ │ ├── ModelsTest.java │ │ │ └── RerankTest.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.junit.platform.launcher.TestExecutionListener ├── main │ ├── java │ │ ├── io │ │ │ └── pinecone │ │ │ │ ├── clients │ │ │ │ ├── AsyncIndex.java │ │ │ │ ├── Index.java │ │ │ │ ├── Inference.java │ │ │ │ └── Pinecone.java │ │ │ │ ├── commons │ │ │ │ ├── Constants.java │ │ │ │ └── IndexInterface.java │ │ │ │ ├── configs │ │ │ │ ├── PineconeConfig.java │ │ │ │ ├── PineconeConnection.java │ │ │ │ └── ProxyConfig.java │ │ │ │ ├── exceptions │ │ │ │ ├── FailedRequestInfo.java │ │ │ │ ├── HttpErrorMapper.java │ │ │ │ ├── PineconeAlreadyExistsException.java │ │ │ │ ├── PineconeAuthorizationException.java │ │ │ │ ├── PineconeBadRequestException.java │ │ │ │ ├── PineconeConfigurationException.java │ │ │ │ ├── PineconeException.java │ │ │ │ ├── PineconeForbiddenException.java │ │ │ │ ├── PineconeInternalServerException.java │ │ │ │ ├── PineconeNotFoundException.java │ │ │ │ ├── PineconeUnmappedHttpException.java │ │ │ │ └── PineconeValidationException.java │ │ │ │ ├── proto │ │ │ │ ├── DbData202504.java │ │ │ │ ├── DeleteNamespaceRequest.java │ │ │ │ ├── DeleteNamespaceRequestOrBuilder.java │ │ │ │ ├── DeleteRequest.java │ │ │ │ ├── DeleteRequestOrBuilder.java │ │ │ │ ├── DeleteResponse.java │ │ │ │ ├── DeleteResponseOrBuilder.java │ │ │ │ ├── DescribeIndexStatsRequest.java │ │ │ │ ├── DescribeIndexStatsRequestOrBuilder.java │ │ │ │ ├── DescribeIndexStatsResponse.java │ │ │ │ ├── DescribeIndexStatsResponseOrBuilder.java │ │ │ │ ├── DescribeNamespaceRequest.java │ │ │ │ ├── DescribeNamespaceRequestOrBuilder.java │ │ │ │ ├── FetchRequest.java │ │ │ │ ├── FetchRequestOrBuilder.java │ │ │ │ ├── FetchResponse.java │ │ │ │ ├── FetchResponseOrBuilder.java │ │ │ │ ├── ListItem.java │ │ │ │ ├── ListItemOrBuilder.java │ │ │ │ ├── ListNamespacesRequest.java │ │ │ │ ├── ListNamespacesRequestOrBuilder.java │ │ │ │ ├── ListNamespacesResponse.java │ │ │ │ ├── ListNamespacesResponseOrBuilder.java │ │ │ │ ├── ListRequest.java │ │ │ │ ├── ListRequestOrBuilder.java │ │ │ │ ├── ListResponse.java │ │ │ │ ├── ListResponseOrBuilder.java │ │ │ │ ├── NamespaceDescription.java │ │ │ │ ├── NamespaceDescriptionOrBuilder.java │ │ │ │ ├── NamespaceSummary.java │ │ │ │ ├── NamespaceSummaryOrBuilder.java │ │ │ │ ├── Pagination.java │ │ │ │ ├── PaginationOrBuilder.java │ │ │ │ ├── QueryRequest.java │ │ │ │ ├── QueryRequestOrBuilder.java │ │ │ │ ├── QueryResponse.java │ │ │ │ ├── QueryResponseOrBuilder.java │ │ │ │ ├── QueryVector.java │ │ │ │ ├── QueryVectorOrBuilder.java │ │ │ │ ├── RequestUnion.java │ │ │ │ ├── RequestUnionOrBuilder.java │ │ │ │ ├── ScoredVector.java │ │ │ │ ├── ScoredVectorOrBuilder.java │ │ │ │ ├── SingleQueryResults.java │ │ │ │ ├── SingleQueryResultsOrBuilder.java │ │ │ │ ├── SparseValues.java │ │ │ │ ├── SparseValuesOrBuilder.java │ │ │ │ ├── UpdateRequest.java │ │ │ │ ├── UpdateRequestOrBuilder.java │ │ │ │ ├── UpdateResponse.java │ │ │ │ ├── UpdateResponseOrBuilder.java │ │ │ │ ├── UpsertRequest.java │ │ │ │ ├── UpsertRequestOrBuilder.java │ │ │ │ ├── UpsertResponse.java │ │ │ │ ├── UpsertResponseOrBuilder.java │ │ │ │ ├── Usage.java │ │ │ │ ├── UsageOrBuilder.java │ │ │ │ ├── Vector.java │ │ │ │ ├── VectorOrBuilder.java │ │ │ │ └── VectorServiceGrpc.java │ │ │ │ ├── unsigned_indices_model │ │ │ │ ├── QueryResponseWithUnsignedIndices.java │ │ │ │ ├── ScoredVectorWithUnsignedIndices.java │ │ │ │ ├── SparseValuesWithUnsignedIndices.java │ │ │ │ └── VectorWithUnsignedIndices.java │ │ │ │ └── utils │ │ │ │ └── SparseIndicesConverter.java │ │ └── org │ │ │ └── openapitools │ │ │ ├── db_control │ │ │ └── client │ │ │ │ ├── ApiCallback.java │ │ │ │ ├── ApiClient.java │ │ │ │ ├── ApiException.java │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Configuration.java │ │ │ │ ├── GzipRequestInterceptor.java │ │ │ │ ├── JSON.java │ │ │ │ ├── Pair.java │ │ │ │ ├── ProgressRequestBody.java │ │ │ │ ├── ProgressResponseBody.java │ │ │ │ ├── ServerConfiguration.java │ │ │ │ ├── ServerVariable.java │ │ │ │ ├── StringUtil.java │ │ │ │ ├── api │ │ │ │ └── ManageIndexesApi.java │ │ │ │ ├── auth │ │ │ │ ├── ApiKeyAuth.java │ │ │ │ ├── Authentication.java │ │ │ │ ├── HttpBasicAuth.java │ │ │ │ └── HttpBearerAuth.java │ │ │ │ └── model │ │ │ │ ├── AbstractOpenApiSchema.java │ │ │ │ ├── BackupList.java │ │ │ │ ├── BackupModel.java │ │ │ │ ├── ByocSpec.java │ │ │ │ ├── CollectionList.java │ │ │ │ ├── CollectionModel.java │ │ │ │ ├── ConfigureIndexRequest.java │ │ │ │ ├── ConfigureIndexRequestEmbed.java │ │ │ │ ├── ConfigureIndexRequestSpec.java │ │ │ │ ├── ConfigureIndexRequestSpecPod.java │ │ │ │ ├── CreateBackupRequest.java │ │ │ │ ├── CreateCollectionRequest.java │ │ │ │ ├── CreateIndexForModelRequest.java │ │ │ │ ├── CreateIndexForModelRequestEmbed.java │ │ │ │ ├── CreateIndexFromBackupRequest.java │ │ │ │ ├── CreateIndexFromBackupResponse.java │ │ │ │ ├── CreateIndexRequest.java │ │ │ │ ├── DeletionProtection.java │ │ │ │ ├── ErrorResponse.java │ │ │ │ ├── ErrorResponseError.java │ │ │ │ ├── IndexList.java │ │ │ │ ├── IndexModel.java │ │ │ │ ├── IndexModelSpec.java │ │ │ │ ├── IndexModelStatus.java │ │ │ │ ├── IndexSpec.java │ │ │ │ ├── ModelIndexEmbed.java │ │ │ │ ├── PaginationResponse.java │ │ │ │ ├── PodSpec.java │ │ │ │ ├── PodSpecMetadataConfig.java │ │ │ │ ├── RestoreJobList.java │ │ │ │ ├── RestoreJobModel.java │ │ │ │ └── ServerlessSpec.java │ │ │ ├── db_data │ │ │ └── client │ │ │ │ ├── ApiCallback.java │ │ │ │ ├── ApiClient.java │ │ │ │ ├── ApiException.java │ │ │ │ ├── ApiResponse.java │ │ │ │ ├── Configuration.java │ │ │ │ ├── GzipRequestInterceptor.java │ │ │ │ ├── JSON.java │ │ │ │ ├── Pair.java │ │ │ │ ├── ProgressRequestBody.java │ │ │ │ ├── ProgressResponseBody.java │ │ │ │ ├── ServerConfiguration.java │ │ │ │ ├── ServerVariable.java │ │ │ │ ├── StringUtil.java │ │ │ │ ├── api │ │ │ │ ├── BulkOperationsApi.java │ │ │ │ ├── NamespaceOperationsApi.java │ │ │ │ └── VectorOperationsApi.java │ │ │ │ ├── auth │ │ │ │ ├── ApiKeyAuth.java │ │ │ │ ├── Authentication.java │ │ │ │ ├── HttpBasicAuth.java │ │ │ │ └── HttpBearerAuth.java │ │ │ │ └── model │ │ │ │ ├── AbstractOpenApiSchema.java │ │ │ │ ├── DeleteRequest.java │ │ │ │ ├── DescribeIndexStatsRequest.java │ │ │ │ ├── FetchResponse.java │ │ │ │ ├── Hit.java │ │ │ │ ├── ImportErrorMode.java │ │ │ │ ├── ImportModel.java │ │ │ │ ├── IndexDescription.java │ │ │ │ ├── ListImportsResponse.java │ │ │ │ ├── ListItem.java │ │ │ │ ├── ListNamespacesResponse.java │ │ │ │ ├── ListResponse.java │ │ │ │ ├── NamespaceDescription.java │ │ │ │ ├── NamespaceSummary.java │ │ │ │ ├── Pagination.java │ │ │ │ ├── ProtobufAny.java │ │ │ │ ├── ProtobufNullValue.java │ │ │ │ ├── QueryRequest.java │ │ │ │ ├── QueryResponse.java │ │ │ │ ├── QueryVector.java │ │ │ │ ├── RpcStatus.java │ │ │ │ ├── ScoredVector.java │ │ │ │ ├── SearchRecordsRequest.java │ │ │ │ ├── SearchRecordsRequestQuery.java │ │ │ │ ├── SearchRecordsRequestRerank.java │ │ │ │ ├── SearchRecordsResponse.java │ │ │ │ ├── SearchRecordsResponseResult.java │ │ │ │ ├── SearchRecordsVector.java │ │ │ │ ├── SearchUsage.java │ │ │ │ ├── SearchVector.java │ │ │ │ ├── SingleQueryResults.java │ │ │ │ ├── SparseValues.java │ │ │ │ ├── StartImportRequest.java │ │ │ │ ├── StartImportResponse.java │ │ │ │ ├── UpdateRequest.java │ │ │ │ ├── UpsertRecord.java │ │ │ │ ├── UpsertRequest.java │ │ │ │ ├── UpsertResponse.java │ │ │ │ ├── Usage.java │ │ │ │ └── Vector.java │ │ │ └── inference │ │ │ └── client │ │ │ ├── ApiCallback.java │ │ │ ├── ApiClient.java │ │ │ ├── ApiException.java │ │ │ ├── ApiResponse.java │ │ │ ├── Configuration.java │ │ │ ├── GzipRequestInterceptor.java │ │ │ ├── JSON.java │ │ │ ├── Pair.java │ │ │ ├── ProgressRequestBody.java │ │ │ ├── ProgressResponseBody.java │ │ │ ├── ServerConfiguration.java │ │ │ ├── ServerVariable.java │ │ │ ├── StringUtil.java │ │ │ ├── api │ │ │ └── InferenceApi.java │ │ │ ├── auth │ │ │ ├── ApiKeyAuth.java │ │ │ ├── Authentication.java │ │ │ ├── HttpBasicAuth.java │ │ │ └── HttpBearerAuth.java │ │ │ └── model │ │ │ ├── AbstractOpenApiSchema.java │ │ │ ├── DenseEmbedding.java │ │ │ ├── EmbedRequest.java │ │ │ ├── EmbedRequestInputsInner.java │ │ │ ├── Embedding.java │ │ │ ├── EmbeddingsList.java │ │ │ ├── EmbeddingsListUsage.java │ │ │ ├── ErrorResponse.java │ │ │ ├── ErrorResponseError.java │ │ │ ├── ModelInfo.java │ │ │ ├── ModelInfoList.java │ │ │ ├── ModelInfoMetric.java │ │ │ ├── ModelInfoSupportedParameter.java │ │ │ ├── ModelInfoSupportedParameterAllowedValuesInner.java │ │ │ ├── ModelInfoSupportedParameterDefault.java │ │ │ ├── RankedDocument.java │ │ │ ├── RerankRequest.java │ │ │ ├── RerankResult.java │ │ │ ├── RerankResultUsage.java │ │ │ └── SparseEmbedding.java │ └── resources │ │ └── META-INF │ │ ├── LICENSE.txt │ │ └── NOTICE.txt └── test │ ├── java │ ├── io │ │ └── pinecone │ │ │ ├── BuildUpsertVectorWithUnsignedIndicesTest.java │ │ │ ├── GenerateMetadata.java │ │ │ ├── ListEndpointValidationTest.java │ │ │ ├── PineconeBuilderTest.java │ │ │ ├── PineconeConfigTest.java │ │ │ ├── PineconeConnectionTest.java │ │ │ ├── PineconeIndexOperationsTest.java │ │ │ ├── SparseIndicesConverterTest.java │ │ │ └── clients │ │ │ ├── ConnectionsMapTest.java │ │ │ ├── ImportsTest.java │ │ │ └── PineconeProxyTest.java │ └── org │ │ └── openapitools │ │ └── client │ │ └── JsonParsingTest.java │ └── resources │ ├── collectionCreation.json │ ├── createIndexResponse.valid.json │ ├── createIndexResponse.withUnknownProperties.json │ ├── describeCollection.valid.json │ ├── describeCollection.witihUnknownProperties.json │ ├── describeIndexResponse.valid.json │ ├── describeIndexResponse.withUnknownProperties.json │ ├── indexListJsonString.json │ ├── podIndexJsonString.json │ ├── serverlessIndexJsonString.json │ └── simplelogger.properties ├── v1-migration.md └── v2-migration.md /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug] " 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is this a new bug?** 11 | In other words: Is this an error, flaw, failure or fault? Please search Github issues and check our [Community Forum](https://community.pinecone.io/) to see if someone has already reported the bug you encountered. 12 | 13 | If this is a request for help or troubleshooting code in your own Pinecone project, please join the [Pinecone Community Forum](https://community.pinecone.io/). 14 | 15 | - [ ] I believe this is a new bug 16 | - [ ] I have searched the existing Github issues and Community Forum, and I could not find an existing post for this bug 17 | 18 | **Describe the bug** 19 | Describe the functionality that was working before but is broken now. 20 | 21 | **Error information** 22 | If you have one, please include the full stack trace here. If not, please share as much as you can about the error. 23 | 24 | **Steps to reproduce the issue locally** 25 | Include steps to reproduce the issue here. If you have sample code or a script that can be used to replicate this issue, please include that as well (including any dependent files to run the code). 26 | 27 | **Environment** 28 | * OS Version: 29 | * Java version: 30 | * Java SDK version: 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Pinecone Community Forum 4 | url: https://community.pinecone.io/ 5 | about: For support, please see the community forum. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation 3 | about: Report an issue in our docs 4 | title: "[Docs] " 5 | labels: 'documentation' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Description** 11 | Describe the issue that you've encountered with our documentation. 12 | 13 | **Suggested solution** 14 | Describe how this issue could be fixed or improved. 15 | 16 | **Link to page** 17 | Add a link to the exact documentation page where the issue occurred. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Feature Request]" 5 | labels: 'enhancement' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What motivated you to submit this feature request?** 11 | A clear and concise description of why you are requesting this feature - e.g. "Being able to do x would allow me to..." 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/actions/build-docs/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Build client documentation' 2 | description: 'Generates client documentation using Javadoc' 3 | inputs: 4 | java-version: 5 | description: 'The Java version to use' 6 | required: false 7 | default: '8' 8 | gradle-version: 9 | description: 'The Gradle version to use' 10 | required: false 11 | default: '6.8' 12 | runs: 13 | using: 'composite' 14 | steps: 15 | - name: Setup Java 16 | uses: actions/setup-java@v4 17 | with: 18 | distribution: temurin 19 | java-version: ${{ inputs.java-version }} 20 | - name: Setup Gradle 21 | uses: gradle/actions/setup-gradle@v3 22 | with: 23 | gradle-version: ${{ inputs.gradle-version }} 24 | - name: Build Javadoc documentation 25 | shell: bash 26 | run: | 27 | gradle generateJavadoc -------------------------------------------------------------------------------- /.github/workflows/add-labels.yaml: -------------------------------------------------------------------------------- 1 | name: Label issues 2 | on: 3 | issues: 4 | types: 5 | - reopened 6 | - opened 7 | jobs: 8 | label_issues: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | issues: write 12 | steps: 13 | - run: gh issue edit "$NUMBER" --add-label "$LABELS" 14 | env: 15 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | GH_REPO: ${{ github.repository }} 17 | NUMBER: ${{ github.event.issue.number }} 18 | LABELS: status:needs-triage 19 | -------------------------------------------------------------------------------- /.github/workflows/build-and-publish-docs.yml: -------------------------------------------------------------------------------- 1 | name: 'Build and publish documentation to sdk-docs' 2 | 3 | on: 4 | workflow_dispatch: {} 5 | workflow_call: 6 | secrets: 7 | SSH_DEPLOY_KEY: 8 | required: true 9 | 10 | jobs: 11 | build-and-deploy-documentation: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v4 16 | - name: Generate Javadoc documentation 17 | uses: ./.github/actions/build-docs 18 | - name: Push documentation artifacts to sdk-docs 19 | uses: cpina/github-action-push-to-another-repository@main 20 | env: 21 | SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} 22 | with: 23 | source-directory: docs 24 | destination-github-username: pinecone-io 25 | destination-repository-name: sdk-docs 26 | user-email: clients@pinecone.io 27 | target-branch: main 28 | target-directory: java 29 | commit-message: "Java: automated documentation build \n\n pinecone-java-client merge SHA: ${{ github.sha }}" 30 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request 2 | 3 | on: 4 | workflow_dispatch: {} 5 | pull_request: {} 6 | push: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | build: 12 | strategy: 13 | fail-fast: false 14 | matrix: 15 | os: [ubuntu-latest] 16 | versions: [ 17 | { java: 8, gradle: 6.8 }, 18 | { java: 11, gradle: 6.8 }, 19 | { java: 16, gradle: 7.3.1 }, 20 | { java: 17, gradle: 7.3.1 } 21 | ] 22 | runs-on: ${{ matrix.os }} 23 | steps: 24 | - uses: actions/checkout@v4 25 | 26 | - uses: actions/setup-java@v4 27 | with: 28 | distribution: temurin 29 | java-version: ${{ matrix.versions.java}} 30 | 31 | - name: Setup Gradle 32 | uses: gradle/actions/setup-gradle@v3 33 | with: 34 | gradle-version: ${{ matrix.versions.gradle }} 35 | 36 | - name: Setup gradle.properties 37 | if: matrix.versions.java == 16 || matrix.versions.java == 17 38 | run: | 39 | echo "org.gradle.jvmargs=-Xmx4096m --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED" >> gradle.properties 40 | 41 | - name: Execute Gradle build 42 | run: gradle clean build 43 | 44 | - name: Build jar 45 | run: gradle jar 46 | 47 | - name: Compile integration tests 48 | run: gradle compileIntegrationTestJava 49 | 50 | integration-test: 51 | runs-on: ubuntu-latest 52 | needs: build 53 | strategy: 54 | fail-fast: false 55 | matrix: 56 | os: [ubuntu-latest] 57 | versions: [ 58 | { java: 8, gradle: 6.8 }, 59 | { java: 17, gradle: 7.3.1 } 60 | ] 61 | steps: 62 | - uses: actions/checkout@v4 63 | 64 | - uses: actions/setup-java@v4 65 | with: 66 | distribution: temurin 67 | java-version: ${{ matrix.versions.java}} 68 | 69 | - name: Setup Gradle 70 | uses: gradle/actions/setup-gradle@v3 71 | with: 72 | gradle-version: ${{ matrix.versions.gradle }} 73 | - name: Setup gradle.properties 74 | if: matrix.versions.java == 16 || matrix.versions.java == 17 75 | run: | 76 | echo "org.gradle.jvmargs=-Xmx4096m --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED" >> gradle.properties 77 | 78 | - name: Execute Gradle build 79 | run: gradle clean build 80 | 81 | - name: Run integration tests 82 | run: gradle integrationTest 83 | env: 84 | PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} 85 | PINECONE_ENVIRONMENT: ${{ secrets.PINECONE_ENVIRONMENT }} 86 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | ref: 7 | description: 'Git ref to build (branch name or SHA)' 8 | required: true 9 | type: string 10 | default: 'main' 11 | releaseLevel: 12 | description: 'Release level' 13 | required: true 14 | type: choice 15 | default: 'patch' 16 | options: 17 | - 'patch' # bug fixes 18 | - 'minor' # new features, backwards compatible 19 | - 'major' # breaking changes 20 | 21 | jobs: 22 | release: 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout code 26 | uses: actions/checkout@v3 27 | with: 28 | ref: ${{ github.event.inputs.ref }} 29 | 30 | - name: Set up JDK 8 31 | uses: actions/setup-java@v3 32 | with: 33 | java-version: '8' 34 | distribution: 'temurin' 35 | 36 | - name: Bump version 37 | run: | 38 | # Read current version 39 | CURRENT_VERSION=$(grep "pineconeClientVersion" gradle.properties | cut -d'=' -f2 | tr -d ' ') 40 | 41 | # Split version into components 42 | IFS='.' read -r major minor patch <<< "$CURRENT_VERSION" 43 | 44 | # Bump version based on release level 45 | case "${{ github.event.inputs.releaseLevel }}" in 46 | "major") 47 | NEW_VERSION="$((major + 1)).0.0" 48 | ;; 49 | "minor") 50 | NEW_VERSION="$major.$((minor + 1)).0" 51 | ;; 52 | "patch") 53 | NEW_VERSION="$major.$minor.$((patch + 1))" 54 | ;; 55 | esac 56 | 57 | # Update gradle.properties 58 | sed -i "s/pineconeClientVersion = .*/pineconeClientVersion = $NEW_VERSION/" gradle.properties 59 | 60 | # Set output for later steps 61 | echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV 62 | 63 | - name: Build with Gradle 64 | run: ./gradlew clean build 65 | 66 | - name: Publish to Maven Central 67 | env: 68 | ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} 69 | ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} 70 | ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} 71 | ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} 72 | ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} 73 | run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository 74 | 75 | - name: Create GitHub Release 76 | uses: softprops/action-gh-release@v1 77 | with: 78 | name: Release v${{ env.NEW_VERSION }} 79 | tag_name: v${{ env.NEW_VERSION }} 80 | body: | 81 | Release v${{ env.NEW_VERSION }} 82 | 83 | This release was created automatically by the release workflow. 84 | draft: false 85 | prerelease: false 86 | env: 87 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ############################## 2 | ## Java 3 | ############################## 4 | docs/ 5 | .mtj.tmp/ 6 | *.class 7 | *.jar 8 | *.war 9 | *.ear 10 | *.nar 11 | hs_err_pid* 12 | 13 | ############################## 14 | ## Maven 15 | ############################## 16 | target/ 17 | pom.xml.tag 18 | pom.xml.releaseBackup 19 | pom.xml.versionsBackup 20 | pom.xml.next 21 | pom.xml.bak 22 | release.properties 23 | dependency-reduced-pom.xml 24 | buildNumber.properties 25 | .mvn/timing.properties 26 | .mvn/wrapper/maven-wrapper.jar 27 | 28 | ############################## 29 | ## Gradle 30 | ############################## 31 | build/ 32 | .gradle 33 | .gradletasknamecache 34 | gradle-app.setting 35 | !gradle-wrapper.jar 36 | 37 | ############################## 38 | ## IntelliJ 39 | ############################## 40 | out/ 41 | .idea/ 42 | .idea_modules/ 43 | *.iml 44 | *.ipr 45 | *.iws 46 | 47 | ############################## 48 | ## Eclipse 49 | ############################## 50 | .settings/ 51 | tmp/ 52 | .metadata 53 | .classpath 54 | .project 55 | *.tmp 56 | *.bak 57 | *.swp 58 | *~.nib 59 | local.properties 60 | .loadpath 61 | .factorypath 62 | 63 | ############################## 64 | ## NetBeans 65 | ############################## 66 | nbproject/private/ 67 | nbbuild/ 68 | dist/ 69 | nbdist/ 70 | nbactions.xml 71 | nb-configuration.xml 72 | 73 | ############################## 74 | ## Visual Studio Code 75 | ############################## 76 | .vscode/ 77 | .code-workspace 78 | 79 | ############################## 80 | ## OS X 81 | ############################## 82 | .DS_Store 83 | 84 | gen 85 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "codegen/apis"] 2 | path = codegen/apis 3 | url = git@github.com:pinecone-io/apis.git 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | [comment]: <> (When bumping [pc:VERSION_LATEST_RELEASE] create a new entry below) 4 | ### Unreleased version 5 | ### 5.1.0 6 | - Add support for models api 7 | 8 | ### 5.0.0 9 | - Add support for backups and restore 10 | - Add support for list, describe, and delete namespaces 11 | - Generate code based on 2025-04 api spec 12 | - Automate ndjson handling 13 | 14 | ### 4.0.1 15 | - Create a new config per index connection 16 | 17 | ### 4.0.0 18 | - Add support for sparse indexes 19 | - Generate code based on 2025-01 open-api spec 20 | 21 | ### 3.1.0 22 | - Add support to pass base url for control and data plane operations 23 | 24 | ### 3.0.0 25 | - Add support for imports 26 | - start import 27 | - list imports 28 | - describe import 29 | - cancel import 30 | - Add support for inference 31 | - embed 32 | - rerank 33 | - Generate code based on 2024-10 open-api spec 34 | 35 | ### 2.1.0 36 | - Add support to disable TLS for data plane operations 37 | 38 | ### 2.0.0 39 | - Add deletion protection 40 | 41 | ### 1.2.2 42 | - Add support for proxy configuration 43 | - Fix user-agent for grpc 44 | 45 | ### 1.2.1 46 | - Fix uber jar 47 | 48 | ### 1.2.0 49 | - Add list with pagination and limit but without prefix 50 | - Add exception cause 51 | 52 | ### v1.1.0 53 | - Add list vectors endpoint 54 | 55 | ### v1.0.0 56 | - Remove vector_service.proto and replace it with the generated classes 57 | - Add data and control plane wrappers 58 | - Refactor configs and PineconeConnection 59 | - Add source tag 60 | 61 | ### v0.8.0 62 | - Add support for control plane operations for serverless indexes 63 | - Add support for collections for pod indexes 64 | 65 | ### v0.7.4 66 | - Add source_collection and support to ignore newly added fields to the response body for describeIndex's indexMetaDatabase object 67 | 68 | ### v0.7.3 69 | - Add assert with retry mechanism 70 | - Add deprecation warning for queries parameter 71 | - Fix path for create and list indexes calls for gcp-stater 72 | 73 | ### v0.7.2 74 | - Fix extraction of SDK version 75 | 76 | ### v0.7.0 77 | - Add support to list indexes 78 | - Add support to configure index 79 | - Add user-agent to the header 80 | - Add integration tests for data plane operations 81 | 82 | ### v0.6.0 83 | - Add async stub for data plane operations 84 | - Add integration tests 85 | 86 | ### v0.5.1 87 | - Update build.gradle 88 | 89 | ### v0.5.0 90 | - Update asyncHttpClient with okHttpClient for control plane operations 91 | - Add ability to describe index 92 | - Add apache 2.0 license 93 | - Update gRPC version to 1.58.0 94 | 95 | ### v0.4.0 96 | - Add support to pass connection url to config objects for data plane operations only 97 | 98 | ### v0.3.0 99 | - Added ability for index operations to 100 | - create index using required and optional fields 101 | - delete index 102 | 103 | ### v0.2.3 104 | - Update to use latest protos 105 | - Ability to use SparseValues 106 | - Filters on describe index stats calls 107 | - Remove vulnerable dependencies 108 | 109 | ### v0.1.3 110 | This is the first release that will be released to Maven Central. Only build-time functionality is changing in this release. -------------------------------------------------------------------------------- /codegen/buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | plugins: 3 | - name: java 4 | out: gen/java 5 | - name: grpc-java 6 | out: gen/java -------------------------------------------------------------------------------- /codegen/buf.lock: -------------------------------------------------------------------------------- 1 | # Generated by buf. DO NOT EDIT. 2 | version: v2 3 | deps: 4 | - name: buf.build/googleapis/googleapis 5 | commit: e93e34f48be043dab55be31b4b47f458 6 | digest: b5:cebe5dfac5f7d67c55296f37ad9d368dba8d9862777e69d5d99eb1d72dc95fa68cd6323b483ca42cf70e66060002c1bc36e1f5f754b217a5c771c108eb243dbf 7 | -------------------------------------------------------------------------------- /codegen/buf.yaml: -------------------------------------------------------------------------------- 1 | # For details on buf.yaml configuration, visit https://buf.build/docs/configuration/v2/buf-yaml 2 | version: v2 3 | lint: 4 | use: 5 | - STANDARD 6 | breaking: 7 | use: 8 | - FILE 9 | deps: 10 | - buf.build/googleapis/googleapis 11 | modules: 12 | - path: apis/_build/2025-04 -------------------------------------------------------------------------------- /codegen/build-grpc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eux -o pipefail 4 | version=$1 # e.g. 2024-07 5 | 6 | update_apis_repo() { 7 | echo "Updating apis repo" 8 | pushd codegen/apis 9 | git fetch 10 | git checkout main 11 | git pull 12 | just build 13 | popd 14 | } 15 | 16 | update_buf_config() { 17 | pushd codegen 18 | # Update buf config to find correct proto version 19 | sed -i '' "s/[0-9][0-9][0-9][0-9]-[0-1][0-9]/${version}/g" buf.yaml 20 | 21 | # Clean before building 22 | rm -rf gen 23 | 24 | # Ensure path valid by running the buf build command 25 | buf build 26 | popd 27 | } 28 | 29 | buf_generate() { 30 | pushd codegen 31 | # Generate the java code 32 | buf generate 33 | popd 34 | } 35 | 36 | update_apis_repo 37 | update_buf_config 38 | buf_generate 39 | 40 | dest="src/main/java/io/pinecone/proto/" 41 | 42 | # Remove existing files in dest 43 | rm -rf "${dest}*.java" 44 | 45 | # Copy the new generated files to dest directory 46 | cp codegen/gen/java/io/pinecone/proto/*.java ${dest} 47 | 48 | # Update version reference in PineconeConnection.java 49 | sed -i '' "s/[0-9][0-9][0-9][0-9]-[0-1][0-9]/${version}/g" src/main/java/io/pinecone/configs/PineconeConnection.java 50 | 51 | # Cleanup the intermediate files that were generated 52 | rm -rf codegen/gen -------------------------------------------------------------------------------- /codegen/build-oas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eux -o pipefail 4 | 5 | version=$1 # e.g. 2024-07 6 | modules=("db_control" "db_data" "inference") 7 | 8 | destination="src/main/java/org/openapitools" 9 | build_dir="gen" 10 | 11 | update_apis_repo() { 12 | echo "Updating apis repo" 13 | pushd codegen/apis 14 | git fetch 15 | git checkout main 16 | git pull 17 | just build 18 | popd 19 | } 20 | 21 | verify_spec_version() { 22 | local version=$1 23 | echo "Verifying spec version $version exists in apis repo" 24 | if [ -z "$version" ]; then 25 | echo "Version is required" 26 | exit 1 27 | fi 28 | 29 | verify_directory_exists "codegen/apis/_build/${version}" 30 | } 31 | 32 | verify_file_exists() { 33 | local filename=$1 34 | if [ ! -f "$filename" ]; then 35 | echo "File does not exist at $filename" 36 | exit 1 37 | fi 38 | } 39 | 40 | verify_directory_exists() { 41 | local directory=$1 42 | if [ ! -d "$directory" ]; then 43 | echo "Directory does not exist at $directory" 44 | exit 1 45 | fi 46 | } 47 | 48 | generate_client() { 49 | local module_name=$1 50 | 51 | oas_file="codegen/apis/_build/${version}/${module_name}_${version}.oas.yaml" 52 | 53 | verify_file_exists $oas_file 54 | 55 | # Cleanup previous build files 56 | echo "Cleaning up previous build files" 57 | rm -rf "${build_dir}" 58 | 59 | # Generate client module 60 | docker run --rm -v $(pwd):/workspace openapitools/openapi-generator-cli:v7.0.1 generate \ 61 | --input-spec "/workspace/$oas_file" \ 62 | --generator-name java \ 63 | --additional-properties=dateLibrary='java8',disallowAdditionalPropertiesIfNotPresent=false \ 64 | --output "/workspace/${build_dir}" 65 | 66 | # Copy the generated module to the correct location 67 | rm -rf "${destination}/${module_name}" 68 | mkdir -p "${destination}/${module_name}" 69 | 70 | path_to_copy="${build_dir}/src/main/java/org/openapitools/client" 71 | cp -r $path_to_copy "${destination}/${module_name}" 72 | 73 | # Adjust package names in generated file 74 | find "${destination}/${module_name}" -name "*.java" | while IFS= read -r file; do 75 | sed -i '' "s/org\.openapitools\.client/org\.openapitools\.${module_name}\.client/g" "$file" 76 | done 77 | 78 | # Add NDJSON block to ApiClient.java in the db_data module 79 | if [ "$module_name" == "db_data" ]; then 80 | echo "Adding NDJSON handler block to ApiClient.java" 81 | 82 | # Use sed to insert the NDJSON block into ApiClient.java 83 | sed -i '' '/return RequestBody.create((File) obj, MediaType.parse(contentType));/a \ 84 | } else if ("application/x-ndjson".equals(contentType)) { \ 85 | // Handle NDJSON (Newline Delimited JSON) \ 86 | if (obj instanceof Iterable) { \ 87 | StringBuilder ndjsonContent = new StringBuilder(); \ 88 | for (Object item : (Iterable) obj) { \ 89 | String json = JSON.serialize(item); \ 90 | ndjsonContent.append(json).append("\\n"); \ 91 | } \ 92 | return RequestBody.create(ndjsonContent.toString(), MediaType.parse(contentType)); \ 93 | } else { \ 94 | throw new ApiException("NDJSON content requires a collection of objects."); \ 95 | } \ 96 | ' src/main/java/org/openapitools/db_data/client/ApiClient.java 97 | fi 98 | } 99 | 100 | update_apis_repo 101 | verify_spec_version $version 102 | 103 | rm -rf "${destination}" 104 | mkdir -p "${destination}" 105 | 106 | for module in "${modules[@]}"; do 107 | generate_client $module 108 | done 109 | -------------------------------------------------------------------------------- /examples/build.gradle: -------------------------------------------------------------------------------- 1 | // Note: this build script is for development only, for compilation checking and IDE integration. 2 | // End users should use the example-specific build setups 3 | plugins { 4 | id 'java' 5 | id 'groovy' 6 | } 7 | 8 | repositories { 9 | mavenCentral() 10 | jcenter() 11 | } 12 | 13 | dependencies { 14 | implementation project(':pinecone-client') 15 | 16 | implementation "org.slf4j:slf4j-simple:1.7.30" 17 | implementation 'org.codehaus.groovy:groovy-all:2.4.15' 18 | } 19 | 20 | sourceSets { 21 | main { 22 | java { 23 | srcDirs = ['java-basic-mvn/src'] 24 | } 25 | groovy { 26 | srcDirs = ['groovy-basic'] 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /examples/java-basic-mvn/README.md: -------------------------------------------------------------------------------- 1 | # java-basic-mvn 2 | To build and run (Java and Maven required): 3 | ``` 4 | # Either this (basic example): 5 | mvn package exec:java -Dexec.mainClass="pineconeexamples.MinimalUpsertAndQueryExample" -Dpinecone.apikey= -Dpinecone.indexName= -Dpinecone.environment= -Dpinecone.projectName= 6 | 7 | # Or (concurrent example) 8 | mvn package exec:java -Dexec.mainClass="pineconeexamples.UpsertsAndQueriesConcurrentExample" -Dpinecone.apikey= -Dpinecone.indexName= -Dpinecone.environment= -Dpinecone.projectName= 9 | ``` -------------------------------------------------------------------------------- /examples/java-basic-mvn/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | pineconeexamples 8 | java-basic-mvn 9 | 1.0-SNAPSHOT 10 | 11 | java-basic-mvn 12 | http://www.example.com 13 | 14 | 15 | UTF-8 16 | 1.8 17 | 1.8 18 | 19 | 20 | 21 | 22 | io.pinecone 23 | pinecone-client 24 | 1.0.0 25 | 26 | 27 | org.slf4j 28 | slf4j-simple 29 | 1.7.30 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | maven-clean-plugin 39 | 3.1.0 40 | 41 | 42 | 43 | org.codehaus.mojo 44 | exec-maven-plugin 45 | 1.2.1 46 | 47 | 48 | maven-resources-plugin 49 | 3.0.2 50 | 51 | 52 | maven-compiler-plugin 53 | 3.8.0 54 | 55 | 56 | maven-surefire-plugin 57 | 2.22.1 58 | 59 | 60 | maven-jar-plugin 61 | 3.0.2 62 | 63 | 64 | maven-install-plugin 65 | 2.5.2 66 | 67 | 68 | maven-deploy-plugin 69 | 2.8.2 70 | 71 | 72 | 73 | maven-site-plugin 74 | 3.7.1 75 | 76 | 77 | maven-project-info-reports-plugin 78 | 3.0.0 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /examples/java-basic-mvn/src/main/java/pineconeexamples/MinimalUpsertAndQueryExample.java: -------------------------------------------------------------------------------- 1 | package pineconeexamples; 2 | 3 | import com.google.common.primitives.Floats; 4 | import io.pinecone.clients.Index; 5 | import io.pinecone.clients.Pinecone; 6 | import io.pinecone.proto.UpsertResponse; 7 | import io.pinecone.unsigned_indices_model.QueryResponseWithUnsignedIndices; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | 11 | public class MinimalUpsertAndQueryExample { 12 | private static final Logger logger = LoggerFactory.getLogger(MinimalUpsertAndQueryExample.class); 13 | 14 | public static class Args { 15 | public String apiKey = System.getProperty("pinecone.apikey", "example-api-key"); 16 | String indexName = System.getProperty("pinecone.indexName", "example-index-name"); 17 | String namespace = "test-ns"; 18 | int topK = 1; 19 | } 20 | 21 | public static void main(String[] cliArgs) { 22 | System.out.println("Starting application..."); 23 | 24 | Args args = new Args(); 25 | 26 | Pinecone pinecone = new Pinecone.Builder(args.apiKey).build(); 27 | 28 | try { 29 | Index index = pinecone.getIndexConnection(args.indexName); 30 | 31 | logger.info("Sending upsert request."); 32 | 33 | UpsertResponse upsertResponse = index.upsert("v1", Floats.asList(1F, 3F, 5F), args.namespace); 34 | 35 | logger.info("Got upsert response:" + upsertResponse); 36 | 37 | logger.info("Sending query request"); 38 | QueryResponseWithUnsignedIndices queryResponse = index.queryByVectorId(args.topK, "v1", args.namespace, true, false); 39 | logger.info("Got query response:" + queryResponse); 40 | } catch (Exception e) { 41 | e.printStackTrace(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | pineconeClientVersion = 5.1.0 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pinecone-io/pinecone-java-client/36fa67b11a8deb8334b2edd97f060f85dee69d96/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/CleanupAllTestResourcesListener.java: -------------------------------------------------------------------------------- 1 | package io.pinecone; 2 | 3 | import io.pinecone.helpers.TestResourcesManager; 4 | import org.junit.platform.launcher.TestExecutionListener; 5 | import org.junit.platform.launcher.TestPlan; 6 | 7 | public class CleanupAllTestResourcesListener implements TestExecutionListener { 8 | @Override 9 | public void testPlanExecutionFinished(TestPlan testPlan) { 10 | TestResourcesManager.getInstance().cleanupResources(); 11 | } 12 | } -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/helpers/AssertRetry.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.helpers; 2 | 3 | import io.pinecone.exceptions.PineconeException; 4 | 5 | import java.io.IOException; 6 | import java.util.concurrent.ExecutionException; 7 | 8 | public class AssertRetry { 9 | private static final int maxRetry = 4; 10 | private static final int delay = 1500; 11 | 12 | public static void assertWithRetry(AssertionRunnable assertionRunnable) throws InterruptedException, PineconeException { 13 | assertWithRetry(assertionRunnable, 2); 14 | } 15 | 16 | public static void assertWithRetry(AssertionRunnable assertionRunnable, int backOff) throws AssertionError, InterruptedException { 17 | int retryCount = 0; 18 | int delayCount = delay; 19 | boolean success = false; 20 | String errorMessage = null; 21 | 22 | while (retryCount < maxRetry && !success) { 23 | try { 24 | assertionRunnable.run(); 25 | success = true; 26 | } catch (AssertionError | ExecutionException | IOException e) { 27 | errorMessage = e.getLocalizedMessage(); 28 | retryCount++; 29 | delayCount*=backOff; 30 | Thread.sleep(delayCount); 31 | } 32 | } 33 | 34 | if (!success) { 35 | throw new AssertionError(errorMessage); 36 | } 37 | } 38 | 39 | @FunctionalInterface 40 | public interface AssertionRunnable { 41 | void run() throws AssertionError, ExecutionException, InterruptedException, IOException, PineconeException; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/helpers/RandomStringBuilder.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.helpers; 2 | 3 | import java.util.Random; 4 | 5 | public class RandomStringBuilder { 6 | public static String build(String prefix, int len) { 7 | String alphabet = "abcdefghijklmnopqrstuvwxyz"; 8 | StringBuilder name = new StringBuilder(); 9 | Random rnd = new Random(); 10 | while (name.length() < len) { 11 | int index = (int) (rnd.nextFloat() * alphabet.length()); 12 | name.append(alphabet.charAt(index)); 13 | } 14 | return (prefix.isEmpty()) ? name.toString() : prefix + "-" + name; 15 | } 16 | 17 | public static String build(int len) { 18 | return build("", len); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/helpers/TestUtilities.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.helpers; 2 | 3 | import io.pinecone.clients.Pinecone; 4 | import org.openapitools.db_control.client.model.*; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | import static org.junit.jupiter.api.Assertions.fail; 10 | 11 | public class TestUtilities { 12 | private static final Logger logger = LoggerFactory.getLogger(TestUtilities.class); 13 | 14 | public static IndexModel waitUntilIndexIsReady(Pinecone pineconeClient, String indexName, Integer totalMsToWait) throws InterruptedException { 15 | IndexModel index = pineconeClient.describeIndex(indexName); 16 | int waitedTimeMs = 0; 17 | int intervalMs = 2000; 18 | 19 | while (index.getStatus().getState() != IndexModelStatus.StateEnum.READY) { 20 | index = pineconeClient.describeIndex(indexName); 21 | if (waitedTimeMs >= totalMsToWait) { 22 | logger.info("WARNING: Index " + indexName + " not ready after " + waitedTimeMs + "ms"); 23 | break; 24 | } 25 | if (index.getStatus().getState() == IndexModelStatus.StateEnum.READY) { 26 | logger.info("Index " + indexName + " is ready after " + waitedTimeMs + "ms"); 27 | Thread.sleep(20000); 28 | break; 29 | } 30 | Thread.sleep(intervalMs); 31 | logger.info("Waited " + waitedTimeMs + "ms for " + indexName + " to get ready"); 32 | waitedTimeMs += intervalMs; 33 | } 34 | return index; 35 | } 36 | 37 | public static IndexModel waitUntilIndexIsReady(Pinecone pineconeClient, String indexName) throws InterruptedException { 38 | return waitUntilIndexIsReady(pineconeClient, indexName, 200000); 39 | } 40 | 41 | public static CollectionModel createCollection(Pinecone pineconeClient, String collectionName, String indexName, boolean waitUntilReady) throws InterruptedException { 42 | CollectionModel collection = pineconeClient.createCollection(collectionName, indexName); 43 | 44 | assertEquals(collection.getStatus(), CollectionModel.StatusEnum.INITIALIZING); 45 | 46 | // Wait until collection is ready 47 | if (waitUntilReady) { 48 | int timeWaited = 0; 49 | CollectionModel.StatusEnum collectionReady = collection.getStatus(); 50 | while (collectionReady != CollectionModel.StatusEnum.READY && timeWaited < 120000) { 51 | logger.info("Waiting for collection " + collectionName + " to be ready. Waited " + timeWaited + " " + 52 | "milliseconds..."); 53 | Thread.sleep(5000); 54 | timeWaited += 5000; 55 | collection = pineconeClient.describeCollection(collectionName); 56 | collectionReady = collection.getStatus(); 57 | } 58 | 59 | if (timeWaited > 120000) { 60 | fail("Collection: " + collectionName + " is not ready after 120 seconds"); 61 | } 62 | } 63 | 64 | return collection; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/integration/controlPlane/pod/DeletionProtectionTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.integration.controlPlane.pod; 2 | 3 | import io.pinecone.clients.Pinecone; 4 | import io.pinecone.helpers.RandomStringBuilder; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Test; 7 | import org.openapitools.db_control.client.model.DeletionProtection; 8 | import org.openapitools.db_control.client.model.IndexModel; 9 | 10 | public class DeletionProtectionTest { 11 | private static final Pinecone controlPlaneClient = new Pinecone 12 | .Builder(System.getenv("PINECONE_API_KEY")) 13 | .withSourceTag("pinecone_test") 14 | .build(); 15 | 16 | @Test 17 | public void createPodIndexWithDeletionProtectionEnabled() { 18 | String indexName = RandomStringBuilder.build("create-pod", 8); 19 | // Create pod index with deletion protection enabled 20 | controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1", DeletionProtection.ENABLED); 21 | IndexModel indexModel = controlPlaneClient.describeIndex(indexName); 22 | DeletionProtection deletionProtection = indexModel.getDeletionProtection(); 23 | Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); 24 | // Configure index to disable deletionProtection 25 | controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED); 26 | // Delete index 27 | controlPlaneClient.deleteIndex(indexName); 28 | } 29 | 30 | @Test 31 | public void createPodIndexWithDeletionProtectionDisabled() { 32 | String indexName = RandomStringBuilder.build("create-pod", 8); 33 | // Create pod index with deletion protection disabled 34 | controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1"); 35 | IndexModel indexModel = controlPlaneClient.describeIndex(indexName); 36 | DeletionProtection deletionProtection = indexModel.getDeletionProtection(); 37 | Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED); 38 | // Configure index to enable deletionProtection 39 | controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.ENABLED); 40 | indexModel = controlPlaneClient.describeIndex(indexName); 41 | deletionProtection = indexModel.getDeletionProtection(); 42 | Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); 43 | // Configure index to disable deletionProtection 44 | controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED); 45 | // Delete index 46 | controlPlaneClient.deleteIndex(indexName); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/integration/controlPlane/serverless/DeletionProtectionTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.integration.controlPlane.serverless; 2 | 3 | import io.pinecone.clients.Pinecone; 4 | import io.pinecone.helpers.RandomStringBuilder; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Test; 7 | import org.openapitools.db_control.client.model.DeletionProtection; 8 | import org.openapitools.db_control.client.model.IndexModel; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | public class DeletionProtectionTest { 14 | private static final Pinecone controlPlaneClient = new Pinecone 15 | .Builder(System.getenv("PINECONE_API_KEY")) 16 | .withSourceTag("pinecone_test") 17 | .build(); 18 | 19 | @Test 20 | public void createIndexWithDeletionProtectionEnabled() { 21 | String indexName = RandomStringBuilder.build("create-serv", 8); 22 | HashMap expectedTags = new HashMap<>(); 23 | expectedTags.put("test", "deletion-protection-enabled"); 24 | // Create serverless index with deletion protection enabled 25 | controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.ENABLED, expectedTags); 26 | // Describe index to verify deletion protection is enabled 27 | IndexModel indexModel = controlPlaneClient.describeIndex(indexName); 28 | DeletionProtection deletionProtection = indexModel.getDeletionProtection(); 29 | Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); 30 | Map actualTags = indexModel.getTags(); 31 | Assertions.assertEquals(expectedTags, actualTags); 32 | } 33 | 34 | @Test 35 | public void createPodIndexWithDeletionProtectionDisabled() { 36 | String indexName = RandomStringBuilder.build("create-pod", 8); 37 | HashMap expectedTags = new HashMap<>(); 38 | expectedTags.put("test", "deletion-protection-disabled"); 39 | // Create serverless index with deletion protection disabled 40 | controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED, expectedTags); 41 | IndexModel indexModel = controlPlaneClient.describeIndex(indexName); 42 | DeletionProtection deletionProtection = indexModel.getDeletionProtection(); 43 | Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED); 44 | Map actualTags = indexModel.getTags(); 45 | Assertions.assertEquals(expectedTags, actualTags); 46 | // Configure index to enable deletionProtection 47 | controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.ENABLED, expectedTags, null); 48 | indexModel = controlPlaneClient.describeIndex(indexName); 49 | deletionProtection = indexModel.getDeletionProtection(); 50 | Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED); 51 | // Configure index to disable deletionProtection 52 | controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.DISABLED, expectedTags, null); 53 | // Delete index 54 | controlPlaneClient.deleteIndex(indexName); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/integration/dataPlane/NamespacesTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.integration.dataPlane; 2 | 3 | import io.pinecone.clients.AsyncIndex; 4 | import io.pinecone.clients.Index; 5 | import io.pinecone.helpers.RandomStringBuilder; 6 | import io.pinecone.helpers.TestResourcesManager; 7 | import io.pinecone.proto.ListNamespacesResponse; 8 | import org.junit.jupiter.api.AfterAll; 9 | import org.junit.jupiter.api.Test; 10 | 11 | import java.util.concurrent.ExecutionException; 12 | 13 | import static io.pinecone.helpers.BuildUpsertRequest.generateVectorValuesByDimension; 14 | import static org.junit.jupiter.api.Assertions.assertEquals; 15 | 16 | public class NamespacesTest { 17 | private static final TestResourcesManager indexManager = TestResourcesManager.getInstance(); 18 | private static Index index; 19 | private static AsyncIndex asyncIndex; 20 | private static final int dimension = indexManager.getDimension(); 21 | 22 | @AfterAll 23 | public static void cleanUp() { 24 | index.close(); 25 | asyncIndex.close(); 26 | } 27 | 28 | @Test 29 | public void namespacesSyncTest() throws InterruptedException { 30 | String[] namespaces = new String[3]; 31 | index = indexManager.getOrCreateServerlessIndexConnection(); 32 | ListNamespacesResponse listNamespacesResponse = index.listNamespaces(); 33 | int namespaceCount = listNamespacesResponse.getNamespacesCount(); 34 | 35 | for(int i=0; i<3; i++) { 36 | namespaces[i] = RandomStringBuilder.build("namespace-", 3); 37 | index.upsert("v"+i, generateVectorValuesByDimension(dimension), namespaces[i]); 38 | } 39 | 40 | // wait for vectors to be upserted 41 | Thread.sleep(5000); 42 | listNamespacesResponse = index.listNamespaces(); 43 | assertEquals(listNamespacesResponse.getNamespacesCount(), namespaceCount + 3); 44 | 45 | index.describeNamespace(namespaces[0]); 46 | index.deleteNamespace(namespaces[0]); 47 | 48 | // wait for namespace to be deleted 49 | Thread.sleep(3000); 50 | listNamespacesResponse = index.listNamespaces(); 51 | assertEquals(listNamespacesResponse.getNamespacesCount(), namespaceCount + 2); 52 | } 53 | 54 | @Test 55 | public void namespacesAsyncTest() throws InterruptedException, ExecutionException { 56 | String[] namespaces = new String[3]; 57 | asyncIndex = indexManager.getOrCreateServerlessAsyncIndexConnection(); 58 | 59 | ListNamespacesResponse listNamespacesResponse = asyncIndex.listNamespaces().get(); 60 | int namespaceCount = listNamespacesResponse.getNamespacesCount(); 61 | 62 | for(int i=0; i<3; i++) { 63 | namespaces[i] = RandomStringBuilder.build("namespace-", 3); 64 | asyncIndex.upsert("v"+i, generateVectorValuesByDimension(dimension), namespaces[i]); 65 | } 66 | 67 | // wait for vectors to be upserted 68 | Thread.sleep(5000); 69 | listNamespacesResponse = asyncIndex.listNamespaces().get(); 70 | assertEquals(listNamespacesResponse.getNamespacesCount(), namespaceCount + 3); 71 | 72 | asyncIndex.describeNamespace(namespaces[0]); 73 | asyncIndex.deleteNamespace(namespaces[0]); 74 | 75 | // wait for namespace to be deleted 76 | Thread.sleep(3000); 77 | listNamespacesResponse = asyncIndex.listNamespaces().get(); 78 | assertEquals(listNamespacesResponse.getNamespacesCount(), namespaceCount + 2); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/integration/inference/EmbedTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.integration.inference; 2 | 3 | import io.pinecone.clients.Inference; 4 | import io.pinecone.clients.Pinecone; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Test; 7 | import org.openapitools.inference.client.ApiException; 8 | import org.openapitools.inference.client.model.EmbeddingsList; 9 | 10 | import java.util.*; 11 | 12 | import static org.junit.Assert.*; 13 | import static org.junit.jupiter.api.Assertions.assertNotNull; 14 | 15 | public class EmbedTest { 16 | 17 | private static final Pinecone pinecone = new Pinecone 18 | .Builder(System.getenv("PINECONE_API_KEY")) 19 | .withSourceTag("pinecone_test") 20 | .build(); 21 | private static final Inference inference = pinecone.getInferenceClient(); 22 | 23 | @Test 24 | public void testGenerateEmbeddings() throws ApiException { 25 | List inputs = new ArrayList<>(1); 26 | inputs.add("The quick brown fox jumps over the lazy dog."); 27 | inputs.add("Lorem ipsum"); 28 | 29 | String embeddingModel = "multilingual-e5-large"; 30 | 31 | Map parameters = new HashMap<>(); 32 | parameters.put("input_type", "query"); 33 | parameters.put("truncate", "END"); 34 | EmbeddingsList embeddings = inference.embed(embeddingModel, parameters, inputs); 35 | 36 | assertNotNull(embeddings, "Expected embedding to be not null"); 37 | Assertions.assertEquals(embeddingModel, embeddings.getModel()); 38 | Assertions.assertEquals(1024, embeddings.getData().get(0).getDenseEmbedding().getValues().size()); 39 | Assertions.assertEquals(2, embeddings.getData().size()); 40 | } 41 | 42 | @Test 43 | public void testGenerateEmbeddingsInvalidInputs() throws ApiException { 44 | String embeddingModel = "multilingual-e5-large"; 45 | List inputs = new ArrayList<>(); 46 | Map parameters = new HashMap<>(); 47 | parameters.put("input_type", "query"); 48 | parameters.put("truncate", "END"); 49 | 50 | Exception exception = assertThrows(Exception.class, () -> { 51 | inference.embed(embeddingModel, parameters, inputs); 52 | }); 53 | 54 | Assertions.assertTrue(exception.getMessage().contains("Must specify at least one input")); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/integration/java/io/pinecone/integration/inference/ModelsTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.integration.inference; 2 | 3 | import io.pinecone.clients.Inference; 4 | import io.pinecone.clients.Pinecone; 5 | import org.junit.jupiter.api.Assertions; 6 | import org.junit.jupiter.api.Test; 7 | import org.openapitools.inference.client.ApiException; 8 | import org.openapitools.inference.client.model.ModelInfo; 9 | import org.openapitools.inference.client.model.ModelInfoList; 10 | 11 | public class ModelsTest { 12 | private static final Pinecone pinecone = new Pinecone 13 | .Builder(System.getenv("PINECONE_API_KEY")) 14 | .withSourceTag("pinecone_test") 15 | .build(); 16 | 17 | private static final Inference inference = pinecone.getInferenceClient(); 18 | 19 | @Test 20 | public void testListAndDescribeModels() throws ApiException { 21 | ModelInfoList models = inference.listModels(); 22 | Assertions.assertNotNull(models.getModels()); 23 | 24 | models = inference.listModels("rerank"); 25 | Assertions.assertNotNull(models.getModels()); 26 | 27 | models = inference.listModels("embed", "dense"); 28 | Assertions.assertNotNull(models.getModels()); 29 | 30 | ModelInfo modelInfo = inference.describeModel("llama-text-embed-v2"); 31 | Assertions.assertNotNull(modelInfo); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/integration/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener: -------------------------------------------------------------------------------- 1 | io.pinecone.CleanupAllTestResourcesListener -------------------------------------------------------------------------------- /src/main/java/io/pinecone/commons/Constants.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.commons; 2 | 3 | public class Constants { 4 | public static final String pineconeClientVersion = "v5.1.0"; 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/configs/ProxyConfig.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.configs; 2 | 3 | import io.pinecone.exceptions.PineconeConfigurationException; 4 | import io.pinecone.exceptions.PineconeValidationException; 5 | 6 | /** 7 | * Represents the configuration for a proxy server. 8 | * This class encapsulates the host and port of the proxy server. 9 | */ 10 | public class ProxyConfig { 11 | 12 | private String host; 13 | private int port; 14 | 15 | /** 16 | * Constructs a ProxyConfig object with the specified host and port. 17 | * 18 | * @param host The hostname or IP address of the proxy server. 19 | * @param port The port number of the proxy server. 20 | */ 21 | public ProxyConfig(String host, int port) { 22 | this.host = host; 23 | this.port = port; 24 | } 25 | 26 | /** 27 | * Gets the hostname or IP address of the proxy server. 28 | * 29 | * @return The hostname or IP address of the proxy server. 30 | */ 31 | public String getHost() { 32 | return host; 33 | } 34 | 35 | /** 36 | * Sets the hostname or IP address of the proxy server. 37 | * 38 | * @param host The hostname or IP address of the proxy server. 39 | */ 40 | public void setHost(String host) { 41 | this.host = host; 42 | } 43 | 44 | /** 45 | * Gets the port number of the proxy server. 46 | * 47 | * @return The port number of the proxy server. 48 | */ 49 | public int getPort() { 50 | return port; 51 | } 52 | 53 | /** 54 | * Sets the port number of the proxy server. 55 | * 56 | * @param port The port number of the proxy server. 57 | */ 58 | public void setPort(int port) { 59 | this.port = port; 60 | } 61 | 62 | /** 63 | * Validates the proxy configuration. 64 | * Throws a PineconeValidationException if the host is null or empty, or if the port is less than or equal to 0. 65 | * 66 | * @throws PineconeConfigurationException If the proxy configuration is invalid. 67 | */ 68 | public void validate() { 69 | if (host == null || host.isEmpty()) { 70 | throw new PineconeConfigurationException("Proxy host cannot be null or empty."); 71 | } 72 | if (port <= 0) { 73 | throw new PineconeConfigurationException("Proxy port must be greater than 0."); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/FailedRequestInfo.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class FailedRequestInfo { 4 | private final int status; 5 | private final String message; 6 | 7 | public FailedRequestInfo(int status, String message) { 8 | this.status = status; 9 | this.message = message; 10 | } 11 | 12 | public int getStatus() { 13 | return status; 14 | } 15 | 16 | public String getMessage() { 17 | return message; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/HttpErrorMapper.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | import org.openapitools.db_control.client.ApiException; 4 | 5 | public class HttpErrorMapper { 6 | 7 | public static void mapHttpStatusError(FailedRequestInfo failedRequestInfo, 8 | ApiException apiException) throws PineconeException { 9 | int statusCode = failedRequestInfo.getStatus(); 10 | switch (statusCode) { 11 | case 400: 12 | throw new PineconeBadRequestException(failedRequestInfo.getMessage(), apiException); 13 | case 401: 14 | throw new PineconeAuthorizationException(failedRequestInfo.getMessage(), apiException); 15 | case 403: 16 | throw new PineconeForbiddenException(failedRequestInfo.getMessage(), apiException); 17 | case 404: 18 | throw new PineconeNotFoundException(failedRequestInfo.getMessage(), apiException); 19 | case 409: 20 | throw new PineconeAlreadyExistsException(failedRequestInfo.getMessage(), apiException); 21 | case 500: 22 | throw new PineconeInternalServerException(failedRequestInfo.getMessage(), apiException); 23 | default: 24 | throw new PineconeUnmappedHttpException(failedRequestInfo.getMessage(), apiException); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeAlreadyExistsException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeAlreadyExistsException extends PineconeException { 4 | 5 | public PineconeAlreadyExistsException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeAlreadyExistsException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeAuthorizationException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeAuthorizationException extends PineconeException { 4 | 5 | public PineconeAuthorizationException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeAuthorizationException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeBadRequestException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeBadRequestException extends PineconeException { 4 | 5 | public PineconeBadRequestException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeBadRequestException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeConfigurationException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeConfigurationException extends PineconeException { 4 | 5 | public PineconeConfigurationException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeConfigurationException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeException extends RuntimeException { 4 | 5 | public PineconeException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeForbiddenException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeForbiddenException extends PineconeException { 4 | 5 | public PineconeForbiddenException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeForbiddenException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeInternalServerException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeInternalServerException extends PineconeException { 4 | 5 | public PineconeInternalServerException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeInternalServerException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeNotFoundException extends PineconeException { 4 | 5 | public PineconeNotFoundException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeNotFoundException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeUnmappedHttpException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeUnmappedHttpException extends PineconeException { 4 | 5 | public PineconeUnmappedHttpException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeUnmappedHttpException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/exceptions/PineconeValidationException.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.exceptions; 2 | 3 | public class PineconeValidationException extends PineconeException { 4 | 5 | public PineconeValidationException(String message) { 6 | super(message); 7 | } 8 | 9 | public PineconeValidationException(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/DeleteNamespaceRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface DeleteNamespaceRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:DeleteNamespaceRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The namespace to delete
15 |    * 
16 | * 17 | * string namespace = 1 [json_name = "namespace"]; 18 | * @return The namespace. 19 | */ 20 | java.lang.String getNamespace(); 21 | /** 22 | *
23 |    * The namespace to delete
24 |    * 
25 | * 26 | * string namespace = 1 [json_name = "namespace"]; 27 | * @return The bytes for namespace. 28 | */ 29 | com.google.protobuf.ByteString 30 | getNamespaceBytes(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/DeleteResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface DeleteResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:DeleteResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/DescribeIndexStatsRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface DescribeIndexStatsRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:DescribeIndexStatsRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * If this parameter is present, the operation only returns statistics
15 |    * for vectors that satisfy the filter.
16 |    * See https://docs.pinecone.io/guides/data/filtering-with-metadata.
17 |    * 
18 | * 19 | * .google.protobuf.Struct filter = 1 [json_name = "filter"]; 20 | * @return Whether the filter field is set. 21 | */ 22 | boolean hasFilter(); 23 | /** 24 | *
25 |    * If this parameter is present, the operation only returns statistics
26 |    * for vectors that satisfy the filter.
27 |    * See https://docs.pinecone.io/guides/data/filtering-with-metadata.
28 |    * 
29 | * 30 | * .google.protobuf.Struct filter = 1 [json_name = "filter"]; 31 | * @return The filter. 32 | */ 33 | com.google.protobuf.Struct getFilter(); 34 | /** 35 | *
36 |    * If this parameter is present, the operation only returns statistics
37 |    * for vectors that satisfy the filter.
38 |    * See https://docs.pinecone.io/guides/data/filtering-with-metadata.
39 |    * 
40 | * 41 | * .google.protobuf.Struct filter = 1 [json_name = "filter"]; 42 | */ 43 | com.google.protobuf.StructOrBuilder getFilterOrBuilder(); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/DescribeNamespaceRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface DescribeNamespaceRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:DescribeNamespaceRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The namespace to describe
15 |    * 
16 | * 17 | * string namespace = 1 [json_name = "namespace"]; 18 | * @return The namespace. 19 | */ 20 | java.lang.String getNamespace(); 21 | /** 22 | *
23 |    * The namespace to describe
24 |    * 
25 | * 26 | * string namespace = 1 [json_name = "namespace"]; 27 | * @return The bytes for namespace. 28 | */ 29 | com.google.protobuf.ByteString 30 | getNamespaceBytes(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/FetchRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface FetchRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:FetchRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The vector IDs to fetch. Does not accept values containing spaces.
15 |    * 
16 | * 17 | * repeated string ids = 1 [json_name = "ids", (.google.api.field_behavior) = REQUIRED]; 18 | * @return A list containing the ids. 19 | */ 20 | java.util.List 21 | getIdsList(); 22 | /** 23 | *
24 |    * The vector IDs to fetch. Does not accept values containing spaces.
25 |    * 
26 | * 27 | * repeated string ids = 1 [json_name = "ids", (.google.api.field_behavior) = REQUIRED]; 28 | * @return The count of ids. 29 | */ 30 | int getIdsCount(); 31 | /** 32 | *
33 |    * The vector IDs to fetch. Does not accept values containing spaces.
34 |    * 
35 | * 36 | * repeated string ids = 1 [json_name = "ids", (.google.api.field_behavior) = REQUIRED]; 37 | * @param index The index of the element to return. 38 | * @return The ids at the given index. 39 | */ 40 | java.lang.String getIds(int index); 41 | /** 42 | *
43 |    * The vector IDs to fetch. Does not accept values containing spaces.
44 |    * 
45 | * 46 | * repeated string ids = 1 [json_name = "ids", (.google.api.field_behavior) = REQUIRED]; 47 | * @param index The index of the value to return. 48 | * @return The bytes of the ids at the given index. 49 | */ 50 | com.google.protobuf.ByteString 51 | getIdsBytes(int index); 52 | 53 | /** 54 | * string namespace = 2 [json_name = "namespace"]; 55 | * @return The namespace. 56 | */ 57 | java.lang.String getNamespace(); 58 | /** 59 | * string namespace = 2 [json_name = "namespace"]; 60 | * @return The bytes for namespace. 61 | */ 62 | com.google.protobuf.ByteString 63 | getNamespaceBytes(); 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/FetchResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface FetchResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:FetchResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
 14 |    * The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
 15 |    * 
16 | * 17 | * map<string, .Vector> vectors = 1 [json_name = "vectors"]; 18 | */ 19 | int getVectorsCount(); 20 | /** 21 | *
 22 |    * The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
 23 |    * 
24 | * 25 | * map<string, .Vector> vectors = 1 [json_name = "vectors"]; 26 | */ 27 | boolean containsVectors( 28 | java.lang.String key); 29 | /** 30 | * Use {@link #getVectorsMap()} instead. 31 | */ 32 | @java.lang.Deprecated 33 | java.util.Map 34 | getVectors(); 35 | /** 36 | *
 37 |    * The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
 38 |    * 
39 | * 40 | * map<string, .Vector> vectors = 1 [json_name = "vectors"]; 41 | */ 42 | java.util.Map 43 | getVectorsMap(); 44 | /** 45 | *
 46 |    * The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
 47 |    * 
48 | * 49 | * map<string, .Vector> vectors = 1 [json_name = "vectors"]; 50 | */ 51 | /* nullable */ 52 | io.pinecone.proto.Vector getVectorsOrDefault( 53 | java.lang.String key, 54 | /* nullable */ 55 | io.pinecone.proto.Vector defaultValue); 56 | /** 57 | *
 58 |    * The fetched vectors, in the form of a map between the fetched ids and the fetched vectors
 59 |    * 
60 | * 61 | * map<string, .Vector> vectors = 1 [json_name = "vectors"]; 62 | */ 63 | io.pinecone.proto.Vector getVectorsOrThrow( 64 | java.lang.String key); 65 | 66 | /** 67 | *
 68 |    * The namespace of the vectors.
 69 |    * 
70 | * 71 | * string namespace = 2 [json_name = "namespace"]; 72 | * @return The namespace. 73 | */ 74 | java.lang.String getNamespace(); 75 | /** 76 | *
 77 |    * The namespace of the vectors.
 78 |    * 
79 | * 80 | * string namespace = 2 [json_name = "namespace"]; 81 | * @return The bytes for namespace. 82 | */ 83 | com.google.protobuf.ByteString 84 | getNamespaceBytes(); 85 | 86 | /** 87 | *
 88 |    * The usage for this operation.
 89 |    * 
90 | * 91 | * optional .Usage usage = 3 [json_name = "usage"]; 92 | * @return Whether the usage field is set. 93 | */ 94 | boolean hasUsage(); 95 | /** 96 | *
 97 |    * The usage for this operation.
 98 |    * 
99 | * 100 | * optional .Usage usage = 3 [json_name = "usage"]; 101 | * @return The usage. 102 | */ 103 | io.pinecone.proto.Usage getUsage(); 104 | /** 105 | *
106 |    * The usage for this operation.
107 |    * 
108 | * 109 | * optional .Usage usage = 3 [json_name = "usage"]; 110 | */ 111 | io.pinecone.proto.UsageOrBuilder getUsageOrBuilder(); 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/ListItemOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface ListItemOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:ListItem) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | * string id = 1 [json_name = "id"]; 14 | * @return The id. 15 | */ 16 | java.lang.String getId(); 17 | /** 18 | * string id = 1 [json_name = "id"]; 19 | * @return The bytes for id. 20 | */ 21 | com.google.protobuf.ByteString 22 | getIdBytes(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/ListNamespacesRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface ListNamespacesRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:ListNamespacesRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * Pagination token to continue a previous listing operation
15 |    * 
16 | * 17 | * optional string pagination_token = 1 [json_name = "paginationToken"]; 18 | * @return Whether the paginationToken field is set. 19 | */ 20 | boolean hasPaginationToken(); 21 | /** 22 | *
23 |    * Pagination token to continue a previous listing operation
24 |    * 
25 | * 26 | * optional string pagination_token = 1 [json_name = "paginationToken"]; 27 | * @return The paginationToken. 28 | */ 29 | java.lang.String getPaginationToken(); 30 | /** 31 | *
32 |    * Pagination token to continue a previous listing operation
33 |    * 
34 | * 35 | * optional string pagination_token = 1 [json_name = "paginationToken"]; 36 | * @return The bytes for paginationToken. 37 | */ 38 | com.google.protobuf.ByteString 39 | getPaginationTokenBytes(); 40 | 41 | /** 42 | *
43 |    * Max number of namespaces to return
44 |    * 
45 | * 46 | * optional uint32 limit = 2 [json_name = "limit"]; 47 | * @return Whether the limit field is set. 48 | */ 49 | boolean hasLimit(); 50 | /** 51 | *
52 |    * Max number of namespaces to return
53 |    * 
54 | * 55 | * optional uint32 limit = 2 [json_name = "limit"]; 56 | * @return The limit. 57 | */ 58 | int getLimit(); 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/ListNamespacesResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface ListNamespacesResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:ListNamespacesResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The list of namespaces belonging to this index.
15 |    * 
16 | * 17 | * repeated .NamespaceDescription namespaces = 1 [json_name = "namespaces"]; 18 | */ 19 | java.util.List 20 | getNamespacesList(); 21 | /** 22 | *
23 |    * The list of namespaces belonging to this index.
24 |    * 
25 | * 26 | * repeated .NamespaceDescription namespaces = 1 [json_name = "namespaces"]; 27 | */ 28 | io.pinecone.proto.NamespaceDescription getNamespaces(int index); 29 | /** 30 | *
31 |    * The list of namespaces belonging to this index.
32 |    * 
33 | * 34 | * repeated .NamespaceDescription namespaces = 1 [json_name = "namespaces"]; 35 | */ 36 | int getNamespacesCount(); 37 | /** 38 | *
39 |    * The list of namespaces belonging to this index.
40 |    * 
41 | * 42 | * repeated .NamespaceDescription namespaces = 1 [json_name = "namespaces"]; 43 | */ 44 | java.util.List 45 | getNamespacesOrBuilderList(); 46 | /** 47 | *
48 |    * The list of namespaces belonging to this index.
49 |    * 
50 | * 51 | * repeated .NamespaceDescription namespaces = 1 [json_name = "namespaces"]; 52 | */ 53 | io.pinecone.proto.NamespaceDescriptionOrBuilder getNamespacesOrBuilder( 54 | int index); 55 | 56 | /** 57 | *
58 |    * Pagination token to continue past this listing
59 |    * 
60 | * 61 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 62 | * @return Whether the pagination field is set. 63 | */ 64 | boolean hasPagination(); 65 | /** 66 | *
67 |    * Pagination token to continue past this listing
68 |    * 
69 | * 70 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 71 | * @return The pagination. 72 | */ 73 | io.pinecone.proto.Pagination getPagination(); 74 | /** 75 | *
76 |    * Pagination token to continue past this listing
77 |    * 
78 | * 79 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 80 | */ 81 | io.pinecone.proto.PaginationOrBuilder getPaginationOrBuilder(); 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/ListRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface ListRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:ListRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
 14 |    * The vector IDs to fetch. Does not accept values containing spaces.
 15 |    * 
16 | * 17 | * optional string prefix = 1 [json_name = "prefix"]; 18 | * @return Whether the prefix field is set. 19 | */ 20 | boolean hasPrefix(); 21 | /** 22 | *
 23 |    * The vector IDs to fetch. Does not accept values containing spaces.
 24 |    * 
25 | * 26 | * optional string prefix = 1 [json_name = "prefix"]; 27 | * @return The prefix. 28 | */ 29 | java.lang.String getPrefix(); 30 | /** 31 | *
 32 |    * The vector IDs to fetch. Does not accept values containing spaces.
 33 |    * 
34 | * 35 | * optional string prefix = 1 [json_name = "prefix"]; 36 | * @return The bytes for prefix. 37 | */ 38 | com.google.protobuf.ByteString 39 | getPrefixBytes(); 40 | 41 | /** 42 | *
 43 |    * Max number of ids to return
 44 |    * 
45 | * 46 | * optional uint32 limit = 2 [json_name = "limit"]; 47 | * @return Whether the limit field is set. 48 | */ 49 | boolean hasLimit(); 50 | /** 51 | *
 52 |    * Max number of ids to return
 53 |    * 
54 | * 55 | * optional uint32 limit = 2 [json_name = "limit"]; 56 | * @return The limit. 57 | */ 58 | int getLimit(); 59 | 60 | /** 61 | *
 62 |    * Pagination token to continue a previous listing operation
 63 |    * 
64 | * 65 | * optional string pagination_token = 3 [json_name = "paginationToken"]; 66 | * @return Whether the paginationToken field is set. 67 | */ 68 | boolean hasPaginationToken(); 69 | /** 70 | *
 71 |    * Pagination token to continue a previous listing operation
 72 |    * 
73 | * 74 | * optional string pagination_token = 3 [json_name = "paginationToken"]; 75 | * @return The paginationToken. 76 | */ 77 | java.lang.String getPaginationToken(); 78 | /** 79 | *
 80 |    * Pagination token to continue a previous listing operation
 81 |    * 
82 | * 83 | * optional string pagination_token = 3 [json_name = "paginationToken"]; 84 | * @return The bytes for paginationToken. 85 | */ 86 | com.google.protobuf.ByteString 87 | getPaginationTokenBytes(); 88 | 89 | /** 90 | * string namespace = 4 [json_name = "namespace"]; 91 | * @return The namespace. 92 | */ 93 | java.lang.String getNamespace(); 94 | /** 95 | * string namespace = 4 [json_name = "namespace"]; 96 | * @return The bytes for namespace. 97 | */ 98 | com.google.protobuf.ByteString 99 | getNamespaceBytes(); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/ListResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface ListResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:ListResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
 14 |    * A list of ids
 15 |    * 
16 | * 17 | * repeated .ListItem vectors = 1 [json_name = "vectors"]; 18 | */ 19 | java.util.List 20 | getVectorsList(); 21 | /** 22 | *
 23 |    * A list of ids
 24 |    * 
25 | * 26 | * repeated .ListItem vectors = 1 [json_name = "vectors"]; 27 | */ 28 | io.pinecone.proto.ListItem getVectors(int index); 29 | /** 30 | *
 31 |    * A list of ids
 32 |    * 
33 | * 34 | * repeated .ListItem vectors = 1 [json_name = "vectors"]; 35 | */ 36 | int getVectorsCount(); 37 | /** 38 | *
 39 |    * A list of ids
 40 |    * 
41 | * 42 | * repeated .ListItem vectors = 1 [json_name = "vectors"]; 43 | */ 44 | java.util.List 45 | getVectorsOrBuilderList(); 46 | /** 47 | *
 48 |    * A list of ids
 49 |    * 
50 | * 51 | * repeated .ListItem vectors = 1 [json_name = "vectors"]; 52 | */ 53 | io.pinecone.proto.ListItemOrBuilder getVectorsOrBuilder( 54 | int index); 55 | 56 | /** 57 | *
 58 |    * Pagination token to continue past this listing
 59 |    * 
60 | * 61 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 62 | * @return Whether the pagination field is set. 63 | */ 64 | boolean hasPagination(); 65 | /** 66 | *
 67 |    * Pagination token to continue past this listing
 68 |    * 
69 | * 70 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 71 | * @return The pagination. 72 | */ 73 | io.pinecone.proto.Pagination getPagination(); 74 | /** 75 | *
 76 |    * Pagination token to continue past this listing
 77 |    * 
78 | * 79 | * optional .Pagination pagination = 2 [json_name = "pagination"]; 80 | */ 81 | io.pinecone.proto.PaginationOrBuilder getPaginationOrBuilder(); 82 | 83 | /** 84 | *
 85 |    * The namespace of the vectors.
 86 |    * 
87 | * 88 | * string namespace = 3 [json_name = "namespace"]; 89 | * @return The namespace. 90 | */ 91 | java.lang.String getNamespace(); 92 | /** 93 | *
 94 |    * The namespace of the vectors.
 95 |    * 
96 | * 97 | * string namespace = 3 [json_name = "namespace"]; 98 | * @return The bytes for namespace. 99 | */ 100 | com.google.protobuf.ByteString 101 | getNamespaceBytes(); 102 | 103 | /** 104 | *
105 |    * The usage for this operation.
106 |    * 
107 | * 108 | * optional .Usage usage = 4 [json_name = "usage"]; 109 | * @return Whether the usage field is set. 110 | */ 111 | boolean hasUsage(); 112 | /** 113 | *
114 |    * The usage for this operation.
115 |    * 
116 | * 117 | * optional .Usage usage = 4 [json_name = "usage"]; 118 | * @return The usage. 119 | */ 120 | io.pinecone.proto.Usage getUsage(); 121 | /** 122 | *
123 |    * The usage for this operation.
124 |    * 
125 | * 126 | * optional .Usage usage = 4 [json_name = "usage"]; 127 | */ 128 | io.pinecone.proto.UsageOrBuilder getUsageOrBuilder(); 129 | } 130 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/NamespaceDescriptionOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface NamespaceDescriptionOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:NamespaceDescription) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | * string name = 1 [json_name = "name"]; 14 | * @return The name. 15 | */ 16 | java.lang.String getName(); 17 | /** 18 | * string name = 1 [json_name = "name"]; 19 | * @return The bytes for name. 20 | */ 21 | com.google.protobuf.ByteString 22 | getNameBytes(); 23 | 24 | /** 25 | * uint64 record_count = 2 [json_name = "recordCount"]; 26 | * @return The recordCount. 27 | */ 28 | long getRecordCount(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/NamespaceSummaryOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface NamespaceSummaryOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:NamespaceSummary) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the
15 |    * underlying index and corresponding query results, etc.
16 |    * 
17 | * 18 | * uint32 vector_count = 1 [json_name = "vectorCount"]; 19 | * @return The vectorCount. 20 | */ 21 | int getVectorCount(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/PaginationOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface PaginationOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:Pagination) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | * string next = 1 [json_name = "next"]; 14 | * @return The next. 15 | */ 16 | java.lang.String getNext(); 17 | /** 18 | * string next = 1 [json_name = "next"]; 19 | * @return The bytes for next. 20 | */ 21 | com.google.protobuf.ByteString 22 | getNextBytes(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/RequestUnionOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface RequestUnionOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:RequestUnion) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | * .UpsertRequest upsert = 1 [json_name = "upsert"]; 14 | * @return Whether the upsert field is set. 15 | */ 16 | boolean hasUpsert(); 17 | /** 18 | * .UpsertRequest upsert = 1 [json_name = "upsert"]; 19 | * @return The upsert. 20 | */ 21 | io.pinecone.proto.UpsertRequest getUpsert(); 22 | /** 23 | * .UpsertRequest upsert = 1 [json_name = "upsert"]; 24 | */ 25 | io.pinecone.proto.UpsertRequestOrBuilder getUpsertOrBuilder(); 26 | 27 | /** 28 | * .DeleteRequest delete = 2 [json_name = "delete"]; 29 | * @return Whether the delete field is set. 30 | */ 31 | boolean hasDelete(); 32 | /** 33 | * .DeleteRequest delete = 2 [json_name = "delete"]; 34 | * @return The delete. 35 | */ 36 | io.pinecone.proto.DeleteRequest getDelete(); 37 | /** 38 | * .DeleteRequest delete = 2 [json_name = "delete"]; 39 | */ 40 | io.pinecone.proto.DeleteRequestOrBuilder getDeleteOrBuilder(); 41 | 42 | /** 43 | * .UpdateRequest update = 3 [json_name = "update"]; 44 | * @return Whether the update field is set. 45 | */ 46 | boolean hasUpdate(); 47 | /** 48 | * .UpdateRequest update = 3 [json_name = "update"]; 49 | * @return The update. 50 | */ 51 | io.pinecone.proto.UpdateRequest getUpdate(); 52 | /** 53 | * .UpdateRequest update = 3 [json_name = "update"]; 54 | */ 55 | io.pinecone.proto.UpdateRequestOrBuilder getUpdateOrBuilder(); 56 | 57 | io.pinecone.proto.RequestUnion.RequestUnionInnerCase getRequestUnionInnerCase(); 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/SingleQueryResultsOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface SingleQueryResultsOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:SingleQueryResults) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The matches for the vectors.
15 |    * 
16 | * 17 | * repeated .ScoredVector matches = 1 [json_name = "matches"]; 18 | */ 19 | java.util.List 20 | getMatchesList(); 21 | /** 22 | *
23 |    * The matches for the vectors.
24 |    * 
25 | * 26 | * repeated .ScoredVector matches = 1 [json_name = "matches"]; 27 | */ 28 | io.pinecone.proto.ScoredVector getMatches(int index); 29 | /** 30 | *
31 |    * The matches for the vectors.
32 |    * 
33 | * 34 | * repeated .ScoredVector matches = 1 [json_name = "matches"]; 35 | */ 36 | int getMatchesCount(); 37 | /** 38 | *
39 |    * The matches for the vectors.
40 |    * 
41 | * 42 | * repeated .ScoredVector matches = 1 [json_name = "matches"]; 43 | */ 44 | java.util.List 45 | getMatchesOrBuilderList(); 46 | /** 47 | *
48 |    * The matches for the vectors.
49 |    * 
50 | * 51 | * repeated .ScoredVector matches = 1 [json_name = "matches"]; 52 | */ 53 | io.pinecone.proto.ScoredVectorOrBuilder getMatchesOrBuilder( 54 | int index); 55 | 56 | /** 57 | *
58 |    * The namespace for the vectors.
59 |    * 
60 | * 61 | * string namespace = 2 [json_name = "namespace"]; 62 | * @return The namespace. 63 | */ 64 | java.lang.String getNamespace(); 65 | /** 66 | *
67 |    * The namespace for the vectors.
68 |    * 
69 | * 70 | * string namespace = 2 [json_name = "namespace"]; 71 | * @return The bytes for namespace. 72 | */ 73 | com.google.protobuf.ByteString 74 | getNamespaceBytes(); 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/SparseValuesOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface SparseValuesOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:SparseValues) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | * repeated uint32 indices = 1 [json_name = "indices", (.google.api.field_behavior) = REQUIRED]; 14 | * @return A list containing the indices. 15 | */ 16 | java.util.List getIndicesList(); 17 | /** 18 | * repeated uint32 indices = 1 [json_name = "indices", (.google.api.field_behavior) = REQUIRED]; 19 | * @return The count of indices. 20 | */ 21 | int getIndicesCount(); 22 | /** 23 | * repeated uint32 indices = 1 [json_name = "indices", (.google.api.field_behavior) = REQUIRED]; 24 | * @param index The index of the element to return. 25 | * @return The indices at the given index. 26 | */ 27 | int getIndices(int index); 28 | 29 | /** 30 | * repeated float values = 2 [json_name = "values", (.google.api.field_behavior) = REQUIRED]; 31 | * @return A list containing the values. 32 | */ 33 | java.util.List getValuesList(); 34 | /** 35 | * repeated float values = 2 [json_name = "values", (.google.api.field_behavior) = REQUIRED]; 36 | * @return The count of values. 37 | */ 38 | int getValuesCount(); 39 | /** 40 | * repeated float values = 2 [json_name = "values", (.google.api.field_behavior) = REQUIRED]; 41 | * @param index The index of the element to return. 42 | * @return The values at the given index. 43 | */ 44 | float getValues(int index); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/UpdateResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface UpdateResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:UpdateResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/UpsertRequestOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface UpsertRequestOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:UpsertRequest) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
15 |    * 
16 | * 17 | * repeated .Vector vectors = 1 [json_name = "vectors", (.google.api.field_behavior) = REQUIRED]; 18 | */ 19 | java.util.List 20 | getVectorsList(); 21 | /** 22 | *
23 |    * An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
24 |    * 
25 | * 26 | * repeated .Vector vectors = 1 [json_name = "vectors", (.google.api.field_behavior) = REQUIRED]; 27 | */ 28 | io.pinecone.proto.Vector getVectors(int index); 29 | /** 30 | *
31 |    * An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
32 |    * 
33 | * 34 | * repeated .Vector vectors = 1 [json_name = "vectors", (.google.api.field_behavior) = REQUIRED]; 35 | */ 36 | int getVectorsCount(); 37 | /** 38 | *
39 |    * An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
40 |    * 
41 | * 42 | * repeated .Vector vectors = 1 [json_name = "vectors", (.google.api.field_behavior) = REQUIRED]; 43 | */ 44 | java.util.List 45 | getVectorsOrBuilderList(); 46 | /** 47 | *
48 |    * An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
49 |    * 
50 | * 51 | * repeated .Vector vectors = 1 [json_name = "vectors", (.google.api.field_behavior) = REQUIRED]; 52 | */ 53 | io.pinecone.proto.VectorOrBuilder getVectorsOrBuilder( 54 | int index); 55 | 56 | /** 57 | *
58 |    * The namespace where you upsert vectors.
59 |    * 
60 | * 61 | * string namespace = 2 [json_name = "namespace"]; 62 | * @return The namespace. 63 | */ 64 | java.lang.String getNamespace(); 65 | /** 66 | *
67 |    * The namespace where you upsert vectors.
68 |    * 
69 | * 70 | * string namespace = 2 [json_name = "namespace"]; 71 | * @return The bytes for namespace. 72 | */ 73 | com.google.protobuf.ByteString 74 | getNamespaceBytes(); 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/UpsertResponseOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface UpsertResponseOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:UpsertResponse) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The number of vectors upserted.
15 |    * 
16 | * 17 | * uint32 upserted_count = 1 [json_name = "upsertedCount"]; 18 | * @return The upsertedCount. 19 | */ 20 | int getUpsertedCount(); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/UsageOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface UsageOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:Usage) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
14 |    * The number of read units consumed by this operation.
15 |    * 
16 | * 17 | * optional uint32 read_units = 1 [json_name = "readUnits"]; 18 | * @return Whether the readUnits field is set. 19 | */ 20 | boolean hasReadUnits(); 21 | /** 22 | *
23 |    * The number of read units consumed by this operation.
24 |    * 
25 | * 26 | * optional uint32 read_units = 1 [json_name = "readUnits"]; 27 | * @return The readUnits. 28 | */ 29 | int getReadUnits(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/proto/VectorOrBuilder.java: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // NO CHECKED-IN PROTOBUF GENCODE 3 | // source: db_data_2025-04.proto 4 | // Protobuf Java Version: 4.29.3 5 | 6 | package io.pinecone.proto; 7 | 8 | public interface VectorOrBuilder extends 9 | // @@protoc_insertion_point(interface_extends:Vector) 10 | com.google.protobuf.MessageOrBuilder { 11 | 12 | /** 13 | *
 14 |    * This is the vector's unique id.
 15 |    * 
16 | * 17 | * string id = 1 [json_name = "id", (.google.api.field_behavior) = REQUIRED]; 18 | * @return The id. 19 | */ 20 | java.lang.String getId(); 21 | /** 22 | *
 23 |    * This is the vector's unique id.
 24 |    * 
25 | * 26 | * string id = 1 [json_name = "id", (.google.api.field_behavior) = REQUIRED]; 27 | * @return The bytes for id. 28 | */ 29 | com.google.protobuf.ByteString 30 | getIdBytes(); 31 | 32 | /** 33 | *
 34 |    * This is the vector data included in the request.
 35 |    * 
36 | * 37 | * repeated float values = 2 [json_name = "values"]; 38 | * @return A list containing the values. 39 | */ 40 | java.util.List getValuesList(); 41 | /** 42 | *
 43 |    * This is the vector data included in the request.
 44 |    * 
45 | * 46 | * repeated float values = 2 [json_name = "values"]; 47 | * @return The count of values. 48 | */ 49 | int getValuesCount(); 50 | /** 51 | *
 52 |    * This is the vector data included in the request.
 53 |    * 
54 | * 55 | * repeated float values = 2 [json_name = "values"]; 56 | * @param index The index of the element to return. 57 | * @return The values at the given index. 58 | */ 59 | float getValues(int index); 60 | 61 | /** 62 | *
 63 |    * This is the sparse data included in the request. Can only be specified if `sparse` index.
 64 |    * 
65 | * 66 | * .SparseValues sparse_values = 4 [json_name = "sparseValues"]; 67 | * @return Whether the sparseValues field is set. 68 | */ 69 | boolean hasSparseValues(); 70 | /** 71 | *
 72 |    * This is the sparse data included in the request. Can only be specified if `sparse` index.
 73 |    * 
74 | * 75 | * .SparseValues sparse_values = 4 [json_name = "sparseValues"]; 76 | * @return The sparseValues. 77 | */ 78 | io.pinecone.proto.SparseValues getSparseValues(); 79 | /** 80 | *
 81 |    * This is the sparse data included in the request. Can only be specified if `sparse` index.
 82 |    * 
83 | * 84 | * .SparseValues sparse_values = 4 [json_name = "sparseValues"]; 85 | */ 86 | io.pinecone.proto.SparseValuesOrBuilder getSparseValuesOrBuilder(); 87 | 88 | /** 89 | *
 90 |    * This is the metadata included in the request.
 91 |    * 
92 | * 93 | * .google.protobuf.Struct metadata = 3 [json_name = "metadata"]; 94 | * @return Whether the metadata field is set. 95 | */ 96 | boolean hasMetadata(); 97 | /** 98 | *
 99 |    * This is the metadata included in the request.
100 |    * 
101 | * 102 | * .google.protobuf.Struct metadata = 3 [json_name = "metadata"]; 103 | * @return The metadata. 104 | */ 105 | com.google.protobuf.Struct getMetadata(); 106 | /** 107 | *
108 |    * This is the metadata included in the request.
109 |    * 
110 | * 111 | * .google.protobuf.Struct metadata = 3 [json_name = "metadata"]; 112 | */ 113 | com.google.protobuf.StructOrBuilder getMetadataOrBuilder(); 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/io/pinecone/utils/SparseIndicesConverter.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.utils; 2 | 3 | import io.pinecone.exceptions.PineconeValidationException; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | public class SparseIndicesConverter { 9 | public static List convertUnsigned32IntToSigned32Int(List unsigned32IntValues) { 10 | List int32Values = new ArrayList<>(); 11 | for (Long value : unsigned32IntValues) { 12 | if (value < 0 || value > 0xFFFFFFFFL) { 13 | throw new PineconeValidationException("Sparse indices are out of range for unsigned 32-bit integers."); 14 | } 15 | int32Values.add(value.intValue()); 16 | } 17 | return int32Values; 18 | } 19 | 20 | public static List convertSigned32IntToUnsigned32Int(List signed32IntValues) { 21 | List uint32Values = new ArrayList<>(); 22 | for (Integer value : signed32IntValues) { 23 | if (value < 0) { 24 | uint32Values.add((long) value + 4294967296L); 25 | } else { 26 | uint32Values.add((long) value); 27 | } 28 | } 29 | return uint32Values; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ApiCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import java.io.IOException; 17 | 18 | import java.util.Map; 19 | import java.util.List; 20 | 21 | /** 22 | * Callback for asynchronous API call. 23 | * 24 | * @param The return type 25 | */ 26 | public interface ApiCallback { 27 | /** 28 | * This is called when the API call fails. 29 | * 30 | * @param e The exception causing the failure 31 | * @param statusCode Status code of the response if available, otherwise it would be 0 32 | * @param responseHeaders Headers of the response if available, otherwise it would be null 33 | */ 34 | void onFailure(ApiException e, int statusCode, Map> responseHeaders); 35 | 36 | /** 37 | * This is called when the API call succeeded. 38 | * 39 | * @param result The result deserialized from response 40 | * @param statusCode Status code of the response 41 | * @param responseHeaders Headers of the response 42 | */ 43 | void onSuccess(T result, int statusCode, Map> responseHeaders); 44 | 45 | /** 46 | * This is called when the API upload processing. 47 | * 48 | * @param bytesWritten bytes Written 49 | * @param contentLength content length of request body 50 | * @param done write end 51 | */ 52 | void onUploadProgress(long bytesWritten, long contentLength, boolean done); 53 | 54 | /** 55 | * This is called when the API download processing. 56 | * 57 | * @param bytesRead bytes Read 58 | * @param contentLength content length of the response 59 | * @param done Read end 60 | */ 61 | void onDownloadProgress(long bytesRead, long contentLength, boolean done); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * API response returned by API call. 21 | */ 22 | public class ApiResponse { 23 | final private int statusCode; 24 | final private Map> headers; 25 | final private T data; 26 | 27 | /** 28 | *

Constructor for ApiResponse.

29 | * 30 | * @param statusCode The status code of HTTP response 31 | * @param headers The headers of HTTP response 32 | */ 33 | public ApiResponse(int statusCode, Map> headers) { 34 | this(statusCode, headers, null); 35 | } 36 | 37 | /** 38 | *

Constructor for ApiResponse.

39 | * 40 | * @param statusCode The status code of HTTP response 41 | * @param headers The headers of HTTP response 42 | * @param data The object deserialized from response bod 43 | */ 44 | public ApiResponse(int statusCode, Map> headers, T data) { 45 | this.statusCode = statusCode; 46 | this.headers = headers; 47 | this.data = data; 48 | } 49 | 50 | /** 51 | *

Get the status code.

52 | * 53 | * @return the status code 54 | */ 55 | public int getStatusCode() { 56 | return statusCode; 57 | } 58 | 59 | /** 60 | *

Get the headers.

61 | * 62 | * @return a {@link java.util.Map} of headers 63 | */ 64 | public Map> getHeaders() { 65 | return headers; 66 | } 67 | 68 | /** 69 | *

Get the data.

70 | * 71 | * @return the data 72 | */ 73 | public T getData() { 74 | return data; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:13.211110Z[Etc/UTC]") 17 | public class Configuration { 18 | public static final String VERSION = "2025-04"; 19 | 20 | private static ApiClient defaultApiClient = new ApiClient(); 21 | 22 | /** 23 | * Get the default API client, which would be used when creating API 24 | * instances without providing an API client. 25 | * 26 | * @return Default API client 27 | */ 28 | public static ApiClient getDefaultApiClient() { 29 | return defaultApiClient; 30 | } 31 | 32 | /** 33 | * Set the default API client, which would be used when creating API 34 | * instances without providing an API client. 35 | * 36 | * @param apiClient API client 37 | */ 38 | public static void setDefaultApiClient(ApiClient apiClient) { 39 | defaultApiClient = apiClient; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/GzipRequestInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import okhttp3.*; 17 | import okio.Buffer; 18 | import okio.BufferedSink; 19 | import okio.GzipSink; 20 | import okio.Okio; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Encodes request bodies using gzip. 26 | * 27 | * Taken from https://github.com/square/okhttp/issues/350 28 | */ 29 | class GzipRequestInterceptor implements Interceptor { 30 | @Override 31 | public Response intercept(Chain chain) throws IOException { 32 | Request originalRequest = chain.request(); 33 | if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { 34 | return chain.proceed(originalRequest); 35 | } 36 | 37 | Request compressedRequest = originalRequest.newBuilder() 38 | .header("Content-Encoding", "gzip") 39 | .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) 40 | .build(); 41 | return chain.proceed(compressedRequest); 42 | } 43 | 44 | private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { 45 | final Buffer buffer = new Buffer(); 46 | requestBody.writeTo(buffer); 47 | return new RequestBody() { 48 | @Override 49 | public MediaType contentType() { 50 | return requestBody.contentType(); 51 | } 52 | 53 | @Override 54 | public long contentLength() { 55 | return buffer.size(); 56 | } 57 | 58 | @Override 59 | public void writeTo(BufferedSink sink) throws IOException { 60 | sink.write(buffer.snapshot()); 61 | } 62 | }; 63 | } 64 | 65 | private RequestBody gzip(final RequestBody body) { 66 | return new RequestBody() { 67 | @Override 68 | public MediaType contentType() { 69 | return body.contentType(); 70 | } 71 | 72 | @Override 73 | public long contentLength() { 74 | return -1; // We don't know the compressed length in advance! 75 | } 76 | 77 | @Override 78 | public void writeTo(BufferedSink sink) throws IOException { 79 | BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); 80 | body.writeTo(gzipSink); 81 | gzipSink.close(); 82 | } 83 | }; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:13.211110Z[Etc/UTC]") 17 | public class Pair { 18 | private String name = ""; 19 | private String value = ""; 20 | 21 | public Pair (String name, String value) { 22 | setName(name); 23 | setValue(value); 24 | } 25 | 26 | private void setName(String name) { 27 | if (!isValidString(name)) { 28 | return; 29 | } 30 | 31 | this.name = name; 32 | } 33 | 34 | private void setValue(String value) { 35 | if (!isValidString(value)) { 36 | return; 37 | } 38 | 39 | this.value = value; 40 | } 41 | 42 | public String getName() { 43 | return this.name; 44 | } 45 | 46 | public String getValue() { 47 | return this.value; 48 | } 49 | 50 | private boolean isValidString(String arg) { 51 | if (arg == null) { 52 | return false; 53 | } 54 | 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ProgressRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.RequestBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSink; 23 | import okio.ForwardingSink; 24 | import okio.Okio; 25 | import okio.Sink; 26 | 27 | public class ProgressRequestBody extends RequestBody { 28 | 29 | private final RequestBody requestBody; 30 | 31 | private final ApiCallback callback; 32 | 33 | public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { 34 | this.requestBody = requestBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return requestBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() throws IOException { 45 | return requestBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public void writeTo(BufferedSink sink) throws IOException { 50 | BufferedSink bufferedSink = Okio.buffer(sink(sink)); 51 | requestBody.writeTo(bufferedSink); 52 | bufferedSink.flush(); 53 | } 54 | 55 | private Sink sink(Sink sink) { 56 | return new ForwardingSink(sink) { 57 | 58 | long bytesWritten = 0L; 59 | long contentLength = 0L; 60 | 61 | @Override 62 | public void write(Buffer source, long byteCount) throws IOException { 63 | super.write(source, byteCount); 64 | if (contentLength == 0) { 65 | contentLength = contentLength(); 66 | } 67 | 68 | bytesWritten += byteCount; 69 | callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); 70 | } 71 | }; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ProgressResponseBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.ResponseBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSource; 23 | import okio.ForwardingSource; 24 | import okio.Okio; 25 | import okio.Source; 26 | 27 | public class ProgressResponseBody extends ResponseBody { 28 | 29 | private final ResponseBody responseBody; 30 | private final ApiCallback callback; 31 | private BufferedSource bufferedSource; 32 | 33 | public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { 34 | this.responseBody = responseBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return responseBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() { 45 | return responseBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public BufferedSource source() { 50 | if (bufferedSource == null) { 51 | bufferedSource = Okio.buffer(source(responseBody.source())); 52 | } 53 | return bufferedSource; 54 | } 55 | 56 | private Source source(Source source) { 57 | return new ForwardingSource(source) { 58 | long totalBytesRead = 0L; 59 | 60 | @Override 61 | public long read(Buffer sink, long byteCount) throws IOException { 62 | long bytesRead = super.read(sink, byteCount); 63 | // read() returns the number of bytes read, or -1 if this source is exhausted. 64 | totalBytesRead += bytesRead != -1 ? bytesRead : 0; 65 | callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); 66 | return bytesRead; 67 | } 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ServerConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.db_control.client; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Representing a Server configuration. 7 | */ 8 | public class ServerConfiguration { 9 | public String URL; 10 | public String description; 11 | public Map variables; 12 | 13 | /** 14 | * @param URL A URL to the target host. 15 | * @param description A description of the host designated by the URL. 16 | * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. 17 | */ 18 | public ServerConfiguration(String URL, String description, Map variables) { 19 | this.URL = URL; 20 | this.description = description; 21 | this.variables = variables; 22 | } 23 | 24 | /** 25 | * Format URL template using given variables. 26 | * 27 | * @param variables A map between a variable name and its value. 28 | * @return Formatted URL. 29 | */ 30 | public String URL(Map variables) { 31 | String url = this.URL; 32 | 33 | // go through variables and replace placeholders 34 | for (Map.Entry variable: this.variables.entrySet()) { 35 | String name = variable.getKey(); 36 | ServerVariable serverVariable = variable.getValue(); 37 | String value = serverVariable.defaultValue; 38 | 39 | if (variables != null && variables.containsKey(name)) { 40 | value = variables.get(name); 41 | if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { 42 | throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); 43 | } 44 | } 45 | url = url.replace("{" + name + "}", value); 46 | } 47 | return url; 48 | } 49 | 50 | /** 51 | * Format URL template using default server variables. 52 | * 53 | * @return Formatted URL. 54 | */ 55 | public String URL() { 56 | return URL(null); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/ServerVariable.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.db_control.client; 2 | 3 | import java.util.HashSet; 4 | 5 | /** 6 | * Representing a Server Variable for server URL template substitution. 7 | */ 8 | public class ServerVariable { 9 | public String description; 10 | public String defaultValue; 11 | public HashSet enumValues = null; 12 | 13 | /** 14 | * @param description A description for the server variable. 15 | * @param defaultValue The default value to use for substitution. 16 | * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. 17 | */ 18 | public ServerVariable(String description, String defaultValue, HashSet enumValues) { 19 | this.description = description; 20 | this.defaultValue = defaultValue; 21 | this.enumValues = enumValues; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client; 15 | 16 | import java.util.Collection; 17 | import java.util.Iterator; 18 | 19 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:13.211110Z[Etc/UTC]") 20 | public class StringUtil { 21 | /** 22 | * Check if the given array contains the given value (with case-insensitive comparison). 23 | * 24 | * @param array The array 25 | * @param value The value to search 26 | * @return true if the array contains the value 27 | */ 28 | public static boolean containsIgnoreCase(String[] array, String value) { 29 | for (String str : array) { 30 | if (value == null && str == null) { 31 | return true; 32 | } 33 | if (value != null && value.equalsIgnoreCase(str)) { 34 | return true; 35 | } 36 | } 37 | return false; 38 | } 39 | 40 | /** 41 | * Join an array of strings with the given separator. 42 | *

43 | * Note: This might be replaced by utility method from commons-lang or guava someday 44 | * if one of those libraries is added as dependency. 45 | *

46 | * 47 | * @param array The array of strings 48 | * @param separator The separator 49 | * @return the resulting string 50 | */ 51 | public static String join(String[] array, String separator) { 52 | int len = array.length; 53 | if (len == 0) { 54 | return ""; 55 | } 56 | 57 | StringBuilder out = new StringBuilder(); 58 | out.append(array[0]); 59 | for (int i = 1; i < len; i++) { 60 | out.append(separator).append(array[i]); 61 | } 62 | return out.toString(); 63 | } 64 | 65 | /** 66 | * Join a list of strings with the given separator. 67 | * 68 | * @param list The list of strings 69 | * @param separator The separator 70 | * @return the resulting string 71 | */ 72 | public static String join(Collection list, String separator) { 73 | Iterator iterator = list.iterator(); 74 | StringBuilder out = new StringBuilder(); 75 | if (iterator.hasNext()) { 76 | out.append(iterator.next()); 77 | } 78 | while (iterator.hasNext()) { 79 | out.append(separator).append(iterator.next()); 80 | } 81 | return out.toString(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/auth/ApiKeyAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client.auth; 15 | 16 | import org.openapitools.db_control.client.ApiException; 17 | import org.openapitools.db_control.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:13.211110Z[Etc/UTC]") 24 | public class ApiKeyAuth implements Authentication { 25 | private final String location; 26 | private final String paramName; 27 | 28 | private String apiKey; 29 | private String apiKeyPrefix; 30 | 31 | public ApiKeyAuth(String location, String paramName) { 32 | this.location = location; 33 | this.paramName = paramName; 34 | } 35 | 36 | public String getLocation() { 37 | return location; 38 | } 39 | 40 | public String getParamName() { 41 | return paramName; 42 | } 43 | 44 | public String getApiKey() { 45 | return apiKey; 46 | } 47 | 48 | public void setApiKey(String apiKey) { 49 | this.apiKey = apiKey; 50 | } 51 | 52 | public String getApiKeyPrefix() { 53 | return apiKeyPrefix; 54 | } 55 | 56 | public void setApiKeyPrefix(String apiKeyPrefix) { 57 | this.apiKeyPrefix = apiKeyPrefix; 58 | } 59 | 60 | @Override 61 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 62 | String payload, String method, URI uri) throws ApiException { 63 | if (apiKey == null) { 64 | return; 65 | } 66 | String value; 67 | if (apiKeyPrefix != null) { 68 | value = apiKeyPrefix + " " + apiKey; 69 | } else { 70 | value = apiKey; 71 | } 72 | if ("query".equals(location)) { 73 | queryParams.add(new Pair(paramName, value)); 74 | } else if ("header".equals(location)) { 75 | headerParams.put(paramName, value); 76 | } else if ("cookie".equals(location)) { 77 | cookieParams.put(paramName, value); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/auth/Authentication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client.auth; 15 | 16 | import org.openapitools.db_control.client.Pair; 17 | import org.openapitools.db_control.client.ApiException; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | public interface Authentication { 24 | /** 25 | * Apply authentication settings to header and query params. 26 | * 27 | * @param queryParams List of query parameters 28 | * @param headerParams Map of header parameters 29 | * @param cookieParams Map of cookie parameters 30 | * @param payload HTTP request body 31 | * @param method HTTP method 32 | * @param uri URI 33 | * @throws ApiException if failed to update the parameters 34 | */ 35 | void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/auth/HttpBasicAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client.auth; 15 | 16 | import org.openapitools.db_control.client.Pair; 17 | import org.openapitools.db_control.client.ApiException; 18 | 19 | import okhttp3.Credentials; 20 | 21 | import java.net.URI; 22 | import java.util.Map; 23 | import java.util.List; 24 | 25 | import java.io.UnsupportedEncodingException; 26 | 27 | public class HttpBasicAuth implements Authentication { 28 | private String username; 29 | private String password; 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) { 36 | this.username = username; 37 | } 38 | 39 | public String getPassword() { 40 | return password; 41 | } 42 | 43 | public void setPassword(String password) { 44 | this.password = password; 45 | } 46 | 47 | @Override 48 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 49 | String payload, String method, URI uri) throws ApiException { 50 | if (username == null && password == null) { 51 | return; 52 | } 53 | headerParams.put("Authorization", Credentials.basic( 54 | username == null ? "" : username, 55 | password == null ? "" : password)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/auth/HttpBearerAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client.auth; 15 | 16 | import org.openapitools.db_control.client.ApiException; 17 | import org.openapitools.db_control.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:13.211110Z[Etc/UTC]") 24 | public class HttpBearerAuth implements Authentication { 25 | private final String scheme; 26 | private String bearerToken; 27 | 28 | public HttpBearerAuth(String scheme) { 29 | this.scheme = scheme; 30 | } 31 | 32 | /** 33 | * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. 34 | * 35 | * @return The bearer token 36 | */ 37 | public String getBearerToken() { 38 | return bearerToken; 39 | } 40 | 41 | /** 42 | * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. 43 | * 44 | * @param bearerToken The bearer token to send in the Authorization header 45 | */ 46 | public void setBearerToken(String bearerToken) { 47 | this.bearerToken = bearerToken; 48 | } 49 | 50 | @Override 51 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 52 | String payload, String method, URI uri) throws ApiException { 53 | if (bearerToken == null) { 54 | return; 55 | } 56 | 57 | headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); 58 | } 59 | 60 | private static String upperCaseBearer(String scheme) { 61 | return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_control/client/model/DeletionProtection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Control Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_control.client.model; 15 | 16 | import java.util.Objects; 17 | import com.google.gson.annotations.SerializedName; 18 | 19 | import java.io.IOException; 20 | import com.google.gson.TypeAdapter; 21 | import com.google.gson.annotations.JsonAdapter; 22 | import com.google.gson.stream.JsonReader; 23 | import com.google.gson.stream.JsonWriter; 24 | 25 | /** 26 | * Whether [deletion protection](http://docs.pinecone.io/guides/manage-data/manage-indexes#configure-deletion-protection) is enabled/disabled for the index. 27 | */ 28 | @JsonAdapter(DeletionProtection.Adapter.class) 29 | public enum DeletionProtection { 30 | 31 | DISABLED("disabled"), 32 | 33 | ENABLED("enabled"); 34 | 35 | private String value; 36 | 37 | DeletionProtection(String value) { 38 | this.value = value; 39 | } 40 | 41 | public String getValue() { 42 | return value; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return String.valueOf(value); 48 | } 49 | 50 | public static DeletionProtection fromValue(String value) { 51 | for (DeletionProtection b : DeletionProtection.values()) { 52 | if (b.value.equals(value)) { 53 | return b; 54 | } 55 | } 56 | throw new IllegalArgumentException("Unexpected value '" + value + "'"); 57 | } 58 | 59 | public static class Adapter extends TypeAdapter { 60 | @Override 61 | public void write(final JsonWriter jsonWriter, final DeletionProtection enumeration) throws IOException { 62 | jsonWriter.value(enumeration.getValue()); 63 | } 64 | 65 | @Override 66 | public DeletionProtection read(final JsonReader jsonReader) throws IOException { 67 | String value = jsonReader.nextString(); 68 | return DeletionProtection.fromValue(value); 69 | } 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ApiCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import java.io.IOException; 17 | 18 | import java.util.Map; 19 | import java.util.List; 20 | 21 | /** 22 | * Callback for asynchronous API call. 23 | * 24 | * @param The return type 25 | */ 26 | public interface ApiCallback { 27 | /** 28 | * This is called when the API call fails. 29 | * 30 | * @param e The exception causing the failure 31 | * @param statusCode Status code of the response if available, otherwise it would be 0 32 | * @param responseHeaders Headers of the response if available, otherwise it would be null 33 | */ 34 | void onFailure(ApiException e, int statusCode, Map> responseHeaders); 35 | 36 | /** 37 | * This is called when the API call succeeded. 38 | * 39 | * @param result The result deserialized from response 40 | * @param statusCode Status code of the response 41 | * @param responseHeaders Headers of the response 42 | */ 43 | void onSuccess(T result, int statusCode, Map> responseHeaders); 44 | 45 | /** 46 | * This is called when the API upload processing. 47 | * 48 | * @param bytesWritten bytes Written 49 | * @param contentLength content length of request body 50 | * @param done write end 51 | */ 52 | void onUploadProgress(long bytesWritten, long contentLength, boolean done); 53 | 54 | /** 55 | * This is called when the API download processing. 56 | * 57 | * @param bytesRead bytes Read 58 | * @param contentLength content length of the response 59 | * @param done Read end 60 | */ 61 | void onDownloadProgress(long bytesRead, long contentLength, boolean done); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * API response returned by API call. 21 | */ 22 | public class ApiResponse { 23 | final private int statusCode; 24 | final private Map> headers; 25 | final private T data; 26 | 27 | /** 28 | *

Constructor for ApiResponse.

29 | * 30 | * @param statusCode The status code of HTTP response 31 | * @param headers The headers of HTTP response 32 | */ 33 | public ApiResponse(int statusCode, Map> headers) { 34 | this(statusCode, headers, null); 35 | } 36 | 37 | /** 38 | *

Constructor for ApiResponse.

39 | * 40 | * @param statusCode The status code of HTTP response 41 | * @param headers The headers of HTTP response 42 | * @param data The object deserialized from response bod 43 | */ 44 | public ApiResponse(int statusCode, Map> headers, T data) { 45 | this.statusCode = statusCode; 46 | this.headers = headers; 47 | this.data = data; 48 | } 49 | 50 | /** 51 | *

Get the status code.

52 | * 53 | * @return the status code 54 | */ 55 | public int getStatusCode() { 56 | return statusCode; 57 | } 58 | 59 | /** 60 | *

Get the headers.

61 | * 62 | * @return a {@link java.util.Map} of headers 63 | */ 64 | public Map> getHeaders() { 65 | return headers; 66 | } 67 | 68 | /** 69 | *

Get the data.

70 | * 71 | * @return the data 72 | */ 73 | public T getData() { 74 | return data; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:22.496740Z[Etc/UTC]") 17 | public class Configuration { 18 | public static final String VERSION = "2025-04"; 19 | 20 | private static ApiClient defaultApiClient = new ApiClient(); 21 | 22 | /** 23 | * Get the default API client, which would be used when creating API 24 | * instances without providing an API client. 25 | * 26 | * @return Default API client 27 | */ 28 | public static ApiClient getDefaultApiClient() { 29 | return defaultApiClient; 30 | } 31 | 32 | /** 33 | * Set the default API client, which would be used when creating API 34 | * instances without providing an API client. 35 | * 36 | * @param apiClient API client 37 | */ 38 | public static void setDefaultApiClient(ApiClient apiClient) { 39 | defaultApiClient = apiClient; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/GzipRequestInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import okhttp3.*; 17 | import okio.Buffer; 18 | import okio.BufferedSink; 19 | import okio.GzipSink; 20 | import okio.Okio; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Encodes request bodies using gzip. 26 | * 27 | * Taken from https://github.com/square/okhttp/issues/350 28 | */ 29 | class GzipRequestInterceptor implements Interceptor { 30 | @Override 31 | public Response intercept(Chain chain) throws IOException { 32 | Request originalRequest = chain.request(); 33 | if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { 34 | return chain.proceed(originalRequest); 35 | } 36 | 37 | Request compressedRequest = originalRequest.newBuilder() 38 | .header("Content-Encoding", "gzip") 39 | .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) 40 | .build(); 41 | return chain.proceed(compressedRequest); 42 | } 43 | 44 | private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { 45 | final Buffer buffer = new Buffer(); 46 | requestBody.writeTo(buffer); 47 | return new RequestBody() { 48 | @Override 49 | public MediaType contentType() { 50 | return requestBody.contentType(); 51 | } 52 | 53 | @Override 54 | public long contentLength() { 55 | return buffer.size(); 56 | } 57 | 58 | @Override 59 | public void writeTo(BufferedSink sink) throws IOException { 60 | sink.write(buffer.snapshot()); 61 | } 62 | }; 63 | } 64 | 65 | private RequestBody gzip(final RequestBody body) { 66 | return new RequestBody() { 67 | @Override 68 | public MediaType contentType() { 69 | return body.contentType(); 70 | } 71 | 72 | @Override 73 | public long contentLength() { 74 | return -1; // We don't know the compressed length in advance! 75 | } 76 | 77 | @Override 78 | public void writeTo(BufferedSink sink) throws IOException { 79 | BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); 80 | body.writeTo(gzipSink); 81 | gzipSink.close(); 82 | } 83 | }; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:22.496740Z[Etc/UTC]") 17 | public class Pair { 18 | private String name = ""; 19 | private String value = ""; 20 | 21 | public Pair (String name, String value) { 22 | setName(name); 23 | setValue(value); 24 | } 25 | 26 | private void setName(String name) { 27 | if (!isValidString(name)) { 28 | return; 29 | } 30 | 31 | this.name = name; 32 | } 33 | 34 | private void setValue(String value) { 35 | if (!isValidString(value)) { 36 | return; 37 | } 38 | 39 | this.value = value; 40 | } 41 | 42 | public String getName() { 43 | return this.name; 44 | } 45 | 46 | public String getValue() { 47 | return this.value; 48 | } 49 | 50 | private boolean isValidString(String arg) { 51 | if (arg == null) { 52 | return false; 53 | } 54 | 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ProgressRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.RequestBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSink; 23 | import okio.ForwardingSink; 24 | import okio.Okio; 25 | import okio.Sink; 26 | 27 | public class ProgressRequestBody extends RequestBody { 28 | 29 | private final RequestBody requestBody; 30 | 31 | private final ApiCallback callback; 32 | 33 | public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { 34 | this.requestBody = requestBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return requestBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() throws IOException { 45 | return requestBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public void writeTo(BufferedSink sink) throws IOException { 50 | BufferedSink bufferedSink = Okio.buffer(sink(sink)); 51 | requestBody.writeTo(bufferedSink); 52 | bufferedSink.flush(); 53 | } 54 | 55 | private Sink sink(Sink sink) { 56 | return new ForwardingSink(sink) { 57 | 58 | long bytesWritten = 0L; 59 | long contentLength = 0L; 60 | 61 | @Override 62 | public void write(Buffer source, long byteCount) throws IOException { 63 | super.write(source, byteCount); 64 | if (contentLength == 0) { 65 | contentLength = contentLength(); 66 | } 67 | 68 | bytesWritten += byteCount; 69 | callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); 70 | } 71 | }; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ProgressResponseBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.ResponseBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSource; 23 | import okio.ForwardingSource; 24 | import okio.Okio; 25 | import okio.Source; 26 | 27 | public class ProgressResponseBody extends ResponseBody { 28 | 29 | private final ResponseBody responseBody; 30 | private final ApiCallback callback; 31 | private BufferedSource bufferedSource; 32 | 33 | public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { 34 | this.responseBody = responseBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return responseBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() { 45 | return responseBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public BufferedSource source() { 50 | if (bufferedSource == null) { 51 | bufferedSource = Okio.buffer(source(responseBody.source())); 52 | } 53 | return bufferedSource; 54 | } 55 | 56 | private Source source(Source source) { 57 | return new ForwardingSource(source) { 58 | long totalBytesRead = 0L; 59 | 60 | @Override 61 | public long read(Buffer sink, long byteCount) throws IOException { 62 | long bytesRead = super.read(sink, byteCount); 63 | // read() returns the number of bytes read, or -1 if this source is exhausted. 64 | totalBytesRead += bytesRead != -1 ? bytesRead : 0; 65 | callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); 66 | return bytesRead; 67 | } 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ServerConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.db_data.client; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Representing a Server configuration. 7 | */ 8 | public class ServerConfiguration { 9 | public String URL; 10 | public String description; 11 | public Map variables; 12 | 13 | /** 14 | * @param URL A URL to the target host. 15 | * @param description A description of the host designated by the URL. 16 | * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. 17 | */ 18 | public ServerConfiguration(String URL, String description, Map variables) { 19 | this.URL = URL; 20 | this.description = description; 21 | this.variables = variables; 22 | } 23 | 24 | /** 25 | * Format URL template using given variables. 26 | * 27 | * @param variables A map between a variable name and its value. 28 | * @return Formatted URL. 29 | */ 30 | public String URL(Map variables) { 31 | String url = this.URL; 32 | 33 | // go through variables and replace placeholders 34 | for (Map.Entry variable: this.variables.entrySet()) { 35 | String name = variable.getKey(); 36 | ServerVariable serverVariable = variable.getValue(); 37 | String value = serverVariable.defaultValue; 38 | 39 | if (variables != null && variables.containsKey(name)) { 40 | value = variables.get(name); 41 | if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { 42 | throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); 43 | } 44 | } 45 | url = url.replace("{" + name + "}", value); 46 | } 47 | return url; 48 | } 49 | 50 | /** 51 | * Format URL template using default server variables. 52 | * 53 | * @return Formatted URL. 54 | */ 55 | public String URL() { 56 | return URL(null); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/ServerVariable.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.db_data.client; 2 | 3 | import java.util.HashSet; 4 | 5 | /** 6 | * Representing a Server Variable for server URL template substitution. 7 | */ 8 | public class ServerVariable { 9 | public String description; 10 | public String defaultValue; 11 | public HashSet enumValues = null; 12 | 13 | /** 14 | * @param description A description for the server variable. 15 | * @param defaultValue The default value to use for substitution. 16 | * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. 17 | */ 18 | public ServerVariable(String description, String defaultValue, HashSet enumValues) { 19 | this.description = description; 20 | this.defaultValue = defaultValue; 21 | this.enumValues = enumValues; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client; 15 | 16 | import java.util.Collection; 17 | import java.util.Iterator; 18 | 19 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:22.496740Z[Etc/UTC]") 20 | public class StringUtil { 21 | /** 22 | * Check if the given array contains the given value (with case-insensitive comparison). 23 | * 24 | * @param array The array 25 | * @param value The value to search 26 | * @return true if the array contains the value 27 | */ 28 | public static boolean containsIgnoreCase(String[] array, String value) { 29 | for (String str : array) { 30 | if (value == null && str == null) { 31 | return true; 32 | } 33 | if (value != null && value.equalsIgnoreCase(str)) { 34 | return true; 35 | } 36 | } 37 | return false; 38 | } 39 | 40 | /** 41 | * Join an array of strings with the given separator. 42 | *

43 | * Note: This might be replaced by utility method from commons-lang or guava someday 44 | * if one of those libraries is added as dependency. 45 | *

46 | * 47 | * @param array The array of strings 48 | * @param separator The separator 49 | * @return the resulting string 50 | */ 51 | public static String join(String[] array, String separator) { 52 | int len = array.length; 53 | if (len == 0) { 54 | return ""; 55 | } 56 | 57 | StringBuilder out = new StringBuilder(); 58 | out.append(array[0]); 59 | for (int i = 1; i < len; i++) { 60 | out.append(separator).append(array[i]); 61 | } 62 | return out.toString(); 63 | } 64 | 65 | /** 66 | * Join a list of strings with the given separator. 67 | * 68 | * @param list The list of strings 69 | * @param separator The separator 70 | * @return the resulting string 71 | */ 72 | public static String join(Collection list, String separator) { 73 | Iterator iterator = list.iterator(); 74 | StringBuilder out = new StringBuilder(); 75 | if (iterator.hasNext()) { 76 | out.append(iterator.next()); 77 | } 78 | while (iterator.hasNext()) { 79 | out.append(separator).append(iterator.next()); 80 | } 81 | return out.toString(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/auth/ApiKeyAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client.auth; 15 | 16 | import org.openapitools.db_data.client.ApiException; 17 | import org.openapitools.db_data.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:22.496740Z[Etc/UTC]") 24 | public class ApiKeyAuth implements Authentication { 25 | private final String location; 26 | private final String paramName; 27 | 28 | private String apiKey; 29 | private String apiKeyPrefix; 30 | 31 | public ApiKeyAuth(String location, String paramName) { 32 | this.location = location; 33 | this.paramName = paramName; 34 | } 35 | 36 | public String getLocation() { 37 | return location; 38 | } 39 | 40 | public String getParamName() { 41 | return paramName; 42 | } 43 | 44 | public String getApiKey() { 45 | return apiKey; 46 | } 47 | 48 | public void setApiKey(String apiKey) { 49 | this.apiKey = apiKey; 50 | } 51 | 52 | public String getApiKeyPrefix() { 53 | return apiKeyPrefix; 54 | } 55 | 56 | public void setApiKeyPrefix(String apiKeyPrefix) { 57 | this.apiKeyPrefix = apiKeyPrefix; 58 | } 59 | 60 | @Override 61 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 62 | String payload, String method, URI uri) throws ApiException { 63 | if (apiKey == null) { 64 | return; 65 | } 66 | String value; 67 | if (apiKeyPrefix != null) { 68 | value = apiKeyPrefix + " " + apiKey; 69 | } else { 70 | value = apiKey; 71 | } 72 | if ("query".equals(location)) { 73 | queryParams.add(new Pair(paramName, value)); 74 | } else if ("header".equals(location)) { 75 | headerParams.put(paramName, value); 76 | } else if ("cookie".equals(location)) { 77 | cookieParams.put(paramName, value); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/auth/Authentication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client.auth; 15 | 16 | import org.openapitools.db_data.client.Pair; 17 | import org.openapitools.db_data.client.ApiException; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | public interface Authentication { 24 | /** 25 | * Apply authentication settings to header and query params. 26 | * 27 | * @param queryParams List of query parameters 28 | * @param headerParams Map of header parameters 29 | * @param cookieParams Map of cookie parameters 30 | * @param payload HTTP request body 31 | * @param method HTTP method 32 | * @param uri URI 33 | * @throws ApiException if failed to update the parameters 34 | */ 35 | void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/auth/HttpBasicAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client.auth; 15 | 16 | import org.openapitools.db_data.client.Pair; 17 | import org.openapitools.db_data.client.ApiException; 18 | 19 | import okhttp3.Credentials; 20 | 21 | import java.net.URI; 22 | import java.util.Map; 23 | import java.util.List; 24 | 25 | import java.io.UnsupportedEncodingException; 26 | 27 | public class HttpBasicAuth implements Authentication { 28 | private String username; 29 | private String password; 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) { 36 | this.username = username; 37 | } 38 | 39 | public String getPassword() { 40 | return password; 41 | } 42 | 43 | public void setPassword(String password) { 44 | this.password = password; 45 | } 46 | 47 | @Override 48 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 49 | String payload, String method, URI uri) throws ApiException { 50 | if (username == null && password == null) { 51 | return; 52 | } 53 | headerParams.put("Authorization", Credentials.basic( 54 | username == null ? "" : username, 55 | password == null ? "" : password)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/auth/HttpBearerAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client.auth; 15 | 16 | import org.openapitools.db_data.client.ApiException; 17 | import org.openapitools.db_data.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:22.496740Z[Etc/UTC]") 24 | public class HttpBearerAuth implements Authentication { 25 | private final String scheme; 26 | private String bearerToken; 27 | 28 | public HttpBearerAuth(String scheme) { 29 | this.scheme = scheme; 30 | } 31 | 32 | /** 33 | * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. 34 | * 35 | * @return The bearer token 36 | */ 37 | public String getBearerToken() { 38 | return bearerToken; 39 | } 40 | 41 | /** 42 | * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. 43 | * 44 | * @param bearerToken The bearer token to send in the Authorization header 45 | */ 46 | public void setBearerToken(String bearerToken) { 47 | this.bearerToken = bearerToken; 48 | } 49 | 50 | @Override 51 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 52 | String payload, String method, URI uri) throws ApiException { 53 | if (bearerToken == null) { 54 | return; 55 | } 56 | 57 | headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); 58 | } 59 | 60 | private static String upperCaseBearer(String scheme) { 61 | return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/db_data/client/model/ProtobufNullValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Data Plane API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.db_data.client.model; 15 | 16 | import java.util.Objects; 17 | import com.google.gson.annotations.SerializedName; 18 | 19 | import java.io.IOException; 20 | import com.google.gson.TypeAdapter; 21 | import com.google.gson.annotations.JsonAdapter; 22 | import com.google.gson.stream.JsonReader; 23 | import com.google.gson.stream.JsonWriter; 24 | 25 | /** 26 | * `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. 27 | */ 28 | @JsonAdapter(ProtobufNullValue.Adapter.class) 29 | public enum ProtobufNullValue { 30 | 31 | NULL_VALUE("NULL_VALUE"); 32 | 33 | private String value; 34 | 35 | ProtobufNullValue(String value) { 36 | this.value = value; 37 | } 38 | 39 | public String getValue() { 40 | return value; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return String.valueOf(value); 46 | } 47 | 48 | public static ProtobufNullValue fromValue(String value) { 49 | for (ProtobufNullValue b : ProtobufNullValue.values()) { 50 | if (b.value.equals(value)) { 51 | return b; 52 | } 53 | } 54 | throw new IllegalArgumentException("Unexpected value '" + value + "'"); 55 | } 56 | 57 | public static class Adapter extends TypeAdapter { 58 | @Override 59 | public void write(final JsonWriter jsonWriter, final ProtobufNullValue enumeration) throws IOException { 60 | jsonWriter.value(enumeration.getValue()); 61 | } 62 | 63 | @Override 64 | public ProtobufNullValue read(final JsonReader jsonReader) throws IOException { 65 | String value = jsonReader.nextString(); 66 | return ProtobufNullValue.fromValue(value); 67 | } 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ApiCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import java.io.IOException; 17 | 18 | import java.util.Map; 19 | import java.util.List; 20 | 21 | /** 22 | * Callback for asynchronous API call. 23 | * 24 | * @param The return type 25 | */ 26 | public interface ApiCallback { 27 | /** 28 | * This is called when the API call fails. 29 | * 30 | * @param e The exception causing the failure 31 | * @param statusCode Status code of the response if available, otherwise it would be 0 32 | * @param responseHeaders Headers of the response if available, otherwise it would be null 33 | */ 34 | void onFailure(ApiException e, int statusCode, Map> responseHeaders); 35 | 36 | /** 37 | * This is called when the API call succeeded. 38 | * 39 | * @param result The result deserialized from response 40 | * @param statusCode Status code of the response 41 | * @param responseHeaders Headers of the response 42 | */ 43 | void onSuccess(T result, int statusCode, Map> responseHeaders); 44 | 45 | /** 46 | * This is called when the API upload processing. 47 | * 48 | * @param bytesWritten bytes Written 49 | * @param contentLength content length of request body 50 | * @param done write end 51 | */ 52 | void onUploadProgress(long bytesWritten, long contentLength, boolean done); 53 | 54 | /** 55 | * This is called when the API download processing. 56 | * 57 | * @param bytesRead bytes Read 58 | * @param contentLength content length of the response 59 | * @param done Read end 60 | */ 61 | void onDownloadProgress(long bytesRead, long contentLength, boolean done); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | * API response returned by API call. 21 | */ 22 | public class ApiResponse { 23 | final private int statusCode; 24 | final private Map> headers; 25 | final private T data; 26 | 27 | /** 28 | *

Constructor for ApiResponse.

29 | * 30 | * @param statusCode The status code of HTTP response 31 | * @param headers The headers of HTTP response 32 | */ 33 | public ApiResponse(int statusCode, Map> headers) { 34 | this(statusCode, headers, null); 35 | } 36 | 37 | /** 38 | *

Constructor for ApiResponse.

39 | * 40 | * @param statusCode The status code of HTTP response 41 | * @param headers The headers of HTTP response 42 | * @param data The object deserialized from response bod 43 | */ 44 | public ApiResponse(int statusCode, Map> headers, T data) { 45 | this.statusCode = statusCode; 46 | this.headers = headers; 47 | this.data = data; 48 | } 49 | 50 | /** 51 | *

Get the status code.

52 | * 53 | * @return the status code 54 | */ 55 | public int getStatusCode() { 56 | return statusCode; 57 | } 58 | 59 | /** 60 | *

Get the headers.

61 | * 62 | * @return a {@link java.util.Map} of headers 63 | */ 64 | public Map> getHeaders() { 65 | return headers; 66 | } 67 | 68 | /** 69 | *

Get the data.

70 | * 71 | * @return the data 72 | */ 73 | public T getData() { 74 | return data; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:32.070880Z[Etc/UTC]") 17 | public class Configuration { 18 | public static final String VERSION = "2025-04"; 19 | 20 | private static ApiClient defaultApiClient = new ApiClient(); 21 | 22 | /** 23 | * Get the default API client, which would be used when creating API 24 | * instances without providing an API client. 25 | * 26 | * @return Default API client 27 | */ 28 | public static ApiClient getDefaultApiClient() { 29 | return defaultApiClient; 30 | } 31 | 32 | /** 33 | * Set the default API client, which would be used when creating API 34 | * instances without providing an API client. 35 | * 36 | * @param apiClient API client 37 | */ 38 | public static void setDefaultApiClient(ApiClient apiClient) { 39 | defaultApiClient = apiClient; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/GzipRequestInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import okhttp3.*; 17 | import okio.Buffer; 18 | import okio.BufferedSink; 19 | import okio.GzipSink; 20 | import okio.Okio; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Encodes request bodies using gzip. 26 | * 27 | * Taken from https://github.com/square/okhttp/issues/350 28 | */ 29 | class GzipRequestInterceptor implements Interceptor { 30 | @Override 31 | public Response intercept(Chain chain) throws IOException { 32 | Request originalRequest = chain.request(); 33 | if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { 34 | return chain.proceed(originalRequest); 35 | } 36 | 37 | Request compressedRequest = originalRequest.newBuilder() 38 | .header("Content-Encoding", "gzip") 39 | .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) 40 | .build(); 41 | return chain.proceed(compressedRequest); 42 | } 43 | 44 | private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { 45 | final Buffer buffer = new Buffer(); 46 | requestBody.writeTo(buffer); 47 | return new RequestBody() { 48 | @Override 49 | public MediaType contentType() { 50 | return requestBody.contentType(); 51 | } 52 | 53 | @Override 54 | public long contentLength() { 55 | return buffer.size(); 56 | } 57 | 58 | @Override 59 | public void writeTo(BufferedSink sink) throws IOException { 60 | sink.write(buffer.snapshot()); 61 | } 62 | }; 63 | } 64 | 65 | private RequestBody gzip(final RequestBody body) { 66 | return new RequestBody() { 67 | @Override 68 | public MediaType contentType() { 69 | return body.contentType(); 70 | } 71 | 72 | @Override 73 | public long contentLength() { 74 | return -1; // We don't know the compressed length in advance! 75 | } 76 | 77 | @Override 78 | public void writeTo(BufferedSink sink) throws IOException { 79 | BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); 80 | body.writeTo(gzipSink); 81 | gzipSink.close(); 82 | } 83 | }; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:32.070880Z[Etc/UTC]") 17 | public class Pair { 18 | private String name = ""; 19 | private String value = ""; 20 | 21 | public Pair (String name, String value) { 22 | setName(name); 23 | setValue(value); 24 | } 25 | 26 | private void setName(String name) { 27 | if (!isValidString(name)) { 28 | return; 29 | } 30 | 31 | this.name = name; 32 | } 33 | 34 | private void setValue(String value) { 35 | if (!isValidString(value)) { 36 | return; 37 | } 38 | 39 | this.value = value; 40 | } 41 | 42 | public String getName() { 43 | return this.name; 44 | } 45 | 46 | public String getValue() { 47 | return this.value; 48 | } 49 | 50 | private boolean isValidString(String arg) { 51 | if (arg == null) { 52 | return false; 53 | } 54 | 55 | return true; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ProgressRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.RequestBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSink; 23 | import okio.ForwardingSink; 24 | import okio.Okio; 25 | import okio.Sink; 26 | 27 | public class ProgressRequestBody extends RequestBody { 28 | 29 | private final RequestBody requestBody; 30 | 31 | private final ApiCallback callback; 32 | 33 | public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { 34 | this.requestBody = requestBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return requestBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() throws IOException { 45 | return requestBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public void writeTo(BufferedSink sink) throws IOException { 50 | BufferedSink bufferedSink = Okio.buffer(sink(sink)); 51 | requestBody.writeTo(bufferedSink); 52 | bufferedSink.flush(); 53 | } 54 | 55 | private Sink sink(Sink sink) { 56 | return new ForwardingSink(sink) { 57 | 58 | long bytesWritten = 0L; 59 | long contentLength = 0L; 60 | 61 | @Override 62 | public void write(Buffer source, long byteCount) throws IOException { 63 | super.write(source, byteCount); 64 | if (contentLength == 0) { 65 | contentLength = contentLength(); 66 | } 67 | 68 | bytesWritten += byteCount; 69 | callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); 70 | } 71 | }; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ProgressResponseBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import okhttp3.MediaType; 17 | import okhttp3.ResponseBody; 18 | 19 | import java.io.IOException; 20 | 21 | import okio.Buffer; 22 | import okio.BufferedSource; 23 | import okio.ForwardingSource; 24 | import okio.Okio; 25 | import okio.Source; 26 | 27 | public class ProgressResponseBody extends ResponseBody { 28 | 29 | private final ResponseBody responseBody; 30 | private final ApiCallback callback; 31 | private BufferedSource bufferedSource; 32 | 33 | public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { 34 | this.responseBody = responseBody; 35 | this.callback = callback; 36 | } 37 | 38 | @Override 39 | public MediaType contentType() { 40 | return responseBody.contentType(); 41 | } 42 | 43 | @Override 44 | public long contentLength() { 45 | return responseBody.contentLength(); 46 | } 47 | 48 | @Override 49 | public BufferedSource source() { 50 | if (bufferedSource == null) { 51 | bufferedSource = Okio.buffer(source(responseBody.source())); 52 | } 53 | return bufferedSource; 54 | } 55 | 56 | private Source source(Source source) { 57 | return new ForwardingSource(source) { 58 | long totalBytesRead = 0L; 59 | 60 | @Override 61 | public long read(Buffer sink, long byteCount) throws IOException { 62 | long bytesRead = super.read(sink, byteCount); 63 | // read() returns the number of bytes read, or -1 if this source is exhausted. 64 | totalBytesRead += bytesRead != -1 ? bytesRead : 0; 65 | callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); 66 | return bytesRead; 67 | } 68 | }; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ServerConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.inference.client; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Representing a Server configuration. 7 | */ 8 | public class ServerConfiguration { 9 | public String URL; 10 | public String description; 11 | public Map variables; 12 | 13 | /** 14 | * @param URL A URL to the target host. 15 | * @param description A description of the host designated by the URL. 16 | * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. 17 | */ 18 | public ServerConfiguration(String URL, String description, Map variables) { 19 | this.URL = URL; 20 | this.description = description; 21 | this.variables = variables; 22 | } 23 | 24 | /** 25 | * Format URL template using given variables. 26 | * 27 | * @param variables A map between a variable name and its value. 28 | * @return Formatted URL. 29 | */ 30 | public String URL(Map variables) { 31 | String url = this.URL; 32 | 33 | // go through variables and replace placeholders 34 | for (Map.Entry variable: this.variables.entrySet()) { 35 | String name = variable.getKey(); 36 | ServerVariable serverVariable = variable.getValue(); 37 | String value = serverVariable.defaultValue; 38 | 39 | if (variables != null && variables.containsKey(name)) { 40 | value = variables.get(name); 41 | if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { 42 | throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); 43 | } 44 | } 45 | url = url.replace("{" + name + "}", value); 46 | } 47 | return url; 48 | } 49 | 50 | /** 51 | * Format URL template using default server variables. 52 | * 53 | * @return Formatted URL. 54 | */ 55 | public String URL() { 56 | return URL(null); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/ServerVariable.java: -------------------------------------------------------------------------------- 1 | package org.openapitools.inference.client; 2 | 3 | import java.util.HashSet; 4 | 5 | /** 6 | * Representing a Server Variable for server URL template substitution. 7 | */ 8 | public class ServerVariable { 9 | public String description; 10 | public String defaultValue; 11 | public HashSet enumValues = null; 12 | 13 | /** 14 | * @param description A description for the server variable. 15 | * @param defaultValue The default value to use for substitution. 16 | * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. 17 | */ 18 | public ServerVariable(String description, String defaultValue, HashSet enumValues) { 19 | this.description = description; 20 | this.defaultValue = defaultValue; 21 | this.enumValues = enumValues; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/StringUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client; 15 | 16 | import java.util.Collection; 17 | import java.util.Iterator; 18 | 19 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:32.070880Z[Etc/UTC]") 20 | public class StringUtil { 21 | /** 22 | * Check if the given array contains the given value (with case-insensitive comparison). 23 | * 24 | * @param array The array 25 | * @param value The value to search 26 | * @return true if the array contains the value 27 | */ 28 | public static boolean containsIgnoreCase(String[] array, String value) { 29 | for (String str : array) { 30 | if (value == null && str == null) { 31 | return true; 32 | } 33 | if (value != null && value.equalsIgnoreCase(str)) { 34 | return true; 35 | } 36 | } 37 | return false; 38 | } 39 | 40 | /** 41 | * Join an array of strings with the given separator. 42 | *

43 | * Note: This might be replaced by utility method from commons-lang or guava someday 44 | * if one of those libraries is added as dependency. 45 | *

46 | * 47 | * @param array The array of strings 48 | * @param separator The separator 49 | * @return the resulting string 50 | */ 51 | public static String join(String[] array, String separator) { 52 | int len = array.length; 53 | if (len == 0) { 54 | return ""; 55 | } 56 | 57 | StringBuilder out = new StringBuilder(); 58 | out.append(array[0]); 59 | for (int i = 1; i < len; i++) { 60 | out.append(separator).append(array[i]); 61 | } 62 | return out.toString(); 63 | } 64 | 65 | /** 66 | * Join a list of strings with the given separator. 67 | * 68 | * @param list The list of strings 69 | * @param separator The separator 70 | * @return the resulting string 71 | */ 72 | public static String join(Collection list, String separator) { 73 | Iterator iterator = list.iterator(); 74 | StringBuilder out = new StringBuilder(); 75 | if (iterator.hasNext()) { 76 | out.append(iterator.next()); 77 | } 78 | while (iterator.hasNext()) { 79 | out.append(separator).append(iterator.next()); 80 | } 81 | return out.toString(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/auth/ApiKeyAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client.auth; 15 | 16 | import org.openapitools.inference.client.ApiException; 17 | import org.openapitools.inference.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:32.070880Z[Etc/UTC]") 24 | public class ApiKeyAuth implements Authentication { 25 | private final String location; 26 | private final String paramName; 27 | 28 | private String apiKey; 29 | private String apiKeyPrefix; 30 | 31 | public ApiKeyAuth(String location, String paramName) { 32 | this.location = location; 33 | this.paramName = paramName; 34 | } 35 | 36 | public String getLocation() { 37 | return location; 38 | } 39 | 40 | public String getParamName() { 41 | return paramName; 42 | } 43 | 44 | public String getApiKey() { 45 | return apiKey; 46 | } 47 | 48 | public void setApiKey(String apiKey) { 49 | this.apiKey = apiKey; 50 | } 51 | 52 | public String getApiKeyPrefix() { 53 | return apiKeyPrefix; 54 | } 55 | 56 | public void setApiKeyPrefix(String apiKeyPrefix) { 57 | this.apiKeyPrefix = apiKeyPrefix; 58 | } 59 | 60 | @Override 61 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 62 | String payload, String method, URI uri) throws ApiException { 63 | if (apiKey == null) { 64 | return; 65 | } 66 | String value; 67 | if (apiKeyPrefix != null) { 68 | value = apiKeyPrefix + " " + apiKey; 69 | } else { 70 | value = apiKey; 71 | } 72 | if ("query".equals(location)) { 73 | queryParams.add(new Pair(paramName, value)); 74 | } else if ("header".equals(location)) { 75 | headerParams.put(paramName, value); 76 | } else if ("cookie".equals(location)) { 77 | cookieParams.put(paramName, value); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/auth/Authentication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client.auth; 15 | 16 | import org.openapitools.inference.client.Pair; 17 | import org.openapitools.inference.client.ApiException; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | public interface Authentication { 24 | /** 25 | * Apply authentication settings to header and query params. 26 | * 27 | * @param queryParams List of query parameters 28 | * @param headerParams Map of header parameters 29 | * @param cookieParams Map of cookie parameters 30 | * @param payload HTTP request body 31 | * @param method HTTP method 32 | * @param uri URI 33 | * @throws ApiException if failed to update the parameters 34 | */ 35 | void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/auth/HttpBasicAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client.auth; 15 | 16 | import org.openapitools.inference.client.Pair; 17 | import org.openapitools.inference.client.ApiException; 18 | 19 | import okhttp3.Credentials; 20 | 21 | import java.net.URI; 22 | import java.util.Map; 23 | import java.util.List; 24 | 25 | import java.io.UnsupportedEncodingException; 26 | 27 | public class HttpBasicAuth implements Authentication { 28 | private String username; 29 | private String password; 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public void setUsername(String username) { 36 | this.username = username; 37 | } 38 | 39 | public String getPassword() { 40 | return password; 41 | } 42 | 43 | public void setPassword(String password) { 44 | this.password = password; 45 | } 46 | 47 | @Override 48 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 49 | String payload, String method, URI uri) throws ApiException { 50 | if (username == null && password == null) { 51 | return; 52 | } 53 | headerParams.put("Authorization", Credentials.basic( 54 | username == null ? "" : username, 55 | password == null ? "" : password)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/auth/HttpBearerAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client.auth; 15 | 16 | import org.openapitools.inference.client.ApiException; 17 | import org.openapitools.inference.client.Pair; 18 | 19 | import java.net.URI; 20 | import java.util.Map; 21 | import java.util.List; 22 | 23 | @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-05-22T16:07:32.070880Z[Etc/UTC]") 24 | public class HttpBearerAuth implements Authentication { 25 | private final String scheme; 26 | private String bearerToken; 27 | 28 | public HttpBearerAuth(String scheme) { 29 | this.scheme = scheme; 30 | } 31 | 32 | /** 33 | * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. 34 | * 35 | * @return The bearer token 36 | */ 37 | public String getBearerToken() { 38 | return bearerToken; 39 | } 40 | 41 | /** 42 | * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. 43 | * 44 | * @param bearerToken The bearer token to send in the Authorization header 45 | */ 46 | public void setBearerToken(String bearerToken) { 47 | this.bearerToken = bearerToken; 48 | } 49 | 50 | @Override 51 | public void applyToParams(List queryParams, Map headerParams, Map cookieParams, 52 | String payload, String method, URI uri) throws ApiException { 53 | if (bearerToken == null) { 54 | return; 55 | } 56 | 57 | headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); 58 | } 59 | 60 | private static String upperCaseBearer(String scheme) { 61 | return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/org/openapitools/inference/client/model/ModelInfoMetric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Pinecone Inference API 3 | * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. 4 | * 5 | * The version of the OpenAPI document: 2025-04 6 | * Contact: support@pinecone.io 7 | * 8 | * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). 9 | * https://openapi-generator.tech 10 | * Do not edit the class manually. 11 | */ 12 | 13 | 14 | package org.openapitools.inference.client.model; 15 | 16 | import java.util.Objects; 17 | import com.google.gson.annotations.SerializedName; 18 | 19 | import java.io.IOException; 20 | import com.google.gson.TypeAdapter; 21 | import com.google.gson.annotations.JsonAdapter; 22 | import com.google.gson.stream.JsonReader; 23 | import com.google.gson.stream.JsonWriter; 24 | 25 | /** 26 | * A distance metric that the embedding model supports for similarity searches. 27 | */ 28 | @JsonAdapter(ModelInfoMetric.Adapter.class) 29 | public enum ModelInfoMetric { 30 | 31 | COSINE("cosine"), 32 | 33 | EUCLIDEAN("euclidean"), 34 | 35 | DOTPRODUCT("dotproduct"); 36 | 37 | private String value; 38 | 39 | ModelInfoMetric(String value) { 40 | this.value = value; 41 | } 42 | 43 | public String getValue() { 44 | return value; 45 | } 46 | 47 | @Override 48 | public String toString() { 49 | return String.valueOf(value); 50 | } 51 | 52 | public static ModelInfoMetric fromValue(String value) { 53 | for (ModelInfoMetric b : ModelInfoMetric.values()) { 54 | if (b.value.equals(value)) { 55 | return b; 56 | } 57 | } 58 | throw new IllegalArgumentException("Unexpected value '" + value + "'"); 59 | } 60 | 61 | public static class Adapter extends TypeAdapter { 62 | @Override 63 | public void write(final JsonWriter jsonWriter, final ModelInfoMetric enumeration) throws IOException { 64 | jsonWriter.value(enumeration.getValue()); 65 | } 66 | 67 | @Override 68 | public ModelInfoMetric read(final JsonReader jsonReader) throws IOException { 69 | String value = jsonReader.nextString(); 70 | return ModelInfoMetric.fromValue(value); 71 | } 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pinecone-io/pinecone-java-client/36fa67b11a8deb8334b2edd97f060f85dee69d96/src/main/resources/META-INF/NOTICE.txt -------------------------------------------------------------------------------- /src/test/java/io/pinecone/GenerateMetadata.java: -------------------------------------------------------------------------------- 1 | package io.pinecone; 2 | 3 | import com.google.protobuf.Struct; 4 | import com.google.protobuf.Value; 5 | 6 | import java.util.ArrayList; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | 10 | public class GenerateMetadata { 11 | 12 | public static final String[] metadataFields = new String[]{"genre", "year"}; 13 | 14 | public static HashMap> createAndGetMetadataMap() { 15 | HashMap> metadataMap; 16 | metadataMap = new HashMap<>(); 17 | List metadataValues1 = new ArrayList<>(); 18 | metadataValues1.add("drama"); 19 | metadataValues1.add("thriller"); 20 | metadataValues1.add("fiction"); 21 | metadataMap.put(metadataFields[0], metadataValues1); 22 | List metadataValues2 = new ArrayList<>(); 23 | metadataValues2.add("2019"); 24 | metadataValues2.add("2020"); 25 | metadataValues2.add("2021"); 26 | metadataMap.put(metadataFields[1], metadataValues2); 27 | 28 | return metadataMap; 29 | } 30 | 31 | public static Struct generateMetadataStruct(int metadataField0, int metadataField1) { 32 | HashMap> metadataMap = createAndGetMetadataMap(); 33 | int metadataSize = metadataMap.get(metadataFields[0]).size(); 34 | return Struct.newBuilder() 35 | .putFields(metadataFields[0], 36 | Value.newBuilder().setStringValue(metadataMap.get(metadataFields[0]).get(metadataField0 % metadataSize)).build()) 37 | .putFields(metadataFields[1], 38 | Value.newBuilder().setStringValue(metadataMap.get(metadataFields[1]).get(metadataField1 % metadataSize)).build()) 39 | .build(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/java/io/pinecone/PineconeConfigTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone; 2 | 3 | import io.pinecone.configs.PineconeConfig; 4 | import io.pinecone.exceptions.PineconeConfigurationException; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static io.pinecone.commons.Constants.pineconeClientVersion; 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | 10 | public class PineconeConfigTest { 11 | 12 | @Test 13 | public void testValidateWithNullApiKey() { 14 | try { 15 | new PineconeConfig(null); 16 | } catch (PineconeConfigurationException expected) { 17 | assertEquals(expected.getLocalizedMessage(), "The API key is required and must not be empty or null"); 18 | } 19 | } 20 | @Test 21 | public void testValidateWithEmptyApiKey() { 22 | try { 23 | new PineconeConfig(""); 24 | } catch (PineconeConfigurationException expected) { 25 | assertEquals(expected.getLocalizedMessage(), "The API key is required and must not be empty or null"); 26 | } 27 | } 28 | 29 | @Test 30 | public void testGetUserAgent() { 31 | PineconeConfig config = new PineconeConfig("testApiKey"); 32 | assertEquals(config.getUserAgent(), "lang=java; pineconeClientVersion=" + pineconeClientVersion); 33 | } 34 | 35 | @Test 36 | public void testGetUserAgentWithSourceTag() { 37 | PineconeConfig config = new PineconeConfig("testApiKey"); 38 | config.setSourceTag("testSourceTag"); 39 | assertEquals(config.getUserAgent(), "lang=java; pineconeClientVersion=" + pineconeClientVersion + "; source_tag=testsourcetag"); 40 | } 41 | 42 | @Test 43 | public void testSourceTagIsNormalized() { 44 | PineconeConfig config = new PineconeConfig("testApiKey"); 45 | config.setSourceTag("test source tag !! @@ ## :"); 46 | assertEquals(config.getSourceTag(), "test_source_tag_:"); 47 | 48 | config.setSourceTag("TEST SOURCE : Tag ----"); 49 | assertEquals(config.getSourceTag(), "test_source_:_tag"); 50 | 51 | config.setSourceTag("TEST SOURCE TAG 2.4.5"); 52 | assertEquals(config.getSourceTag(), "test_source_tag_245"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/java/io/pinecone/PineconeConnectionTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone; 2 | 3 | import io.pinecone.configs.PineconeConnection; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | public class PineconeConnectionTest { 9 | 10 | @Test 11 | void testGetEndpointWithConnectionUrlWithHttps() { 12 | String hostWithHttps = "https://steps-784-123-eqasas0aaaa1213aasasc-1223-f1eea9.svc.production.pinecone.io"; 13 | String endpoint = PineconeConnection.formatEndpoint(hostWithHttps); 14 | 15 | assertEquals("steps-784-123-eqasas0aaaa1213aasasc-1223-f1eea9.svc.production.pinecone.io", endpoint); 16 | } 17 | 18 | @Test 19 | void testGetEndpointWithConnectionUrlWithHttp() { 20 | String hostWithHttp = "http://steps-784-123-eqasas0aaaa1213aasasc-1223-f1eea9.svc.production.pinecone.io"; 21 | String endpoint = PineconeConnection.formatEndpoint(hostWithHttp); 22 | 23 | assertEquals("steps-784-123-eqasas0aaaa1213aasasc-1223-f1eea9.svc.production.pinecone.io", endpoint); 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/java/io/pinecone/SparseIndicesConverterTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone; 2 | 3 | import io.pinecone.exceptions.PineconeValidationException; 4 | import org.junit.jupiter.api.Test; 5 | import java.util.Arrays; 6 | import java.util.List; 7 | 8 | import static io.pinecone.utils.SparseIndicesConverter.*; 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | public class SparseIndicesConverterTest { 12 | 13 | @Test 14 | public void testUnsigned32IntToSigned32IntConversionWithinRange() { 15 | List unsignedValues = Arrays.asList(0L, 100L, 200L, 300L, 2147483647L); // int32 => [0, 2147483647] 16 | Iterable signedValues = convertUnsigned32IntToSigned32Int(unsignedValues); 17 | Integer[] expected = {0, 100, 200, 300, 2147483647}; 18 | int index = 0; 19 | for (Integer value : signedValues) { 20 | assertEquals(expected[index++], value); 21 | } 22 | } 23 | 24 | @Test 25 | public void testUnsigned32IntToSigned32IntConversionOutOfUnsigned32IntRange() { 26 | List unsignedValues = Arrays.asList(-1L, 4294967296L); // -1 and 4294967296 are out of unsigned 32-bit range 27 | assertThrows(PineconeValidationException.class, () -> convertUnsigned32IntToSigned32Int(unsignedValues)); 28 | } 29 | 30 | @Test 31 | public void testUnsigned32IntToSigned32IntConversionOutOfSigned32IntRange() { 32 | List unsignedValues = Arrays.asList(2147483649L, 4294967295L); // Unsigned 32 bit integer range: [0, 4294967295] 33 | Iterable signedValues = convertUnsigned32IntToSigned32Int(unsignedValues); 34 | Integer[] expected = {-2147483647, -1}; 35 | int index = 0; 36 | for(int value : signedValues) { 37 | assertEquals(expected[index++], value); 38 | } 39 | } 40 | 41 | @Test 42 | public void testUnsigned32IntToSigned32IntEmptyList() { 43 | List unsignedValues = Arrays.asList(); 44 | Iterable signedValues = convertUnsigned32IntToSigned32Int(unsignedValues); 45 | assertFalse(signedValues.iterator().hasNext(), "Empty list should result in empty result"); 46 | } 47 | 48 | @Test 49 | public void testSigned32IntToUnsigned32IntConversionWithinRange() { 50 | List signedValues = Arrays.asList(0, 100, 200, 300, 2147483647); // int32 => [0, 2147483647] 51 | Iterable unsignedValues = convertSigned32IntToUnsigned32Int(signedValues); 52 | Long[] expected = {0L, 100L, 200L, 300L, 2147483647L}; 53 | int index = 0; 54 | for (Long value : unsignedValues) { 55 | assertEquals(expected[index++], value); 56 | } 57 | } 58 | 59 | @Test 60 | public void testSigned32IntToUnsigned32IntConversionOutOfSigned32IntRange() { 61 | List signedValues = Arrays.asList(-2147483647, -1); // Signed 32 bit integer range: [-2147483648, 2147483647] 62 | Iterable unsignedValues = convertSigned32IntToUnsigned32Int(signedValues); 63 | Long[] expected = {2147483649L, 4294967295L}; 64 | int index = 0; 65 | for (Long value : unsignedValues) { 66 | assertEquals(expected[index++], value); 67 | } 68 | } 69 | 70 | @Test 71 | public void testSigned32IntToUnsigned32IntEmptyLis1() { 72 | List signedValues = Arrays.asList(); 73 | Iterable unsignedValues = convertSigned32IntToUnsigned32Int(signedValues); 74 | assertFalse(unsignedValues.iterator().hasNext(), "Empty list should result in empty result"); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/io/pinecone/clients/PineconeProxyTest.java: -------------------------------------------------------------------------------- 1 | package io.pinecone.clients; 2 | 3 | import io.pinecone.configs.PineconeConfig; 4 | import io.pinecone.configs.ProxyConfig; 5 | import io.pinecone.exceptions.PineconeConfigurationException; 6 | import okhttp3.OkHttpClient; 7 | import org.junit.jupiter.api.Test; 8 | 9 | import static org.junit.jupiter.api.Assertions.*; 10 | 11 | public class PineconeProxyTest { 12 | 13 | @Test 14 | void testConstructorAndGetters() { 15 | ProxyConfig proxyConfig = new ProxyConfig("localhost", 8080); 16 | assertEquals("localhost", proxyConfig.getHost()); 17 | assertEquals(8080, proxyConfig.getPort()); 18 | } 19 | 20 | @Test 21 | void testSetters() { 22 | ProxyConfig proxyConfig = new ProxyConfig("localhost", 8080); 23 | proxyConfig.setHost("127.0.0.1"); 24 | proxyConfig.setPort(9090); 25 | 26 | assertEquals("127.0.0.1", proxyConfig.getHost()); 27 | assertEquals(9090, proxyConfig.getPort()); 28 | } 29 | 30 | @Test 31 | void testValidateInvalidHost() { 32 | ProxyConfig proxyConfig = new ProxyConfig(null, 8080); 33 | Exception exception = assertThrows(PineconeConfigurationException.class, proxyConfig::validate); 34 | assertEquals("Proxy host cannot be null or empty.", exception.getMessage()); 35 | } 36 | 37 | @Test 38 | void testValidateEmptyHost() { 39 | ProxyConfig proxyConfig = new ProxyConfig("", 8080); 40 | Exception exception = assertThrows(PineconeConfigurationException.class, proxyConfig::validate); 41 | assertEquals("Proxy host cannot be null or empty.", exception.getMessage()); 42 | } 43 | 44 | @Test 45 | void testValidateInvalidPort() { 46 | ProxyConfig proxyConfig = new ProxyConfig("localhost", 0); 47 | Exception exception = assertThrows(PineconeConfigurationException.class, proxyConfig::validate); 48 | assertEquals("Proxy port must be greater than 0.", exception.getMessage()); 49 | } 50 | 51 | @Test 52 | void testValidateNegativePort() { 53 | ProxyConfig proxyConfig = new ProxyConfig("localhost", -1); 54 | Exception exception = assertThrows(PineconeConfigurationException.class, proxyConfig::validate); 55 | assertEquals("Proxy port must be greater than 0.", exception.getMessage()); 56 | } 57 | 58 | @Test 59 | public void testBuildWithProxy() { 60 | String apiKey = "test-api-key"; 61 | String proxyHost = "proxy.example.com"; 62 | int proxyPort = 8080; 63 | 64 | Pinecone pinecone = new Pinecone.Builder(apiKey) 65 | .withProxy(proxyHost, proxyPort) 66 | .build(); 67 | 68 | PineconeConfig config = pinecone.getConfig(); 69 | assertEquals(proxyHost, config.getProxyConfig().getHost()); 70 | assertEquals(proxyPort, config.getProxyConfig().getPort()); 71 | } 72 | 73 | @Test 74 | public void testBothCustomOkHttpClientAndProxySet() { 75 | String apiKey = "test-api-key"; 76 | OkHttpClient customOkHttpClient = new OkHttpClient(); 77 | String proxyHost = "proxy.example.com"; 78 | int proxyPort = 8080; 79 | 80 | Pinecone.Builder builder = new Pinecone.Builder(apiKey) 81 | .withOkHttpClient(customOkHttpClient) 82 | .withProxy(proxyHost, proxyPort); 83 | 84 | Exception exception = assertThrows(PineconeConfigurationException.class, builder::build); 85 | assertEquals("Invalid configuration: Both Custom OkHttpClient and Proxy are set. Please configure only one of these options.", exception.getMessage()); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/test/resources/collectionCreation.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"testCollection", 3 | "environment":"someEnvironment", 4 | "status": "Ready" 5 | } -------------------------------------------------------------------------------- /src/test/resources/createIndexResponse.valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "serverless-index", 3 | "metric": "cosine", 4 | "dimension": 1536, 5 | "status": { 6 | "ready": true, 7 | "state": "Ready" 8 | }, 9 | "host": "serverless-index-4zo0ijk.svc.dev-us-west2-aws.pinecone.io", 10 | "spec": { 11 | "serverless": { 12 | "region": "us-west-2", 13 | "cloud": "aws" 14 | } 15 | }, 16 | "vector_type": "dense" 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/createIndexResponse.withUnknownProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "serverless-index", 3 | "metric": "cosine", 4 | "dimension": 1536, 5 | "ux_feedback": "much wow", 6 | "status": { 7 | "ready": true, 8 | "state": "Ready", 9 | "reticulating_splines": true 10 | }, 11 | "host": "serverless-index-4zo0ijk.svc.dev-us-west2-aws.pinecone.io", 12 | "spec": { 13 | "serverless": { 14 | "region": "us-west-2", 15 | "cloud": "aws", 16 | "weather_forecast": "partly sunny" 17 | } 18 | }, 19 | "vector_type": "dense" 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/describeCollection.valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "dimension": 3, 3 | "environment": "us-east1-gcp", 4 | "name": "tiny-collection", 5 | "size": 3126700, 6 | "status": "Ready", 7 | "vector_count": 99 8 | } -------------------------------------------------------------------------------- /src/test/resources/describeCollection.witihUnknownProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "dimension": 3, 3 | "environment": "us-east1-gcp", 4 | "name": "tiny-collection", 5 | "size": 3126700, 6 | "status": "Ready", 7 | "vector_count": 99, 8 | "extra": true, 9 | "even_more": null, 10 | "vector_type": "dense" 11 | } -------------------------------------------------------------------------------- /src/test/resources/describeIndexResponse.valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-index", 3 | "dimension": 1536, 4 | "metric": "cosine", 5 | "status": { 6 | "ready": true, 7 | "state": "Ready" 8 | }, 9 | "host": "https://index-host.com", 10 | "spec": { 11 | "serverless": { 12 | "cloud": "aws", 13 | "region": "us-east2-gcp" 14 | } 15 | }, 16 | "vector_type": "dense" 17 | } -------------------------------------------------------------------------------- /src/test/resources/describeIndexResponse.withUnknownProperties.json: -------------------------------------------------------------------------------- 1 | { 2 | "catchphrase": "just do it", 3 | "name": "test-index", 4 | "dimension": 1536, 5 | "metric": "cosine", 6 | "status": { 7 | "ready": true, 8 | "state": "Ready", 9 | "bottlesOfBeerOnTheWall": 99 10 | }, 11 | "host": "https://index-host.com", 12 | "spec": { 13 | "future_pod_type": { 14 | "who_knows": true, 15 | "what_props": false, 16 | "may": "exist" 17 | }, 18 | "serverless": { 19 | "cloud": "aws", 20 | "region": "us-east2-gcp", 21 | "hotness": "extra-spicy" 22 | } 23 | }, 24 | "vector_type": "dense" 25 | } -------------------------------------------------------------------------------- /src/test/resources/indexListJsonString.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [{ 3 | "name":"testServerlessIndex", 4 | "metric":"cosine", 5 | "dimension":3, 6 | "host":"test-serverless-host.io", 7 | "spec": { 8 | "serverless": { 9 | "cloud": "aws", 10 | "region": "us-west-2" 11 | } 12 | }, 13 | "status": { 14 | "state":"Ready", 15 | "ready":true 16 | }, 17 | "vector_type": "dense" 18 | },{ 19 | "name":"testPodIndex", 20 | "metric":"cosine", 21 | "dimension":3, 22 | "host":"test-pod-host.io", 23 | "spec": { 24 | "pod": { 25 | "environment": "us-west1-aws", 26 | "replicas": 1, 27 | "shards": 1, 28 | "pods": 1, 29 | "pod_type": "p1.x1" 30 | } 31 | }, 32 | "status": { 33 | "state":"Ready", 34 | "ready":true 35 | }, 36 | "vector_type": "dense" 37 | }] 38 | } -------------------------------------------------------------------------------- /src/test/resources/podIndexJsonString.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"testPodIndex", 3 | "metric":"cosine", 4 | "dimension":3, 5 | "host":"test-pod-host.io", 6 | "spec": { 7 | "pod": { 8 | "environment": "us-west1-aws", 9 | "replicas": 1, 10 | "shards": 1, 11 | "pods": 1, 12 | "pod_type": "p1.x1" 13 | } 14 | }, 15 | "status": { 16 | "state":"Ready", 17 | "ready":true 18 | }, 19 | "vector_type": "dense" 20 | } -------------------------------------------------------------------------------- /src/test/resources/serverlessIndexJsonString.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"testServerlessIndex", 3 | "metric":"cosine", 4 | "dimension":3, 5 | "host":"test-serverless-host.io", 6 | "spec": { 7 | "serverless": { 8 | "cloud": "aws", 9 | "region": "us-west-2" 10 | } 11 | }, 12 | "status": { 13 | "state":"Ready", 14 | "ready":true 15 | }, 16 | "vector_type": "dense" 17 | } -------------------------------------------------------------------------------- /src/test/resources/simplelogger.properties: -------------------------------------------------------------------------------- 1 | org.slf4j.simpleLogger.defaultLogLevel=trace -------------------------------------------------------------------------------- /v2-migration.md: -------------------------------------------------------------------------------- 1 | # Java SDK v2.0.0 Migration Guide 2 | 3 | This migration guide is specific to migrating from versions "**v1.0.x**" and below to "**v2.0.x**". 4 | 5 | ## Changes overview 6 | 7 | - Added deletion protection feature which will impact the following existing methods: 8 | - `createServerlessIndex()` is now accepted a new argument: Enum `DeletionProtection` 9 | - Renamed `configureIndex()` to `configurePodsIndex()` 10 | 11 | ## Indexes 12 | 13 | ### Creating a serverless index 14 | Added enum `DeletionProtection` as an argument 15 | 16 | **Before: ≤ 1.2.2** 17 | 18 | ```java 19 | import io.pinecone.clients.Pinecone; 20 | import org.openapitools.client.model.IndexModel; 21 | ... 22 | 23 | Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); 24 | 25 | String indexName = "example-index"; 26 | String similarityMetric = "cosine"; 27 | int dimension = 1538; 28 | String cloud = "aws"; 29 | String region = "us-west-2"; 30 | 31 | IndexModel indexModel = pinecone.createServerlessIndex(indexName, 32 | similarityMetric, 33 | dimension, 34 | cloud, 35 | region); 36 | ``` 37 | 38 | **After: ≥ 2.0.0** 39 | 40 | ```java 41 | import io.pinecone.clients.Pinecone; 42 | import org.openapitools.client.model.IndexModel; 43 | ... 44 | 45 | Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); 46 | 47 | String indexName = "example-index"; 48 | String similarityMetric = "cosine"; 49 | int dimension = 1538; 50 | String cloud = "aws"; 51 | String region = "us-west-2"; 52 | 53 | IndexModel indexModel = pinecone.createServerlessIndex(indexName, 54 | similarityMetric, 55 | dimension, 56 | cloud, 57 | region, 58 | DeletionProtection.ENABLED); 59 | ``` 60 | 61 | ## Configuring indexes 62 | Renamed `configureIndex()` to `configurePodsIndex()` 63 | 64 | **Before: ≤ 1.2.2** 65 | 66 | ```java 67 | import io.pinecone.clients.Pinecone; 68 | ... 69 | 70 | Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); 71 | 72 | String indexName = "my-index"; 73 | String podType = "p1.x1"; 74 | int newNumberOfReplicas = 7; 75 | 76 | pinecone.configureIndex(indexName, podType, newNumberOfReplicas); 77 | ``` 78 | 79 | **After: ≥ 2.0.0** 80 | 81 | ```java 82 | import io.pinecone.clients.Pinecone; 83 | ... 84 | 85 | Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build(); 86 | 87 | String indexName = "my-index"; 88 | String podType = "p1.x1"; 89 | int newNumberOfReplicas = 7; 90 | 91 | pinecone.configurePodsIndex(indexName, podType, newNumberOfReplicas); 92 | ``` --------------------------------------------------------------------------------