diff --git a/.github/workflows/alpha-release.yaml b/.github/workflows/alpha-release.yaml index 8ed480628..9c0c458c6 100644 --- a/.github/workflows/alpha-release.yaml +++ b/.github/workflows/alpha-release.yaml @@ -26,6 +26,7 @@ on: jobs: testing: uses: './.github/workflows/testing.yaml' + secrets: inherit pypi: uses: './.github/workflows/publish-to-pypi.yaml' diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 25bf073af..1a18dbd78 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -8,6 +8,7 @@ on: jobs: run-tests: uses: './.github/workflows/testing.yaml' + secrets: inherit pypi-nightly: needs: run-tests diff --git a/.github/workflows/nightly-spruce-dev-release.yaml b/.github/workflows/nightly-spruce-dev-release.yaml index 2c494ca9b..be49ecf8d 100644 --- a/.github/workflows/nightly-spruce-dev-release.yaml +++ b/.github/workflows/nightly-spruce-dev-release.yaml @@ -8,6 +8,7 @@ on: jobs: run-tests: uses: './.github/workflows/testing.yaml' + secrets: inherit pypi-spruce-nightly: needs: run-tests diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index d61f74946..936952fdf 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -10,6 +10,7 @@ on: jobs: run-tests: uses: './.github/workflows/testing.yaml' + secrets: inherit build-docs: name: Build docs with pdoc diff --git a/.github/workflows/release-spruce.yaml b/.github/workflows/release-spruce.yaml index ca78a841f..178299ac1 100644 --- a/.github/workflows/release-spruce.yaml +++ b/.github/workflows/release-spruce.yaml @@ -6,6 +6,7 @@ on: jobs: testing: uses: './.github/workflows/testing.yaml' + secrets: inherit version-and-release-spruce: timeout-minutes: 30 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e7a12752c..be68a71ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,6 +25,7 @@ env: jobs: testing: uses: './.github/workflows/testing.yaml' + secrets: inherit pypi: uses: './.github/workflows/publish-to-pypi.yaml' diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 678ad8760..9279cacb1 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -5,14 +5,14 @@ on: jobs: units-no-grpc: - name: Run tests (REST) + name: Unit tests (REST) runs-on: ubuntu-latest strategy: matrix: python-version: [3.8, 3.9, '3.10', 3.11] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -32,15 +32,55 @@ jobs: # so we don't add new regressions. poetry run mypy pinecone --exclude pinecone/core --exclude pinecone/grpc + integration-rest: + name: Integration tests (REST) + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.11] + pineconeEnv: ['prod', 'staging'] + max-parallel: 1 + fail-fast: false + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Setup Poetry + uses: ./.github/actions/setup-poetry + + - name: Run integration tests (REST, prod) + if: matrix.pineconeEnv == 'prod' + run: poetry run pytest tests/integration -s -v + env: + PINECONE_CONTROLLER_HOST: 'https://api.pinecone.io' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} + TEST_CAPACITY_MODE_1: ${{ secrets.TEST_CAPACITY_MODE_1 }} + TEST_CAPACITY_MODE_2: ${{ secrets.TEST_CAPACITY_MODE_2 }} + GITHUB_BUILD_NUMBER: "${{ github.run_number }}-p-${{ matrix.python-version}}" + + - name: Run integration tests (REST, staging) + if: matrix.pineconeEnv == 'staging' + run: poetry run pytest tests/integration -s -v + env: + PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io' + PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY_STAGING }} + TEST_CAPACITY_MODE_1: ${{ secrets.TEST_CAPACITY_MODE_1 }} + TEST_CAPACITY_MODE_2: ${{ secrets.TEST_CAPACITY_MODE_2 }} + GITHUB_BUILD_NUMBER: "${{ github.run_number }}-s-${{ matrix.python-version}}" + units-grpc: - name: Run tests (GRPC) + name: Unit tests (GRPC) runs-on: ubuntu-latest strategy: matrix: python-version: [3.8, 3.9, '3.10', 3.11] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -71,7 +111,7 @@ jobs: python-version: [3.8, 3.9, '3.10', 3.11] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/pinecone/__init__.py b/pinecone/__init__.py index fbacdaddd..fe52da72b 100644 --- a/pinecone/__init__.py +++ b/pinecone/__init__.py @@ -4,4 +4,6 @@ from .config import * from .exceptions import * from .control.pinecone import Pinecone -from .data.index import * \ No newline at end of file +from .data.index import * +from .models import * +from .core.client.models import * \ No newline at end of file diff --git a/pinecone/config/__init__.py b/pinecone/config/__init__.py index f6b039009..81d51fa02 100644 --- a/pinecone/config/__init__.py +++ b/pinecone/config/__init__.py @@ -1,2 +1,8 @@ +import logging +import os + from .config import ConfigBuilder, Config from .pinecone_config import PineconeConfig + +if (os.getenv('PINECONE_DEBUG') != None): + logging.basicConfig(level=logging.DEBUG) \ No newline at end of file diff --git a/pinecone/config/logging.py b/pinecone/config/logging.py deleted file mode 100644 index 51c788553..000000000 --- a/pinecone/config/logging.py +++ /dev/null @@ -1,8 +0,0 @@ -import logging - -PARENT_LOGGER_NAME = "pinecone" -DEFAULT_PARENT_LOGGER_LEVEL = "ERROR" - -_logger = logging.getLogger(__name__) -_parent_logger = logging.getLogger(PARENT_LOGGER_NAME) -_parent_logger.setLevel(DEFAULT_PARENT_LOGGER_LEVEL) diff --git a/pinecone/control/index_host_store.py b/pinecone/control/index_host_store.py index dc15a0a92..38354ee18 100644 --- a/pinecone/control/index_host_store.py +++ b/pinecone/control/index_host_store.py @@ -1,7 +1,6 @@ from typing import Dict from pinecone.config import Config -from pinecone.core.client.api.index_operations_api import IndexOperationsApi - +from pinecone.core.client.api.manage_pod_indexes_api import ManagePodIndexesApi as IndexOperationsApi class SingletonMeta(type): _instances: Dict[str, str] = {} diff --git a/pinecone/control/models/collection_description.py b/pinecone/control/models/collection_description.py deleted file mode 100644 index ff3f4b41a..000000000 --- a/pinecone/control/models/collection_description.py +++ /dev/null @@ -1,7 +0,0 @@ -class CollectionDescription(object): - def __init__(self, keys, values): - for k, v in zip(keys, values): - self.__dict__[k] = v - - def __str__(self): - return str(self.__dict__) diff --git a/pinecone/control/models/index_description.py b/pinecone/control/models/index_description.py deleted file mode 100644 index e86ffbd59..000000000 --- a/pinecone/control/models/index_description.py +++ /dev/null @@ -1,13 +0,0 @@ -from typing import NamedTuple - - -class IndexDescription(NamedTuple): - name: str - metric: str - replicas: int - dimension: int - shards: int - pods: int - pod_type: str - status: None - metadata_config: None diff --git a/pinecone/control/pinecone.py b/pinecone/control/pinecone.py index 7155b08d4..c2d83489f 100644 --- a/pinecone/control/pinecone.py +++ b/pinecone/control/pinecone.py @@ -1,20 +1,24 @@ import time -from typing import Optional, Dict, Any, cast +from typing import Optional, Dict, Any, Union, List, cast, NamedTuple from .index_host_store import IndexHostStore from pinecone.config import PineconeConfig, Config -from pinecone.control.models.index_description import IndexDescription -from pinecone.control.models.collection_description import CollectionDescription - -from pinecone.core.client.api.index_operations_api import IndexOperationsApi +from pinecone.core.client.api.manage_pod_indexes_api import ManagePodIndexesApi as IndexOperationsApi from pinecone.core.client.api_client import ApiClient -from pinecone.core.client.models import CreateCollectionRequest, CreateRequest, PatchRequest from pinecone.utils import get_user_agent +from pinecone.core.client.models import ( + CreateCollectionRequest, + CreateIndexRequest, + ConfigureIndexRequest, + IndexMetric, + IndexDimension +) from pinecone.data import Index + class Pinecone: def __init__( self, @@ -32,7 +36,7 @@ def __init__( self.config = configKwarg else: self.config = PineconeConfig.build(api_key=api_key, host=host, **kwargs) - + if index_api: self.index_api = index_api else: @@ -42,24 +46,52 @@ def __init__( self.index_host_store = IndexHostStore() - def create_index( + def create_serverless_index( self, name: str, dimension: int, - cloud: str, region: str, - capacity_mode: str, - environment: Optional[str] = None, + cloud: str, + metric: Optional[str] = "cosine", + timeout: Optional[int] = None, + ): + spec = {'serverless': dict(region=region, cloud=cloud)} + self.create_index(name=name, dimension=dimension, metric=metric, spec=spec, timeout=timeout) + + def create_pod_index( + self, + name: str, + dimension: int, + environment: str, + metric: Optional[str] = "cosine", + replicas: Optional[int] = None, + shards: Optional[int] = None, + pods: Optional[int] = None, + pod_type: Optional[str] = "p1.x1", + metadata_config: Optional[Dict] = None, + source_collection: Optional[str] = None, + timeout: Optional[int] = None, + ): + spec_inner = dict( + environment=environment, + replicas=replicas, + shards=shards, + pods=pods, + pod_type=pod_type, + metadata_config=metadata_config, + source_collection=source_collection, + ) + filtered_spec_inner = {k: v for k, v in spec_inner.items() if v is not None} + spec = {'pod': filtered_spec_inner} + self.create_index(name=name, dimension=dimension, metric=metric, spec=spec, timeout=timeout) + + def create_index( + self, + name: str, + dimension: int, + spec: Dict, + metric: Optional[str] = "cosine", timeout: Optional[int] = None, - index_type: str = "approximated", - metric: str = "cosine", - replicas: int = 1, - shards: int = 1, - pods: int = 1, - pod_type: str = "p1", - index_config: Optional[dict] = {}, - metadata_config: Optional[dict] = None, - source_collection: str = "", ): """Creates a Pinecone index. @@ -67,51 +99,22 @@ def create_index( :type name: str :param dimension: the dimension of vectors that would be inserted in the index :type dimension: int - :param cloud: The cloud where you would like your index hosted. One of `{"aws", "gcp"}`. - :type cloud: str - :param region: The region where you would like your index hosted. - :type region: str - :param capacity_mode: The capacity mode for the index. One of `{"pod"}`. - :type capacity_mode: str - :param environment: The environment where you would like your index hosted, e.g. 'us-east1-gcp'. Find this value in the Pinecone web console along with your API keys. - :type environment: str, optional - :param index_type: type of index, one of `{"approximated", "exact"}`, defaults to "approximated". - The "approximated" index uses fast approximate search algorithms developed by Pinecone. - The "exact" index uses accurate exact search algorithms. - It performs exhaustive searches and thus it is usually slower than the "approximated" index. - :type index_type: str, optional :param metric: type of metric used in the vector index, one of `{"cosine", "dotproduct", "euclidean"}`, defaults to "cosine". Use "cosine" for cosine similarity, "dotproduct" for dot-product, and "euclidean" for euclidean distance. :type metric: str, optional - :param replicas: the number of replicas, defaults to 1. - Use at least 2 replicas if you need high availability (99.99% uptime) for querying. - For additional throughput (QPS) your index needs to support, provision additional replicas. - :type replicas: int, optional - :param shards: the number of shards per index, defaults to 1. - Use 1 shard per 1GB of vectors - :type shards: int,optional - :param pods: Total number of pods to be used by the index. pods = shard*replicas - :type pods: int,optional - :param pod_type: the pod type to be used for the index. can be one of p1 or s1. - :type pod_type: str,optional - :param index_config: Advanced configuration options for the index - :param metadata_config: Configuration related to the metadata index - :type metadata_config: dict, optional - :param source_collection: Collection name to create the index from - :type metadata_config: str, optional + :param spec: A dictionary containing configurations describing how the index should be deployed. For serverless indexes, + specify region and cloud. For pod indexes, specify replicas, shards, pods, pod_type, metadata_config, and source_collection. + :type spec: Dict :type timeout: int, optional :param timeout: Timeout for wait until index gets ready. If None, wait indefinitely; if >=0, time out after this many seconds; if -1, return immediately and do not wait. Default: None """ - create_args = locals() - del create_args["self"] - if environment is None: - del create_args["environment"] api_instance = self.index_api - api_instance.create_index(create_request=CreateRequest(**create_args)) + + api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=IndexDimension(dimension), metric=IndexMetric(metric), spec=spec)) def is_ready(): status = self._get_status(name) @@ -173,8 +176,7 @@ def get_remaining(): def list_indexes(self): """Lists all indexes.""" - response = self.index_api.list_indexes() - return response + return self.index_api.list_indexes() def describe_index(self, name: str): """Describes a Pinecone index. @@ -183,25 +185,13 @@ def describe_index(self, name: str): :return: Returns an `IndexDescription` object """ api_instance = self.index_api - response = api_instance.describe_index(name) - db = response.database - host = response.status.host - + description = api_instance.describe_index(name) + host = description.host self.index_host_store.set_host(self.config, name, host) - return IndexDescription( - name=db.name, - metric=db.metric, - replicas=db.replicas, - dimension=db.dimension, - shards=db.shards, - pods=db.pods, - pod_type=db.pod_type, - status=response.status, - metadata_config=db.metadata_config, - ) + return description - def configure_index(self, name: str, replicas: Optional[int] = None, pod_type: Optional[str] = ""): + def configure_index(self, name: str, replicas: Optional[int] = None, pod_type: Optional[str] = None): """Changes current configuration of the index. :param: name: the name of the Index :param: replicas: the desired number of replicas, lowest value is 0. @@ -209,23 +199,23 @@ def configure_index(self, name: str, replicas: Optional[int] = None, pod_type: O """ api_instance = self.index_api config_args: Dict[str, Any] = {} - if pod_type != "": + if pod_type: config_args.update(pod_type=pod_type) if replicas: config_args.update(replicas=replicas) - patch_request = PatchRequest(**config_args) - api_instance.configure_index(name, patch_request=patch_request) + configure_index_request = ConfigureIndexRequest(**config_args) + api_instance.configure_index(name, configure_index_request=configure_index_request) def scale_index(self, name: str, replicas: int): - """Increases number of replicas for the index. + """Change the number of replicas for the index. Replicas may be scaled up or down. :param name: the name of the Index :type name: str - :param replicas: the number of replicas in the index now, lowest value is 0. + :param replicas: the number of replicas in the index now, lowest value is 1. :type replicas: int """ api_instance = self.index_api - api_instance.configure_index(name, patch_request=PatchRequest(replicas=replicas, pod_type="")) + api_instance.configure_index(name, patch_request=ConfigureIndexRequest(replicas=replicas, pod_type="")) def create_collection(self, name: str, source: str): """Create a collection @@ -254,9 +244,7 @@ def describe_collection(self, name: str): :return: Description of the collection """ api_instance = self.index_api - response = api_instance.describe_collection(name).to_dict() - response_object = CollectionDescription(response.keys(), response.values()) - return response_object + return api_instance.describe_collection(name).to_dict() def _get_status(self, name: str): api_instance = self.index_api diff --git a/pinecone/core/client/__init__.py b/pinecone/core/client/__init__.py index 584d1219b..486f91455 100644 --- a/pinecone/core/client/__init__.py +++ b/pinecone/core/client/__init__.py @@ -1,12 +1,11 @@ # flake8: noqa """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/api/__init__.py b/pinecone/core/client/api/__init__.py index 14e304372..a4e950c74 100644 --- a/pinecone/core/client/api/__init__.py +++ b/pinecone/core/client/api/__init__.py @@ -1,3 +1,3 @@ # do not import all apis into this module because that uses a lot of memory and stack frames # if you need the ability to import all apis from one package, import them with -# from pinecone.core.client.apis import IndexOperationsApi +# from pinecone.core.client.apis import ManagePodIndexesApi diff --git a/pinecone/core/client/api/index_operations_api.py b/pinecone/core/client/api/manage_pod_indexes_api.py similarity index 86% rename from pinecone/core/client/api/index_operations_api.py rename to pinecone/core/client/api/manage_pod_indexes_api.py index 0e31c7800..53bd97434 100644 --- a/pinecone/core/client/api/index_operations_api.py +++ b/pinecone/core/client/api/manage_pod_indexes_api.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -22,15 +21,17 @@ none_type, validate_and_convert_types ) -from pinecone.core.client.model.collection_meta import CollectionMeta +from pinecone.core.client.model.collection_list import CollectionList +from pinecone.core.client.model.collection_model import CollectionModel +from pinecone.core.client.model.configure_index_request import ConfigureIndexRequest from pinecone.core.client.model.create_collection_request import CreateCollectionRequest -from pinecone.core.client.model.create_request import CreateRequest -from pinecone.core.client.model.index_meta import IndexMeta -from pinecone.core.client.model.inline_response200 import InlineResponse200 -from pinecone.core.client.model.patch_request import PatchRequest +from pinecone.core.client.model.create_index_request import CreateIndexRequest +from pinecone.core.client.model.error_response import ErrorResponse +from pinecone.core.client.model.index_list import IndexList +from pinecone.core.client.model.index_model import IndexModel -class IndexOperationsApi(object): +class ManagePodIndexesApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -45,6 +46,7 @@ def __init__(self, api_client=None): def __configure_index( self, index_name, + configure_index_request, **kwargs ): """configure_index # noqa: E501 @@ -53,14 +55,14 @@ def __configure_index( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.configure_index(index_name, async_req=True) + >>> thread = api.configure_index(index_name, configure_index_request, async_req=True) >>> result = thread.get() Args: - index_name (str): The name of the index + index_name (str): The name of the index to configure + configure_index_request (ConfigureIndexRequest): The desired pod type and replica configuration for the index. Keyword Args: - patch_request (PatchRequest): The desired pod type and replica configuration for the index.. [optional] _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object @@ -82,7 +84,7 @@ def __configure_index( async_req (bool): execute request asynchronously Returns: - IndexMeta + IndexModel If the method is called asynchronously, returns the request thread. """ @@ -107,37 +109,34 @@ def __configure_index( kwargs['_host_index'] = kwargs.get('_host_index') kwargs['index_name'] = \ index_name + kwargs['configure_index_request'] = \ + configure_index_request return self.call_with_http_info(**kwargs) self.configure_index = _Endpoint( settings={ - 'response_type': (IndexMeta,), + 'response_type': (IndexModel,), 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/databases/{indexName}', + 'endpoint_path': '/indexes/{index_name}', 'operation_id': 'configure_index', 'http_method': 'PATCH', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, params_map={ 'all': [ 'index_name', - 'patch_request', + 'configure_index_request', ], 'required': [ 'index_name', + 'configure_index_request', ], 'nullable': [ ], @@ -154,15 +153,15 @@ def __configure_index( 'openapi_types': { 'index_name': (str,), - 'patch_request': - (PatchRequest,), + 'configure_index_request': + (ConfigureIndexRequest,), }, 'attribute_map': { - 'index_name': 'indexName', + 'index_name': 'index_name', }, 'location_map': { 'index_name': 'path', - 'patch_request': 'body', + 'configure_index_request': 'body', }, 'collection_format_map': { } @@ -181,6 +180,7 @@ def __configure_index( def __create_collection( self, + create_collection_request, **kwargs ): """create_collection # noqa: E501 @@ -189,12 +189,13 @@ def __create_collection( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_collection(async_req=True) + >>> thread = api.create_collection(create_collection_request, async_req=True) >>> result = thread.get() + Args: + create_collection_request (CreateCollectionRequest): The desired configuration for the collection. Keyword Args: - create_collection_request (CreateCollectionRequest): [optional] _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object @@ -216,7 +217,7 @@ def __create_collection( async_req (bool): execute request asynchronously Returns: - str + CollectionModel If the method is called asynchronously, returns the request thread. """ @@ -239,11 +240,13 @@ def __create_collection( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['create_collection_request'] = \ + create_collection_request return self.call_with_http_info(**kwargs) self.create_collection = _Endpoint( settings={ - 'response_type': (str,), + 'response_type': (CollectionModel,), 'auth': [ 'ApiKeyAuth' ], @@ -254,12 +257,6 @@ def __create_collection( { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -267,7 +264,9 @@ def __create_collection( 'all': [ 'create_collection_request', ], - 'required': [], + 'required': [ + 'create_collection_request', + ], 'nullable': [ ], 'enum': [ @@ -294,7 +293,7 @@ def __create_collection( }, headers_map={ 'accept': [ - 'text/plain' + 'application/json' ], 'content_type': [ 'application/json' @@ -306,20 +305,22 @@ def __create_collection( def __create_index( self, + create_index_request, **kwargs ): """create_index # noqa: E501 - This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. # noqa: E501 + This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_index(async_req=True) + >>> thread = api.create_index(create_index_request, async_req=True) >>> result = thread.get() + Args: + create_index_request (CreateIndexRequest): The desired configuration for the index. Keyword Args: - create_request (CreateRequest): [optional] _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object @@ -341,7 +342,7 @@ def __create_index( async_req (bool): execute request asynchronously Returns: - IndexMeta + IndexModel If the method is called asynchronously, returns the request thread. """ @@ -364,35 +365,33 @@ def __create_index( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['create_index_request'] = \ + create_index_request return self.call_with_http_info(**kwargs) self.create_index = _Endpoint( settings={ - 'response_type': (IndexMeta,), + 'response_type': (IndexModel,), 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/databases', + 'endpoint_path': '/indexes', 'operation_id': 'create_index', 'http_method': 'POST', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, params_map={ 'all': [ - 'create_request', + 'create_index_request', + ], + 'required': [ + 'create_index_request', ], - 'required': [], 'nullable': [ ], 'enum': [ @@ -406,13 +405,13 @@ def __create_index( 'allowed_values': { }, 'openapi_types': { - 'create_request': - (CreateRequest,), + 'create_index_request': + (CreateIndexRequest,), }, 'attribute_map': { }, 'location_map': { - 'create_request': 'body', + 'create_index_request': 'body', }, 'collection_format_map': { } @@ -501,19 +500,13 @@ def __delete_collection( 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/collections/{collectionName}', + 'endpoint_path': '/collections/{collection_name}', 'operation_id': 'delete_collection', 'http_method': 'DELETE', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -541,7 +534,7 @@ def __delete_collection( (str,), }, 'attribute_map': { - 'collection_name': 'collectionName', + 'collection_name': 'collection_name', }, 'location_map': { 'collection_name': 'path', @@ -551,7 +544,8 @@ def __delete_collection( }, headers_map={ 'accept': [ - 'text/plain' + 'text/plain', + 'application/json' ], 'content_type': [], }, @@ -574,7 +568,7 @@ def __delete_index( >>> result = thread.get() Args: - index_name (str): The name of the index + index_name (str): The name of the index to delete Keyword Args: _return_http_data_only (bool): response data without head status @@ -598,7 +592,7 @@ def __delete_index( async_req (bool): execute request asynchronously Returns: - str + None If the method is called asynchronously, returns the request thread. """ @@ -627,23 +621,17 @@ def __delete_index( self.delete_index = _Endpoint( settings={ - 'response_type': (str,), + 'response_type': None, 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/databases/{indexName}', + 'endpoint_path': '/indexes/{index_name}', 'operation_id': 'delete_index', 'http_method': 'DELETE', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -671,7 +659,7 @@ def __delete_index( (str,), }, 'attribute_map': { - 'index_name': 'indexName', + 'index_name': 'index_name', }, 'location_map': { 'index_name': 'path', @@ -681,7 +669,7 @@ def __delete_index( }, headers_map={ 'accept': [ - 'text/plain' + 'application/json' ], 'content_type': [], }, @@ -696,7 +684,7 @@ def __describe_collection( ): """describe_collection # noqa: E501 - Get a description of a collection. # noqa: E501 + This operation gets a description of a collection. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True @@ -704,7 +692,7 @@ def __describe_collection( >>> result = thread.get() Args: - collection_name (str): The name of the collection + collection_name (str): The name of the collection to be described Keyword Args: _return_http_data_only (bool): response data without head status @@ -728,7 +716,7 @@ def __describe_collection( async_req (bool): execute request asynchronously Returns: - CollectionMeta + CollectionModel If the method is called asynchronously, returns the request thread. """ @@ -757,23 +745,17 @@ def __describe_collection( self.describe_collection = _Endpoint( settings={ - 'response_type': (CollectionMeta,), + 'response_type': (CollectionModel,), 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/collections/{collectionName}', + 'endpoint_path': '/collections/{collection_name}', 'operation_id': 'describe_collection', 'http_method': 'GET', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -801,7 +783,7 @@ def __describe_collection( (str,), }, 'attribute_map': { - 'collection_name': 'collectionName', + 'collection_name': 'collection_name', }, 'location_map': { 'collection_name': 'path', @@ -834,7 +816,7 @@ def __describe_index( >>> result = thread.get() Args: - index_name (str): The name of the index + index_name (str): The name of the index to be described Keyword Args: _return_http_data_only (bool): response data without head status @@ -858,7 +840,7 @@ def __describe_index( async_req (bool): execute request asynchronously Returns: - IndexMeta + IndexModel If the method is called asynchronously, returns the request thread. """ @@ -887,23 +869,17 @@ def __describe_index( self.describe_index = _Endpoint( settings={ - 'response_type': (IndexMeta,), + 'response_type': (IndexModel,), 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/databases/{indexName}', + 'endpoint_path': '/indexes/{index_name}', 'operation_id': 'describe_index', 'http_method': 'GET', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -931,7 +907,7 @@ def __describe_index( (str,), }, 'attribute_map': { - 'index_name': 'indexName', + 'index_name': 'index_name', }, 'location_map': { 'index_name': 'path', @@ -985,7 +961,7 @@ def __list_collections( async_req (bool): execute request asynchronously Returns: - [str] + CollectionList If the method is called asynchronously, returns the request thread. """ @@ -1012,7 +988,7 @@ def __list_collections( self.list_collections = _Endpoint( settings={ - 'response_type': ([str],), + 'response_type': (CollectionList,), 'auth': [ 'ApiKeyAuth' ], @@ -1023,12 +999,6 @@ def __list_collections( { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -1059,7 +1029,7 @@ def __list_collections( }, headers_map={ 'accept': [ - 'application/json; charset=utf-8' + 'application/json' ], 'content_type': [], }, @@ -1103,7 +1073,7 @@ def __list_indexes( async_req (bool): execute request asynchronously Returns: - InlineResponse200 + IndexList If the method is called asynchronously, returns the request thread. """ @@ -1130,23 +1100,17 @@ def __list_indexes( self.list_indexes = _Endpoint( settings={ - 'response_type': (InlineResponse200,), + 'response_type': (IndexList,), 'auth': [ 'ApiKeyAuth' ], - 'endpoint_path': '/databases', + 'endpoint_path': '/indexes', 'operation_id': 'list_indexes', 'http_method': 'GET', 'servers': [ { 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } }, ] }, @@ -1177,7 +1141,7 @@ def __list_indexes( }, headers_map={ 'accept': [ - 'application/json; charset=utf-8' + 'application/json' ], 'content_type': [], }, diff --git a/pinecone/core/client/api/manage_serverless_indexes_api.py b/pinecone/core/client/api/manage_serverless_indexes_api.py new file mode 100644 index 000000000..33eefee7d --- /dev/null +++ b/pinecone/core/client/api/manage_serverless_indexes_api.py @@ -0,0 +1,525 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.api_client import ApiClient, Endpoint as _Endpoint +from pinecone.core.client.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from pinecone.core.client.model.create_index_request import CreateIndexRequest +from pinecone.core.client.model.error_response import ErrorResponse +from pinecone.core.client.model.index_list import IndexList +from pinecone.core.client.model.index_model import IndexModel + + +class ManageServerlessIndexesApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def __create_index( + self, + create_index_request, + **kwargs + ): + """create_index # noqa: E501 + + This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_index(create_index_request, async_req=True) + >>> result = thread.get() + + Args: + create_index_request (CreateIndexRequest): The desired configuration for the index. + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + IndexModel + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['create_index_request'] = \ + create_index_request + return self.call_with_http_info(**kwargs) + + self.create_index = _Endpoint( + settings={ + 'response_type': (IndexModel,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/indexes', + 'operation_id': 'create_index', + 'http_method': 'POST', + 'servers': [ + { + 'url': "https://api.pinecone.io", + 'description': "No description provided", + }, + ] + }, + params_map={ + 'all': [ + 'create_index_request', + ], + 'required': [ + 'create_index_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'create_index_request': + (CreateIndexRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'create_index_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create_index + ) + + def __delete_index( + self, + index_name, + **kwargs + ): + """delete_index # noqa: E501 + + This operation deletes an existing index. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_index(index_name, async_req=True) + >>> result = thread.get() + + Args: + index_name (str): The name of the index to delete + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + None + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['index_name'] = \ + index_name + return self.call_with_http_info(**kwargs) + + self.delete_index = _Endpoint( + settings={ + 'response_type': None, + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/indexes/{index_name}', + 'operation_id': 'delete_index', + 'http_method': 'DELETE', + 'servers': [ + { + 'url': "https://api.pinecone.io", + 'description': "No description provided", + }, + ] + }, + params_map={ + 'all': [ + 'index_name', + ], + 'required': [ + 'index_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'index_name': + (str,), + }, + 'attribute_map': { + 'index_name': 'index_name', + }, + 'location_map': { + 'index_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__delete_index + ) + + def __describe_index( + self, + index_name, + **kwargs + ): + """describe_index # noqa: E501 + + Get a description of an index. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.describe_index(index_name, async_req=True) + >>> result = thread.get() + + Args: + index_name (str): The name of the index to be described + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + IndexModel + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['index_name'] = \ + index_name + return self.call_with_http_info(**kwargs) + + self.describe_index = _Endpoint( + settings={ + 'response_type': (IndexModel,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/indexes/{index_name}', + 'operation_id': 'describe_index', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://api.pinecone.io", + 'description': "No description provided", + }, + ] + }, + params_map={ + 'all': [ + 'index_name', + ], + 'required': [ + 'index_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'index_name': + (str,), + }, + 'attribute_map': { + 'index_name': 'index_name', + }, + 'location_map': { + 'index_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__describe_index + ) + + def __list_indexes( + self, + **kwargs + ): + """list_indexes # noqa: E501 + + This operation returns a list of your Pinecone indexes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_indexes(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _return_http_data_only (bool): response data without head status + code and headers. Default is True. + _preload_content (bool): if False, the urllib3.HTTPResponse object + will be returned without reading/decoding response data. + Default is True. + _request_timeout (int/float/tuple): timeout setting for this request. If + one number provided, it will be total request timeout. It can also + be a pair (tuple) of (connection, read) timeouts. + Default is None. + _check_input_type (bool): specifies if type checking + should be done one the data sent to the server. + Default is True. + _check_return_type (bool): specifies if type checking + should be done one the data received from the server. + Default is True. + _host_index (int/None): specifies the index of the server + that we want to use. + Default is read from the configuration. + async_req (bool): execute request asynchronously + + Returns: + IndexList + If the method is called asynchronously, returns the request + thread. + """ + kwargs['async_req'] = kwargs.get( + 'async_req', False + ) + kwargs['_return_http_data_only'] = kwargs.get( + '_return_http_data_only', True + ) + kwargs['_preload_content'] = kwargs.get( + '_preload_content', True + ) + kwargs['_request_timeout'] = kwargs.get( + '_request_timeout', None + ) + kwargs['_check_input_type'] = kwargs.get( + '_check_input_type', True + ) + kwargs['_check_return_type'] = kwargs.get( + '_check_return_type', True + ) + kwargs['_host_index'] = kwargs.get('_host_index') + return self.call_with_http_info(**kwargs) + + self.list_indexes = _Endpoint( + settings={ + 'response_type': (IndexList,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/indexes', + 'operation_id': 'list_indexes', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://api.pinecone.io", + 'description': "No description provided", + }, + ] + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list_indexes + ) diff --git a/pinecone/core/client/api/vector_operations_api.py b/pinecone/core/client/api/vector_operations_api.py index c5bc02a2a..9c423051e 100644 --- a/pinecone/core/client/api/vector_operations_api.py +++ b/pinecone/core/client/api/vector_operations_api.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/api_client.py b/pinecone/core/client/api_client.py index 770fc07cd..88cb5182d 100644 --- a/pinecone/core/client/api_client.py +++ b/pinecone/core/client/api_client.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -762,7 +761,7 @@ def __call__(self, *args, **kwargs): """ This method is invoked when endpoints are called Example: - api_instance = IndexOperationsApi() + api_instance = ManagePodIndexesApi() api_instance.configure_index # this is an instance of the class Endpoint api_instance.configure_index() # this invokes api_instance.configure_index.__call__() which then invokes the callable functions stored in that endpoint at diff --git a/pinecone/core/client/apis/__init__.py b/pinecone/core/client/apis/__init__.py index ec42b1a85..bc39a4d40 100644 --- a/pinecone/core/client/apis/__init__.py +++ b/pinecone/core/client/apis/__init__.py @@ -6,7 +6,7 @@ # raise a `RecursionError`. # In order to avoid this, import only the API that you directly need like: # -# from .api.index_operations_api import IndexOperationsApi +# from .api.manage_pod_indexes_api import ManagePodIndexesApi # # or import this package, but before doing it, use: # @@ -14,5 +14,6 @@ # sys.setrecursionlimit(n) # Import APIs into API package: -from pinecone.core.client.api.index_operations_api import IndexOperationsApi +from pinecone.core.client.api.manage_pod_indexes_api import ManagePodIndexesApi +from pinecone.core.client.api.manage_serverless_indexes_api import ManageServerlessIndexesApi from pinecone.core.client.api.vector_operations_api import VectorOperationsApi diff --git a/pinecone/core/client/configuration.py b/pinecone/core/client/configuration.py index 6e2d4949b..99447c9f2 100644 --- a/pinecone/core/client/configuration.py +++ b/pinecone/core/client/configuration.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -113,7 +112,7 @@ def __init__(self, host=None, ): """Constructor """ - self._base_path = "https://unknown-unknown.svc.unknown.pinecone.io" if host is None else host + self._base_path = "https://api.pinecone.io" if host is None else host """Default Base url """ self.server_index = 0 if server_index is None and host is None else server_index @@ -406,7 +405,7 @@ def to_debug_report(self): return "Python SDK Debug Report:\n"\ "OS: {env}\n"\ "Python Version: {pyversion}\n"\ - "Version of the API: version not set\n"\ + "Version of the API: 1.0\n"\ "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) @@ -417,22 +416,8 @@ def get_host_settings(self): """ return [ { - 'url': "https://{index_name}-{project_name}.svc.{environment}.pinecone.io", + 'url': "https://api.pinecone.io", 'description': "No description provided", - 'variables': { - 'index_name': { - 'description': "No description provided", - 'default_value': "unknown", - }, - 'project_name': { - 'description': "No description provided", - 'default_value': "unknown", - }, - 'environment': { - 'description': "No description provided", - 'default_value': "unknown", - } - } } ] diff --git a/pinecone/core/client/exceptions.py b/pinecone/core/client/exceptions.py index dd777d024..3d1ff935a 100644 --- a/pinecone/core/client/exceptions.py +++ b/pinecone/core/client/exceptions.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/aws_regions.py b/pinecone/core/client/model/aws_regions.py new file mode 100644 index 000000000..04848cb3f --- /dev/null +++ b/pinecone/core/client/model/aws_regions.py @@ -0,0 +1,289 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class AwsRegions(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('value',): { + 'EAST-1': "us-east-1", + 'WEST-1': "us-west-1", + 'WEST-2': "us-west-2", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """AwsRegions - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Regions available with the AWS cloud provider., must be one of ["us-east-1", "us-west-1", "us-west-2", ] # noqa: E501 + + Keyword Args: + value (str): Regions available with the AWS cloud provider., must be one of ["us-east-1", "us-west-1", "us-west-2", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """AwsRegions - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Regions available with the AWS cloud provider., must be one of ["us-east-1", "us-west-1", "us-west-2", ] # noqa: E501 + + Keyword Args: + value (str): Regions available with the AWS cloud provider., must be one of ["us-east-1", "us-west-1", "us-west-2", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/inline_response200.py b/pinecone/core/client/model/collection_list.py similarity index 93% rename from pinecone/core/client/model/inline_response200.py rename to pinecone/core/client/model/collection_list.py index c7e991067..2cac53b57 100644 --- a/pinecone/core/client/model/inline_response200.py +++ b/pinecone/core/client/model/collection_list.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -31,11 +30,11 @@ def lazy_import(): - from pinecone.core.client.model.index_list_meta import IndexListMeta - globals()['IndexListMeta'] = IndexListMeta + from pinecone.core.client.model.collection_model import CollectionModel + globals()['CollectionModel'] = CollectionModel -class InlineResponse200(ModelNormal): +class CollectionList(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -88,7 +87,7 @@ def openapi_types(): """ lazy_import() return { - 'databases': ([IndexListMeta],), # noqa: E501 + 'collections': ([CollectionModel],), # noqa: E501 } @cached_property @@ -97,7 +96,7 @@ def discriminator(): attribute_map = { - 'databases': 'databases', # noqa: E501 + 'collections': 'collections', # noqa: E501 } read_only_vars = { @@ -108,7 +107,7 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """InlineResponse200 - a model defined in OpenAPI + """CollectionList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -141,7 +140,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - databases ([IndexListMeta]): [optional] # noqa: E501 + collections ([CollectionModel]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -190,7 +189,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 - """InlineResponse200 - a model defined in OpenAPI + """CollectionList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -223,7 +222,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - databases ([IndexListMeta]): [optional] # noqa: E501 + collections ([CollectionModel]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/pinecone/core/client/model/collection_meta.py b/pinecone/core/client/model/collection_model.py similarity index 87% rename from pinecone/core/client/model/collection_meta.py rename to pinecone/core/client/model/collection_model.py index 9f33d5ef0..acbcaf952 100644 --- a/pinecone/core/client/model/collection_meta.py +++ b/pinecone/core/client/model/collection_model.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -31,7 +30,7 @@ -class CollectionMeta(ModelNormal): +class CollectionModel(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -56,9 +55,18 @@ class CollectionMeta(ModelNormal): """ allowed_values = { + ('status',): { + 'INITIALIZING': "Initializing", + 'READY': "Ready", + 'TERMINATING': "Terminating", + }, } validations = { + ('dimension',): { + 'inclusive_maximum': 2000, + 'inclusive_minimum': 1, + }, } @cached_property @@ -86,7 +94,8 @@ def openapi_types(): 'size': (int,), # noqa: E501 'status': (str,), # noqa: E501 'dimension': (int,), # noqa: E501 - 'vector_count': (int,), # noqa: E501 + 'record_count': (int,), # noqa: E501 + 'environment': (str,), # noqa: E501 } @cached_property @@ -99,7 +108,8 @@ def discriminator(): 'size': 'size', # noqa: E501 'status': 'status', # noqa: E501 'dimension': 'dimension', # noqa: E501 - 'vector_count': 'vector_count', # noqa: E501 + 'record_count': 'record_count', # noqa: E501 + 'environment': 'environment', # noqa: E501 } read_only_vars = { @@ -109,15 +119,15 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, name, size, status, dimension, vector_count, *args, **kwargs): # noqa: E501 - """CollectionMeta - a model defined in OpenAPI + def _from_openapi_data(cls, name, size, status, dimension, record_count, *args, **kwargs): # noqa: E501 + """CollectionModel - a model defined in OpenAPI Args: name (str): size (int): The size of the collection in bytes. status (str): The status of the collection. - dimension (int): The dimension of the records stored in the collection - vector_count (int): The number of records stored in the collection + dimension (int): The dimension of the vectors stored in each record held in the collection + record_count (int): The number of records stored in the collection Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -150,6 +160,7 @@ def _from_openapi_data(cls, name, size, status, dimension, vector_count, *args, Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) + environment (str): The environment where the collection is hosted.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -181,7 +192,7 @@ def _from_openapi_data(cls, name, size, status, dimension, vector_count, *args, self.size = size self.status = status self.dimension = dimension - self.vector_count = vector_count + self.record_count = record_count for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -202,15 +213,15 @@ def _from_openapi_data(cls, name, size, status, dimension, vector_count, *args, ]) @convert_js_args_to_python_args - def __init__(self, name, size, status, dimension, vector_count, *args, **kwargs): # noqa: E501 - """CollectionMeta - a model defined in OpenAPI + def __init__(self, name, size, status, dimension, record_count, *args, **kwargs): # noqa: E501 + """CollectionModel - a model defined in OpenAPI Args: name (str): size (int): The size of the collection in bytes. status (str): The status of the collection. - dimension (int): The dimension of the records stored in the collection - vector_count (int): The number of records stored in the collection + dimension (int): The dimension of the vectors stored in each record held in the collection + record_count (int): The number of records stored in the collection Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -243,6 +254,7 @@ def __init__(self, name, size, status, dimension, vector_count, *args, **kwargs) Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) + environment (str): The environment where the collection is hosted.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -272,7 +284,7 @@ def __init__(self, name, size, status, dimension, vector_count, *args, **kwargs) self.size = size self.status = status self.dimension = dimension - self.vector_count = vector_count + self.record_count = record_count for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ diff --git a/pinecone/core/client/model/configure_index_request.py b/pinecone/core/client/model/configure_index_request.py new file mode 100644 index 000000000..864c1427b --- /dev/null +++ b/pinecone/core/client/model/configure_index_request.py @@ -0,0 +1,267 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + +def lazy_import(): + from pinecone.core.client.model.configure_index_request_spec import ConfigureIndexRequestSpec + globals()['ConfigureIndexRequestSpec'] = ConfigureIndexRequestSpec + + +class ConfigureIndexRequest(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'spec': (ConfigureIndexRequestSpec,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'spec': 'spec', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, spec, *args, **kwargs): # noqa: E501 + """ConfigureIndexRequest - a model defined in OpenAPI + + Args: + spec (ConfigureIndexRequestSpec): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.spec = spec + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, spec, *args, **kwargs): # noqa: E501 + """ConfigureIndexRequest - a model defined in OpenAPI + + Args: + spec (ConfigureIndexRequestSpec): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.spec = spec + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/configure_index_request_spec.py b/pinecone/core/client/model/configure_index_request_spec.py new file mode 100644 index 000000000..e673d077f --- /dev/null +++ b/pinecone/core/client/model/configure_index_request_spec.py @@ -0,0 +1,267 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + +def lazy_import(): + from pinecone.core.client.model.configure_index_request_spec_pod import ConfigureIndexRequestSpecPod + globals()['ConfigureIndexRequestSpecPod'] = ConfigureIndexRequestSpecPod + + +class ConfigureIndexRequestSpec(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'pod': (ConfigureIndexRequestSpecPod,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'pod': 'pod', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, pod, *args, **kwargs): # noqa: E501 + """ConfigureIndexRequestSpec - a model defined in OpenAPI + + Args: + pod (ConfigureIndexRequestSpecPod): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pod = pod + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, pod, *args, **kwargs): # noqa: E501 + """ConfigureIndexRequestSpec - a model defined in OpenAPI + + Args: + pod (ConfigureIndexRequestSpecPod): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.pod = pod + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/patch_request.py b/pinecone/core/client/model/configure_index_request_spec_pod.py similarity index 90% rename from pinecone/core/client/model/patch_request.py rename to pinecone/core/client/model/configure_index_request_spec_pod.py index 53425c222..fbfde79c1 100644 --- a/pinecone/core/client/model/patch_request.py +++ b/pinecone/core/client/model/configure_index_request_spec_pod.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -30,8 +29,14 @@ from pinecone.core.client.exceptions import ApiAttributeError +def lazy_import(): + from pinecone.core.client.model.pod_spec_pod_type import PodSpecPodType + from pinecone.core.client.model.pod_spec_replicas import PodSpecReplicas + globals()['PodSpecPodType'] = PodSpecPodType + globals()['PodSpecReplicas'] = PodSpecReplicas -class PatchRequest(ModelNormal): + +class ConfigureIndexRequestSpecPod(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -67,6 +72,7 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ + lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -81,9 +87,10 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { - 'replicas': (int,), # noqa: E501 - 'pod_type': (str,), # noqa: E501 + 'replicas': (PodSpecReplicas,), # noqa: E501 + 'pod_type': (PodSpecPodType,), # noqa: E501 } @cached_property @@ -104,7 +111,7 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """PatchRequest - a model defined in OpenAPI + """ConfigureIndexRequestSpecPod - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -137,8 +144,8 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - replicas (int): The desired number of replicas for the index.. [optional] # noqa: E501 - pod_type (str): The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] # noqa: E501 + replicas (PodSpecReplicas): [optional] # noqa: E501 + pod_type (PodSpecPodType): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -187,7 +194,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 - """PatchRequest - a model defined in OpenAPI + """ConfigureIndexRequestSpecPod - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -220,8 +227,8 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - replicas (int): The desired number of replicas for the index.. [optional] # noqa: E501 - pod_type (str): The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] # noqa: E501 + replicas (PodSpecReplicas): [optional] # noqa: E501 + pod_type (PodSpecPodType): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/pinecone/core/client/model/create_collection_request.py b/pinecone/core/client/model/create_collection_request.py index 6cf24b7a7..c80103ae1 100644 --- a/pinecone/core/client/model/create_collection_request.py +++ b/pinecone/core/client/model/create_collection_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/index_list_meta.py b/pinecone/core/client/model/create_index_request.py similarity index 84% rename from pinecone/core/client/model/index_list_meta.py rename to pinecone/core/client/model/create_index_request.py index 7cfbd92d9..d0fd33ce3 100644 --- a/pinecone/core/client/model/index_list_meta.py +++ b/pinecone/core/client/model/create_index_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -30,8 +29,14 @@ from pinecone.core.client.exceptions import ApiAttributeError +def lazy_import(): + from pinecone.core.client.model.index_dimension import IndexDimension + from pinecone.core.client.model.index_metric import IndexMetric + globals()['IndexDimension'] = IndexDimension + globals()['IndexMetric'] = IndexMetric -class IndexListMeta(ModelNormal): + +class CreateIndexRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -67,6 +72,7 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ + lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -81,12 +87,12 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { 'name': (str,), # noqa: E501 - 'metric': (str,), # noqa: E501 - 'dimension': (int,), # noqa: E501 - 'capacity_mode': (str,), # noqa: E501 - 'host': (str,), # noqa: E501 + 'dimension': (IndexDimension,), # noqa: E501 + 'metric': (IndexMetric,), # noqa: E501 + 'spec': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 } @cached_property @@ -96,10 +102,9 @@ def discriminator(): attribute_map = { 'name': 'name', # noqa: E501 - 'metric': 'metric', # noqa: E501 'dimension': 'dimension', # noqa: E501 - 'capacity_mode': 'capacity_mode', # noqa: E501 - 'host': 'host', # noqa: E501 + 'metric': 'metric', # noqa: E501 + 'spec': 'spec', # noqa: E501 } read_only_vars = { @@ -109,15 +114,14 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, name, metric, dimension, capacity_mode, host, *args, **kwargs): # noqa: E501 - """IndexListMeta - a model defined in OpenAPI + def _from_openapi_data(cls, name, dimension, metric, spec, *args, **kwargs): # noqa: E501 + """CreateIndexRequest - a model defined in OpenAPI Args: - name (str): - metric (str): - dimension (int): - capacity_mode (str): - host (str): + name (str): The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + dimension (IndexDimension): + metric (IndexMetric): + spec ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Spec objects describe how the index should be deployed Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -178,10 +182,9 @@ def _from_openapi_data(cls, name, metric, dimension, capacity_mode, host, *args, self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name - self.metric = metric self.dimension = dimension - self.capacity_mode = capacity_mode - self.host = host + self.metric = metric + self.spec = spec for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -202,15 +205,14 @@ def _from_openapi_data(cls, name, metric, dimension, capacity_mode, host, *args, ]) @convert_js_args_to_python_args - def __init__(self, name, metric, dimension, capacity_mode, host, *args, **kwargs): # noqa: E501 - """IndexListMeta - a model defined in OpenAPI + def __init__(self, name, dimension, metric, spec, *args, **kwargs): # noqa: E501 + """CreateIndexRequest - a model defined in OpenAPI Args: - name (str): - metric (str): - dimension (int): - capacity_mode (str): - host (str): + name (str): The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + dimension (IndexDimension): + metric (IndexMetric): + spec ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Spec objects describe how the index should be deployed Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -269,10 +271,9 @@ def __init__(self, name, metric, dimension, capacity_mode, host, *args, **kwargs self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name - self.metric = metric self.dimension = dimension - self.capacity_mode = capacity_mode - self.host = host + self.metric = metric + self.spec = spec for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ diff --git a/pinecone/core/client/model/create_request.py b/pinecone/core/client/model/create_request.py deleted file mode 100644 index e19d8d9e4..000000000 --- a/pinecone/core/client/model/create_request.py +++ /dev/null @@ -1,331 +0,0 @@ -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) -from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError - - - -class CreateRequest(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - ('cloud',): { - 'GCP': "gcp", - 'AWS': "aws", - 'AZURE': "azure", - }, - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - 'dimension': (int,), # noqa: E501 - 'region': (str,), # noqa: E501 - 'cloud': (str,), # noqa: E501 - 'capacity_mode': (str,), # noqa: E501 - 'environment': (str,), # noqa: E501 - 'index_type': (str,), # noqa: E501 - 'metric': (str,), # noqa: E501 - 'pods': (int,), # noqa: E501 - 'replicas': (int,), # noqa: E501 - 'shards': (int,), # noqa: E501 - 'pod_type': (str,), # noqa: E501 - 'index_config': (dict,), # noqa: E501 - 'metadata_config': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 - 'source_collection': (str,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'dimension': 'dimension', # noqa: E501 - 'region': 'region', # noqa: E501 - 'cloud': 'cloud', # noqa: E501 - 'capacity_mode': 'capacity_mode', # noqa: E501 - 'environment': 'environment', # noqa: E501 - 'index_type': 'index_type', # noqa: E501 - 'metric': 'metric', # noqa: E501 - 'pods': 'pods', # noqa: E501 - 'replicas': 'replicas', # noqa: E501 - 'shards': 'shards', # noqa: E501 - 'pod_type': 'pod_type', # noqa: E501 - 'index_config': 'index_config', # noqa: E501 - 'metadata_config': 'metadata_config', # noqa: E501 - 'source_collection': 'source_collection', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, dimension, region, cloud, capacity_mode, *args, **kwargs): # noqa: E501 - """CreateRequest - a model defined in OpenAPI - - Args: - name (str): The name of the index to be created. The maximum length is 45 characters. - dimension (int): The dimensions of the vectors to be inserted in the index - region (str): The region where you would like your index to be created - cloud (str): The public cloud where you would like your index hosted - capacity_mode (str): The capacity mode for the index. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - environment (str): The environment where you would like your index to be created. [optional] # noqa: E501 - index_type (str): The type of vector index. Pinecone supports 'approximated'.. [optional] if omitted the server will use the default value of "approximated" # noqa: E501 - metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.. [optional] if omitted the server will use the default value of "cosine" # noqa: E501 - pods (int): The number of pods for the index to use,including replicas.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - replicas (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - shards (int): The number of shards to be used in the index.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - pod_type (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] if omitted the server will use the default value of "p1.x1" # noqa: E501 - index_config (dict): [optional] # noqa: E501 - metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: ``` {\"indexed\": [\"example_metadata_field\"]} ``` . [optional] # noqa: E501 - source_collection (str): The name of the collection to create an index from. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.dimension = dimension - self.region = region - self.cloud = cloud - self.capacity_mode = capacity_mode - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, dimension, region, cloud, capacity_mode, *args, **kwargs): # noqa: E501 - """CreateRequest - a model defined in OpenAPI - - Args: - name (str): The name of the index to be created. The maximum length is 45 characters. - dimension (int): The dimensions of the vectors to be inserted in the index - region (str): The region where you would like your index to be created - cloud (str): The public cloud where you would like your index hosted - capacity_mode (str): The capacity mode for the index. - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - environment (str): The environment where you would like your index to be created. [optional] # noqa: E501 - index_type (str): The type of vector index. Pinecone supports 'approximated'.. [optional] if omitted the server will use the default value of "approximated" # noqa: E501 - metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.. [optional] if omitted the server will use the default value of "cosine" # noqa: E501 - pods (int): The number of pods for the index to use,including replicas.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - replicas (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - shards (int): The number of shards to be used in the index.. [optional] if omitted the server will use the default value of 1 # noqa: E501 - pod_type (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] if omitted the server will use the default value of "p1.x1" # noqa: E501 - index_config (dict): [optional] # noqa: E501 - metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: ``` {\"indexed\": [\"example_metadata_field\"]} ``` . [optional] # noqa: E501 - source_collection (str): The name of the collection to create an index from. [optional] # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.dimension = dimension - self.region = region - self.cloud = cloud - self.capacity_mode = capacity_mode - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/pinecone/core/client/model/delete_request.py b/pinecone/core/client/model/delete_request.py index 446466d57..10e0832b3 100644 --- a/pinecone/core/client/model/delete_request.py +++ b/pinecone/core/client/model/delete_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/describe_index_stats_request.py b/pinecone/core/client/model/describe_index_stats_request.py index da0eb0b24..a6f8de18d 100644 --- a/pinecone/core/client/model/describe_index_stats_request.py +++ b/pinecone/core/client/model/describe_index_stats_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/describe_index_stats_response.py b/pinecone/core/client/model/describe_index_stats_response.py index 9dc9c4056..e56c1ab87 100644 --- a/pinecone/core/client/model/describe_index_stats_response.py +++ b/pinecone/core/client/model/describe_index_stats_response.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/index_meta.py b/pinecone/core/client/model/error_response.py similarity index 90% rename from pinecone/core/client/model/index_meta.py rename to pinecone/core/client/model/error_response.py index baac4d5c4..543305804 100644 --- a/pinecone/core/client/model/index_meta.py +++ b/pinecone/core/client/model/error_response.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -31,13 +30,11 @@ def lazy_import(): - from pinecone.core.client.model.index_meta_database import IndexMetaDatabase - from pinecone.core.client.model.index_meta_status import IndexMetaStatus - globals()['IndexMetaDatabase'] = IndexMetaDatabase - globals()['IndexMetaStatus'] = IndexMetaStatus + from pinecone.core.client.model.error_response_error import ErrorResponseError + globals()['ErrorResponseError'] = ErrorResponseError -class IndexMeta(ModelNormal): +class ErrorResponse(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -90,8 +87,8 @@ def openapi_types(): """ lazy_import() return { - 'database': (IndexMetaDatabase,), # noqa: E501 - 'status': (IndexMetaStatus,), # noqa: E501 + 'status': (int,), # noqa: E501 + 'error': (ErrorResponseError,), # noqa: E501 } @cached_property @@ -100,8 +97,8 @@ def discriminator(): attribute_map = { - 'database': 'database', # noqa: E501 'status': 'status', # noqa: E501 + 'error': 'error', # noqa: E501 } read_only_vars = { @@ -111,12 +108,12 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, database, status, *args, **kwargs): # noqa: E501 - """IndexMeta - a model defined in OpenAPI + def _from_openapi_data(cls, status, error, *args, **kwargs): # noqa: E501 + """ErrorResponse - a model defined in OpenAPI Args: - database (IndexMetaDatabase): - status (IndexMetaStatus): + status (int): The HTTP status code of the error + error (ErrorResponseError): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -176,8 +173,8 @@ def _from_openapi_data(cls, database, status, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.database = database self.status = status + self.error = error for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -198,12 +195,12 @@ def _from_openapi_data(cls, database, status, *args, **kwargs): # noqa: E501 ]) @convert_js_args_to_python_args - def __init__(self, database, status, *args, **kwargs): # noqa: E501 - """IndexMeta - a model defined in OpenAPI + def __init__(self, status, error, *args, **kwargs): # noqa: E501 + """ErrorResponse - a model defined in OpenAPI Args: - database (IndexMetaDatabase): - status (IndexMetaStatus): + status (int): The HTTP status code of the error + error (ErrorResponseError): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -261,8 +258,8 @@ def __init__(self, database, status, *args, **kwargs): # noqa: E501 self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - self.database = database self.status = status + self.error = error for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ diff --git a/pinecone/core/client/model/error_response_error.py b/pinecone/core/client/model/error_response_error.py new file mode 100644 index 000000000..4edd409ff --- /dev/null +++ b/pinecone/core/client/model/error_response_error.py @@ -0,0 +1,291 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class ErrorResponseError(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('code',): { + 'QUOTA_EXCEEDED': "QUOTA_EXCEEDED", + 'BAD_PARAMS': "BAD_PARAMS", + 'CANCELLED': "CANCELLED", + 'UNKNOWN': "UNKNOWN", + 'INVALID_ARGUMENT': "INVALID_ARGUMENT", + 'DEADLINE_EXCEEDED': "DEADLINE_EXCEEDED", + 'NOT_FOUND': "NOT_FOUND", + 'ALREADY_EXISTS': "ALREADY_EXISTS", + 'PERMISSION_DENIED': "PERMISSION_DENIED", + 'UNAUTHENTICATED': "UNAUTHENTICATED", + 'RESOURCE_EXHAUSTED': "RESOURCE_EXHAUSTED", + 'FAILED_PRECONDITION': "FAILED_PRECONDITION", + 'ABORTED': "ABORTED", + 'OUT_OF_RANGE': "OUT_OF_RANGE", + 'UNIMPLEMENTED': "UNIMPLEMENTED", + 'INTERNAL': "INTERNAL", + 'UNAVAILABLE': "UNAVAILABLE", + 'DATA_LOSS': "DATA_LOSS", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'code': (str,), # noqa: E501 + 'message': (str,), # noqa: E501 + 'details': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'code': 'code', # noqa: E501 + 'message': 'message', # noqa: E501 + 'details': 'details', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, code, message, *args, **kwargs): # noqa: E501 + """ErrorResponseError - a model defined in OpenAPI + + Args: + code (str): + message (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Additional information about the error. This field is not guaranteed to be present.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.code = code + self.message = message + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, code, message, *args, **kwargs): # noqa: E501 + """ErrorResponseError - a model defined in OpenAPI + + Args: + code (str): + message (str): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + details ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Additional information about the error. This field is not guaranteed to be present.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.code = code + self.message = message + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/fetch_response.py b/pinecone/core/client/model/fetch_response.py index d355980fc..64d0f1ab6 100644 --- a/pinecone/core/client/model/fetch_response.py +++ b/pinecone/core/client/model/fetch_response.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/gcp_regions.py b/pinecone/core/client/model/gcp_regions.py new file mode 100644 index 000000000..8ed733971 --- /dev/null +++ b/pinecone/core/client/model/gcp_regions.py @@ -0,0 +1,292 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class GcpRegions(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('value',): { + 'US-WEST1': "us-west1", + 'US-WEST2': "us-west2", + 'EU-WEST4': "eu-west4", + 'NORTHAMERICA-NORTHEAST1': "northamerica-northeast1", + 'ASIA-NORTHEAST1': "asia-northeast1", + 'ASIA-SOUTHEAST1C': "asia-southeast1C", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """GcpRegions - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Regions available with the GCP cloud provider., must be one of ["us-west1", "us-west2", "eu-west4", "northamerica-northeast1", "asia-northeast1", "asia-southeast1C", ] # noqa: E501 + + Keyword Args: + value (str): Regions available with the GCP cloud provider., must be one of ["us-west1", "us-west2", "eu-west4", "northamerica-northeast1", "asia-northeast1", "asia-southeast1C", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """GcpRegions - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): Regions available with the GCP cloud provider., must be one of ["us-west1", "us-west2", "eu-west4", "northamerica-northeast1", "asia-northeast1", "asia-southeast1C", ] # noqa: E501 + + Keyword Args: + value (str): Regions available with the GCP cloud provider., must be one of ["us-west1", "us-west2", "eu-west4", "northamerica-northeast1", "asia-northeast1", "asia-southeast1C", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/hnsw_config.py b/pinecone/core/client/model/hnsw_config.py deleted file mode 100644 index d6a99a345..000000000 --- a/pinecone/core/client/model/hnsw_config.py +++ /dev/null @@ -1,268 +0,0 @@ -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) -from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError - - - -class HnswConfig(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'ef_construction': (int,), # noqa: E501 - 'ef': (int,), # noqa: E501 - 'm': (int,), # noqa: E501 - 'max_elements': (int,), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'ef_construction': 'ef_construction', # noqa: E501 - 'ef': 'ef', # noqa: E501 - 'm': 'M', # noqa: E501 - 'max_elements': 'max_elements', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """HnswConfig - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ef_construction (int): [optional] if omitted the server will use the default value of 500 # noqa: E501 - ef (int): [optional] if omitted the server will use the default value of 250 # noqa: E501 - m (int): [optional] if omitted the server will use the default value of 12 # noqa: E501 - max_elements (int): [optional] if omitted the server will use the default value of 50000000 # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, *args, **kwargs): # noqa: E501 - """HnswConfig - a model defined in OpenAPI - - Keyword Args: - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - ef_construction (int): [optional] if omitted the server will use the default value of 500 # noqa: E501 - ef (int): [optional] if omitted the server will use the default value of 250 # noqa: E501 - m (int): [optional] if omitted the server will use the default value of 12 # noqa: E501 - max_elements (int): [optional] if omitted the server will use the default value of 50000000 # noqa: E501 - """ - - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_dimension.py b/pinecone/core/client/model/index_dimension.py new file mode 100644 index 000000000..d6372eb12 --- /dev/null +++ b/pinecone/core/client/model/index_dimension.py @@ -0,0 +1,288 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class IndexDimension(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('value',): { + 'inclusive_maximum': 20000, + 'inclusive_minimum': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (int,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """IndexDimension - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The dimensions of the vectors to be inserted in the index. # noqa: E501 + + Keyword Args: + value (int): The dimensions of the vectors to be inserted in the index. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """IndexDimension - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The dimensions of the vectors to be inserted in the index. # noqa: E501 + + Keyword Args: + value (int): The dimensions of the vectors to be inserted in the index. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/approximated_config.py b/pinecone/core/client/model/index_list.py similarity index 91% rename from pinecone/core/client/model/approximated_config.py rename to pinecone/core/client/model/index_list.py index 9e881a945..a75628d53 100644 --- a/pinecone/core/client/model/approximated_config.py +++ b/pinecone/core/client/model/index_list.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -30,8 +29,12 @@ from pinecone.core.client.exceptions import ApiAttributeError +def lazy_import(): + from pinecone.core.client.model.index_model import IndexModel + globals()['IndexModel'] = IndexModel -class ApproximatedConfig(ModelNormal): + +class IndexList(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -67,6 +70,7 @@ def additional_properties_type(): This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ + lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -81,9 +85,9 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ + lazy_import() return { - 'k_bits': (int,), # noqa: E501 - 'hybrid': (bool,), # noqa: E501 + 'indexes': ([IndexModel],), # noqa: E501 } @cached_property @@ -92,8 +96,7 @@ def discriminator(): attribute_map = { - 'k_bits': 'k_bits', # noqa: E501 - 'hybrid': 'hybrid', # noqa: E501 + 'indexes': 'indexes', # noqa: E501 } read_only_vars = { @@ -104,7 +107,7 @@ def discriminator(): @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 - """ApproximatedConfig - a model defined in OpenAPI + """IndexList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -137,8 +140,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - k_bits (int): [optional] if omitted the server will use the default value of 512 # noqa: E501 - hybrid (bool): [optional] if omitted the server will use the default value of False # noqa: E501 + indexes ([IndexModel]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) @@ -187,7 +189,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 - """ApproximatedConfig - a model defined in OpenAPI + """IndexList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -220,8 +222,7 @@ def __init__(self, *args, **kwargs): # noqa: E501 Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) - k_bits (int): [optional] if omitted the server will use the default value of 512 # noqa: E501 - hybrid (bool): [optional] if omitted the server will use the default value of False # noqa: E501 + indexes ([IndexModel]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/pinecone/core/client/model/index_meta_database.py b/pinecone/core/client/model/index_meta_database.py deleted file mode 100644 index 22c9381f7..000000000 --- a/pinecone/core/client/model/index_meta_database.py +++ /dev/null @@ -1,310 +0,0 @@ -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by: https://openapi-generator.tech -""" - - -import re # noqa: F401 -import sys # noqa: F401 - -from pinecone.core.client.model_utils import ( # noqa: F401 - ApiTypeError, - ModelComposed, - ModelNormal, - ModelSimple, - cached_property, - change_keys_js_to_python, - convert_js_args_to_python_args, - date, - datetime, - file_type, - none_type, - validate_get_composed_info, -) -from ..model_utils import OpenApiModel -from pinecone.core.client.exceptions import ApiAttributeError - - - -class IndexMetaDatabase(ModelNormal): - """NOTE: This class is auto generated by OpenAPI Generator. - Ref: https://openapi-generator.tech - - Do not edit the class manually. - - Attributes: - allowed_values (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - with a capitalized key describing the allowed value and an allowed - value. These dicts store the allowed enum values. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - discriminator_value_class_map (dict): A dict to go from the discriminator - variable value to the discriminator class name. - validations (dict): The key is the tuple path to the attribute - and the for var_name this is (var_name,). The value is a dict - that stores validations for max_length, min_length, max_items, - min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, - inclusive_minimum, and regex. - additional_properties_type (tuple): A tuple of classes accepted - as additional properties values. - """ - - allowed_values = { - } - - validations = { - } - - @cached_property - def additional_properties_type(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - """ - return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 - - _nullable = False - - @cached_property - def openapi_types(): - """ - This must be a method because a model may have properties that are - of type self, this must run after the class is loaded - - Returns - openapi_types (dict): The key is attribute name - and the value is attribute type. - """ - return { - 'name': (str,), # noqa: E501 - 'dimension': (int,), # noqa: E501 - 'capacity_mode': (str,), # noqa: E501 - 'metric': (str,), # noqa: E501 - 'index_type': (str,), # noqa: E501 - 'pods': (int,), # noqa: E501 - 'replicas': (int,), # noqa: E501 - 'shards': (int,), # noqa: E501 - 'pod_type': (str,), # noqa: E501 - 'index_config': (dict,), # noqa: E501 - 'metadata_config': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 - } - - @cached_property - def discriminator(): - return None - - - attribute_map = { - 'name': 'name', # noqa: E501 - 'dimension': 'dimension', # noqa: E501 - 'capacity_mode': 'capacity_mode', # noqa: E501 - 'metric': 'metric', # noqa: E501 - 'index_type': 'index_type', # noqa: E501 - 'pods': 'pods', # noqa: E501 - 'replicas': 'replicas', # noqa: E501 - 'shards': 'shards', # noqa: E501 - 'pod_type': 'pod_type', # noqa: E501 - 'index_config': 'index_config', # noqa: E501 - 'metadata_config': 'metadata_config', # noqa: E501 - } - - read_only_vars = { - } - - _composed_schemas = {} - - @classmethod - @convert_js_args_to_python_args - def _from_openapi_data(cls, name, dimension, capacity_mode, *args, **kwargs): # noqa: E501 - """IndexMetaDatabase - a model defined in OpenAPI - - Args: - name (str): - dimension (int): - capacity_mode (str): - - Keyword Args: - metric (str): defaults to "cosine" # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - index_type (str): [optional] # noqa: E501 - pods (int): [optional] # noqa: E501 - replicas (int): [optional] # noqa: E501 - shards (int): [optional] # noqa: E501 - pod_type (str): [optional] # noqa: E501 - index_config (dict): [optional] # noqa: E501 - metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 - """ - - metric = kwargs.get('metric', "cosine") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - self = super(OpenApiModel, cls).__new__(cls) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.dimension = dimension - self.capacity_mode = capacity_mode - self.metric = metric - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - return self - - required_properties = set([ - '_data_store', - '_check_type', - '_spec_property_naming', - '_path_to_item', - '_configuration', - '_visited_composed_classes', - ]) - - @convert_js_args_to_python_args - def __init__(self, name, dimension, capacity_mode, *args, **kwargs): # noqa: E501 - """IndexMetaDatabase - a model defined in OpenAPI - - Args: - name (str): - dimension (int): - capacity_mode (str): - - Keyword Args: - metric (str): defaults to "cosine" # noqa: E501 - _check_type (bool): if True, values for parameters in openapi_types - will be type checked and a TypeError will be - raised if the wrong type is input. - Defaults to True - _path_to_item (tuple/list): This is a list of keys or values to - drill down to the model in received_data - when deserializing a response - _spec_property_naming (bool): True if the variable names in the input data - are serialized names, as specified in the OpenAPI document. - False if the variable names in the input data - are pythonic names, e.g. snake case (default) - _configuration (Configuration): the instance to use when - deserializing a file_type parameter. - If passed, type conversion is attempted - If omitted no type conversion is done. - _visited_composed_classes (tuple): This stores a tuple of - classes that we have traveled through so that - if we see that class again we will not use its - discriminator again. - When traveling through a discriminator, the - composed schema that is - is traveled through is added to this set. - For example if Animal has a discriminator - petType and we pass in "Dog", and the class Dog - allOf includes Animal, we move through Animal - once using the discriminator, and pick Dog. - Then in Dog, we will make an instance of the - Animal class but this time we won't travel - through its discriminator because we passed in - _visited_composed_classes = (Animal,) - index_type (str): [optional] # noqa: E501 - pods (int): [optional] # noqa: E501 - replicas (int): [optional] # noqa: E501 - shards (int): [optional] # noqa: E501 - pod_type (str): [optional] # noqa: E501 - index_config (dict): [optional] # noqa: E501 - metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 - """ - - metric = kwargs.get('metric', "cosine") - _check_type = kwargs.pop('_check_type', True) - _spec_property_naming = kwargs.pop('_spec_property_naming', False) - _path_to_item = kwargs.pop('_path_to_item', ()) - _configuration = kwargs.pop('_configuration', None) - _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) - - if args: - raise ApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( - args, - self.__class__.__name__, - ), - path_to_item=_path_to_item, - valid_classes=(self.__class__,), - ) - - self._data_store = {} - self._check_type = _check_type - self._spec_property_naming = _spec_property_naming - self._path_to_item = _path_to_item - self._configuration = _configuration - self._visited_composed_classes = _visited_composed_classes + (self.__class__,) - - self.name = name - self.dimension = dimension - self.capacity_mode = capacity_mode - self.metric = metric - for var_name, var_value in kwargs.items(): - if var_name not in self.attribute_map and \ - self._configuration is not None and \ - self._configuration.discard_unknown_keys and \ - self.additional_properties_type is None: - # discard variable. - continue - setattr(self, var_name, var_value) - if var_name in self.read_only_vars: - raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_metric.py b/pinecone/core/client/model/index_metric.py new file mode 100644 index 000000000..989d34f0c --- /dev/null +++ b/pinecone/core/client/model/index_metric.py @@ -0,0 +1,289 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class IndexMetric(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('value',): { + 'COSINE': "cosine", + 'EUCLIDEAN': "euclidean", + 'DOTPRODUCT': "dotproduct", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """IndexMetric - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.., must be one of ["cosine", "euclidean", "dotproduct", ] # noqa: E501 + + Keyword Args: + value (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.., must be one of ["cosine", "euclidean", "dotproduct", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """IndexMetric - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.., must be one of ["cosine", "euclidean", "dotproduct", ] # noqa: E501 + + Keyword Args: + value (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.., must be one of ["cosine", "euclidean", "dotproduct", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/index_model.py b/pinecone/core/client/model/index_model.py new file mode 100644 index 000000000..eb3eeab5f --- /dev/null +++ b/pinecone/core/client/model/index_model.py @@ -0,0 +1,297 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + +def lazy_import(): + from pinecone.core.client.model.index_dimension import IndexDimension + from pinecone.core.client.model.index_metric import IndexMetric + from pinecone.core.client.model.index_model_spec import IndexModelSpec + from pinecone.core.client.model.index_model_status import IndexModelStatus + globals()['IndexDimension'] = IndexDimension + globals()['IndexMetric'] = IndexMetric + globals()['IndexModelSpec'] = IndexModelSpec + globals()['IndexModelStatus'] = IndexModelStatus + + +class IndexModel(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'name': (str,), # noqa: E501 + 'dimension': (IndexDimension,), # noqa: E501 + 'metric': (IndexMetric,), # noqa: E501 + 'spec': (IndexModelSpec,), # noqa: E501 + 'status': (IndexModelStatus,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'dimension': 'dimension', # noqa: E501 + 'metric': 'metric', # noqa: E501 + 'spec': 'spec', # noqa: E501 + 'status': 'status', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, name, dimension, metric, spec, status, *args, **kwargs): # noqa: E501 + """IndexModel - a model defined in OpenAPI + + Args: + name (str): The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + dimension (IndexDimension): + metric (IndexMetric): + spec (IndexModelSpec): + status (IndexModelStatus): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.name = name + self.dimension = dimension + self.metric = metric + self.spec = spec + self.status = status + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, name, dimension, metric, spec, status, *args, **kwargs): # noqa: E501 + """IndexModel - a model defined in OpenAPI + + Args: + name (str): The name of the index. The maximum length is 45 characters. It may contain lowercase alphanumeric characters or hyphens, and must not begin or end with a hyphen. + dimension (IndexDimension): + metric (IndexMetric): + spec (IndexModelSpec): + status (IndexModelStatus): + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.name = name + self.dimension = dimension + self.metric = metric + self.spec = spec + self.status = status + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_model_spec.py b/pinecone/core/client/model/index_model_spec.py new file mode 100644 index 000000000..1a15d873f --- /dev/null +++ b/pinecone/core/client/model/index_model_spec.py @@ -0,0 +1,267 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + +def lazy_import(): + from pinecone.core.client.model.pod_spec import PodSpec + from pinecone.core.client.model.serverless_spec import ServerlessSpec + globals()['PodSpec'] = PodSpec + globals()['ServerlessSpec'] = ServerlessSpec + + +class IndexModelSpec(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'pod': (PodSpec,), # noqa: E501 + 'serverless': (ServerlessSpec,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'pod': 'pod', # noqa: E501 + 'serverless': 'serverless', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """IndexModelSpec - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + pod (PodSpec): [optional] # noqa: E501 + serverless (ServerlessSpec): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """IndexModelSpec - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + pod (PodSpec): [optional] # noqa: E501 + serverless (ServerlessSpec): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_meta_status.py b/pinecone/core/client/model/index_model_status.py similarity index 92% rename from pinecone/core/client/model/index_meta_status.py rename to pinecone/core/client/model/index_model_status.py index 43c28a839..7ec7ca4ee 100644 --- a/pinecone/core/client/model/index_meta_status.py +++ b/pinecone/core/client/model/index_model_status.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -31,7 +30,7 @@ -class IndexMetaStatus(ModelNormal): +class IndexModelStatus(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -94,8 +93,6 @@ def openapi_types(): return { 'ready': (bool,), # noqa: E501 'state': (str,), # noqa: E501 - 'host': (str,), # noqa: E501 - 'port': (int,), # noqa: E501 } @cached_property @@ -106,8 +103,6 @@ def discriminator(): attribute_map = { 'ready': 'ready', # noqa: E501 'state': 'state', # noqa: E501 - 'host': 'host', # noqa: E501 - 'port': 'port', # noqa: E501 } read_only_vars = { @@ -117,14 +112,12 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, ready, state, host, port, *args, **kwargs): # noqa: E501 - """IndexMetaStatus - a model defined in OpenAPI + def _from_openapi_data(cls, ready, state, *args, **kwargs): # noqa: E501 + """IndexModelStatus - a model defined in OpenAPI Args: ready (bool): state (str): - host (str): - port (int): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -186,8 +179,6 @@ def _from_openapi_data(cls, ready, state, host, port, *args, **kwargs): # noqa: self.ready = ready self.state = state - self.host = host - self.port = port for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -208,14 +199,12 @@ def _from_openapi_data(cls, ready, state, host, port, *args, **kwargs): # noqa: ]) @convert_js_args_to_python_args - def __init__(self, ready, state, host, port, *args, **kwargs): # noqa: E501 - """IndexMetaStatus - a model defined in OpenAPI + def __init__(self, ready, state, *args, **kwargs): # noqa: E501 + """IndexModelStatus - a model defined in OpenAPI Args: ready (bool): state (str): - host (str): - port (int): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -275,8 +264,6 @@ def __init__(self, ready, state, host, port, *args, **kwargs): # noqa: E501 self.ready = ready self.state = state - self.host = host - self.port = port for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ diff --git a/pinecone/core/client/model/namespace_summary.py b/pinecone/core/client/model/namespace_summary.py index 33633f796..c42d8b5a7 100644 --- a/pinecone/core/client/model/namespace_summary.py +++ b/pinecone/core/client/model/namespace_summary.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/pod_spec.py b/pinecone/core/client/model/pod_spec.py new file mode 100644 index 000000000..bc54f1514 --- /dev/null +++ b/pinecone/core/client/model/pod_spec.py @@ -0,0 +1,296 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + +def lazy_import(): + from pinecone.core.client.model.pod_spec_metadata_config import PodSpecMetadataConfig + from pinecone.core.client.model.pod_spec_pod_type import PodSpecPodType + from pinecone.core.client.model.pod_spec_replicas import PodSpecReplicas + from pinecone.core.client.model.pod_spec_shards import PodSpecShards + globals()['PodSpecMetadataConfig'] = PodSpecMetadataConfig + globals()['PodSpecPodType'] = PodSpecPodType + globals()['PodSpecReplicas'] = PodSpecReplicas + globals()['PodSpecShards'] = PodSpecShards + + +class PodSpec(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('pods',): { + 'inclusive_minimum': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + lazy_import() + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + lazy_import() + return { + 'environment': (str,), # noqa: E501 + 'replicas': (PodSpecReplicas,), # noqa: E501 + 'shards': (PodSpecShards,), # noqa: E501 + 'pod_type': (PodSpecPodType,), # noqa: E501 + 'pods': (int,), # noqa: E501 + 'metadata_config': (PodSpecMetadataConfig,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'environment': 'environment', # noqa: E501 + 'replicas': 'replicas', # noqa: E501 + 'shards': 'shards', # noqa: E501 + 'pod_type': 'pod_type', # noqa: E501 + 'pods': 'pods', # noqa: E501 + 'metadata_config': 'metadata_config', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, environment, *args, **kwargs): # noqa: E501 + """PodSpec - a model defined in OpenAPI + + Args: + environment (str): The environment where the index is hosted. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + replicas (PodSpecReplicas): [optional] # noqa: E501 + shards (PodSpecShards): [optional] # noqa: E501 + pod_type (PodSpecPodType): [optional] # noqa: E501 + pods (int): The number of pods to be used in the index. This should be equal to `shards` x `replicas`.. [optional] # noqa: E501 + metadata_config (PodSpecMetadataConfig): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.environment = environment + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, environment, *args, **kwargs): # noqa: E501 + """PodSpec - a model defined in OpenAPI + + Args: + environment (str): The environment where the index is hosted. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + replicas (PodSpecReplicas): [optional] # noqa: E501 + shards (PodSpecShards): [optional] # noqa: E501 + pod_type (PodSpecPodType): [optional] # noqa: E501 + pods (int): The number of pods to be used in the index. This should be equal to `shards` x `replicas`.. [optional] # noqa: E501 + metadata_config (PodSpecMetadataConfig): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.environment = environment + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/pod_spec_metadata_config.py b/pinecone/core/client/model/pod_spec_metadata_config.py new file mode 100644 index 000000000..b41a51f3f --- /dev/null +++ b/pinecone/core/client/model/pod_spec_metadata_config.py @@ -0,0 +1,255 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class PodSpecMetadataConfig(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'indexed': ([str],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'indexed': 'indexed', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """PodSpecMetadataConfig - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + indexed ([str]): By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields which should be indexed.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): # noqa: E501 + """PodSpecMetadataConfig - a model defined in OpenAPI + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + indexed ([str]): By default, all metadata is indexed; to change this behavior, use this property to specify an array of metadata fields which should be indexed.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/pod_spec_pod_type.py b/pinecone/core/client/model/pod_spec_pod_type.py new file mode 100644 index 000000000..120642ee3 --- /dev/null +++ b/pinecone/core/client/model/pod_spec_pod_type.py @@ -0,0 +1,290 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class PodSpecPodType(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('value',): { + 'S1.X1': "s1.x1", + 'S1.X2': "s1.x2", + 'S1.X4': "s1.x4", + 'S1.X8': "s1.x8", + 'P1.X1': "p1.x1", + 'P1.X2': "p1.x2", + 'P1.X4': "p1.x4", + 'P1.X8': "p1.x8", + 'P2.X1': "p2.x1", + 'P2.X2': "p2.x2", + 'P2.X4': "p2.x4", + 'P2.X8': "p2.x8", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (str,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """PodSpecPodType - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. if omitted defaults to "p1.x1", must be one of ["s1.x1", "s1.x2", "s1.x4", "s1.x8", "p1.x1", "p1.x2", "p1.x4", "p1.x8", "p2.x1", "p2.x2", "p2.x4", "p2.x8", ] # noqa: E501 + + Keyword Args: + value (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. if omitted defaults to "p1.x1", must be one of ["s1.x1", "s1.x2", "s1.x4", "s1.x8", "p1.x1", "p1.x2", "p1.x4", "p1.x8", "p2.x1", "p2.x2", "p2.x4", "p2.x8", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + value = "p1.x1" + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """PodSpecPodType - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. if omitted defaults to "p1.x1", must be one of ["s1.x1", "s1.x2", "s1.x4", "s1.x8", "p1.x1", "p1.x2", "p1.x4", "p1.x8", "p2.x1", "p2.x2", "p2.x4", "p2.x8", ] # noqa: E501 + + Keyword Args: + value (str): The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. if omitted defaults to "p1.x1", must be one of ["s1.x1", "s1.x2", "s1.x4", "s1.x8", "p1.x1", "p1.x2", "p1.x4", "p1.x8", "p2.x1", "p2.x2", "p2.x4", "p2.x8", ] # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + value = "p1.x1" + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/pod_spec_replicas.py b/pinecone/core/client/model/pod_spec_replicas.py new file mode 100644 index 000000000..44ab8f5ac --- /dev/null +++ b/pinecone/core/client/model/pod_spec_replicas.py @@ -0,0 +1,287 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class PodSpecReplicas(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('value',): { + 'inclusive_minimum': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (int,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """PodSpecReplicas - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.. # noqa: E501 + + Keyword Args: + value (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """PodSpecReplicas - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.. # noqa: E501 + + Keyword Args: + value (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput. Replicas can be scaled up or down as your needs change.. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/pod_spec_shards.py b/pinecone/core/client/model/pod_spec_shards.py new file mode 100644 index 000000000..c434e207f --- /dev/null +++ b/pinecone/core/client/model/pod_spec_shards.py @@ -0,0 +1,287 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class PodSpecShards(ModelSimple): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + } + + validations = { + ('value',): { + 'inclusive_minimum': 1, + }, + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'value': (int,), + } + + @cached_property + def discriminator(): + return None + + + attribute_map = {} + + read_only_vars = set() + + _composed_schemas = None + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs): + """PodSpecShards - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. # noqa: E501 + + Keyword Args: + value (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): + """PodSpecShards - a model defined in OpenAPI + + Note that value can be passed either in args or in kwargs, but not in both. + + Args: + args[0] (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. # noqa: E501 + + Keyword Args: + value (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. # noqa: E501 + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + # required up here when default value is not given + _path_to_item = kwargs.pop('_path_to_item', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if 'value' in kwargs: + value = kwargs.pop('value') + elif args: + args = list(args) + value = args.pop(0) + else: + raise ApiTypeError( + "value is required, but not passed in args or kwargs and doesn't have default", + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + self.value = value + if kwargs: + raise ApiTypeError( + "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( + kwargs, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + return self diff --git a/pinecone/core/client/model/protobuf_any.py b/pinecone/core/client/model/protobuf_any.py index 365f5064c..fb46af753 100644 --- a/pinecone/core/client/model/protobuf_any.py +++ b/pinecone/core/client/model/protobuf_any.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/protobuf_null_value.py b/pinecone/core/client/model/protobuf_null_value.py index 63129117d..83e635111 100644 --- a/pinecone/core/client/model/protobuf_null_value.py +++ b/pinecone/core/client/model/protobuf_null_value.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/query_request.py b/pinecone/core/client/model/query_request.py index 774d06f73..e5a209480 100644 --- a/pinecone/core/client/model/query_request.py +++ b/pinecone/core/client/model/query_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/query_response.py b/pinecone/core/client/model/query_response.py index 886c93000..49e28d999 100644 --- a/pinecone/core/client/model/query_response.py +++ b/pinecone/core/client/model/query_response.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/query_vector.py b/pinecone/core/client/model/query_vector.py index b7220d5d9..62c5bb713 100644 --- a/pinecone/core/client/model/query_vector.py +++ b/pinecone/core/client/model/query_vector.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/rpc_status.py b/pinecone/core/client/model/rpc_status.py index 30ff15f95..aa3f851e9 100644 --- a/pinecone/core/client/model/rpc_status.py +++ b/pinecone/core/client/model/rpc_status.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/scored_vector.py b/pinecone/core/client/model/scored_vector.py index 88cd807db..69828a242 100644 --- a/pinecone/core/client/model/scored_vector.py +++ b/pinecone/core/client/model/scored_vector.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/serverless_spec.py b/pinecone/core/client/model/serverless_spec.py new file mode 100644 index 000000000..af9792912 --- /dev/null +++ b/pinecone/core/client/model/serverless_spec.py @@ -0,0 +1,272 @@ +""" + Pineonce.io Public API + + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 + + The version of the OpenAPI document: 1.0 + Generated by: https://openapi-generator.tech +""" + + +import re # noqa: F401 +import sys # noqa: F401 + +from pinecone.core.client.model_utils import ( # noqa: F401 + ApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from ..model_utils import OpenApiModel +from pinecone.core.client.exceptions import ApiAttributeError + + + +class ServerlessSpec(ModelNormal): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + + Attributes: + allowed_values (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + with a capitalized key describing the allowed value and an allowed + value. These dicts store the allowed enum values. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + validations (dict): The key is the tuple path to the attribute + and the for var_name this is (var_name,). The value is a dict + that stores validations for max_length, min_length, max_items, + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, + inclusive_minimum, and regex. + additional_properties_type (tuple): A tuple of classes accepted + as additional properties values. + """ + + allowed_values = { + ('cloud',): { + 'GCP': "gcp", + 'AWS': "aws", + 'AZURE': "azure", + }, + } + + validations = { + } + + @cached_property + def additional_properties_type(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + """ + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_property + def openapi_types(): + """ + This must be a method because a model may have properties that are + of type self, this must run after the class is loaded + + Returns + openapi_types (dict): The key is attribute name + and the value is attribute type. + """ + return { + 'cloud': (str,), # noqa: E501 + 'region': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'cloud': 'cloud', # noqa: E501 + 'region': 'region', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, cloud, region, *args, **kwargs): # noqa: E501 + """ServerlessSpec - a model defined in OpenAPI + + Args: + cloud (str): The public cloud where you would like your index hosted + region (str): The region where you would like your index to be created. Different cloud providers have different regions available. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.cloud = cloud + self.region = region + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + required_properties = set([ + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, cloud, region, *args, **kwargs): # noqa: E501 + """ServerlessSpec - a model defined in OpenAPI + + Args: + cloud (str): The public cloud where you would like your index hosted + region (str): The region where you would like your index to be created. Different cloud providers have different regions available. + + Keyword Args: + _check_type (bool): if True, values for parameters in openapi_types + will be type checked and a TypeError will be + raised if the wrong type is input. + Defaults to True + _path_to_item (tuple/list): This is a list of keys or values to + drill down to the model in received_data + when deserializing a response + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) + _configuration (Configuration): the instance to use when + deserializing a file_type parameter. + If passed, type conversion is attempted + If omitted no type conversion is done. + _visited_composed_classes (tuple): This stores a tuple of + classes that we have traveled through so that + if we see that class again we will not use its + discriminator again. + When traveling through a discriminator, the + composed schema that is + is traveled through is added to this set. + For example if Animal has a discriminator + petType and we pass in "Dog", and the class Dog + allOf includes Animal, we move through Animal + once using the discriminator, and pick Dog. + Then in Dog, we will make an instance of the + Animal class but this time we won't travel + through its discriminator because we passed in + _visited_composed_classes = (Animal,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + if args: + raise ApiTypeError( + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( + args, + self.__class__.__name__, + ), + path_to_item=_path_to_item, + valid_classes=(self.__class__,), + ) + + self._data_store = {} + self._check_type = _check_type + self._spec_property_naming = _spec_property_naming + self._path_to_item = _path_to_item + self._configuration = _configuration + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) + + self.cloud = cloud + self.region = region + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/single_query_results.py b/pinecone/core/client/model/single_query_results.py index 0c7415621..9fe8c4313 100644 --- a/pinecone/core/client/model/single_query_results.py +++ b/pinecone/core/client/model/single_query_results.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/sparse_values.py b/pinecone/core/client/model/sparse_values.py index 4d619531a..62374846e 100644 --- a/pinecone/core/client/model/sparse_values.py +++ b/pinecone/core/client/model/sparse_values.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/update_request.py b/pinecone/core/client/model/update_request.py index 1aec2bd88..3fb151e8c 100644 --- a/pinecone/core/client/model/update_request.py +++ b/pinecone/core/client/model/update_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/upsert_request.py b/pinecone/core/client/model/upsert_request.py index 0ebf0aaed..5e20e01ee 100644 --- a/pinecone/core/client/model/upsert_request.py +++ b/pinecone/core/client/model/upsert_request.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/upsert_response.py b/pinecone/core/client/model/upsert_response.py index 831fb39bb..3a0c766cc 100644 --- a/pinecone/core/client/model/upsert_response.py +++ b/pinecone/core/client/model/upsert_response.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model/vector.py b/pinecone/core/client/model/vector.py index e3aef790a..7c94ea867 100644 --- a/pinecone/core/client/model/vector.py +++ b/pinecone/core/client/model/vector.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/model_utils.py b/pinecone/core/client/model_utils.py index 940cc93a1..f07308a93 100644 --- a/pinecone/core/client/model_utils.py +++ b/pinecone/core/client/model_utils.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ diff --git a/pinecone/core/client/models/__init__.py b/pinecone/core/client/models/__init__.py index b514eb36f..8cb83d215 100644 --- a/pinecone/core/client/models/__init__.py +++ b/pinecone/core/client/models/__init__.py @@ -9,22 +9,33 @@ # import sys # sys.setrecursionlimit(n) -from pinecone.core.client.model.approximated_config import ApproximatedConfig -from pinecone.core.client.model.collection_meta import CollectionMeta +from pinecone.core.client.model.aws_regions import AwsRegions +from pinecone.core.client.model.collection_list import CollectionList +from pinecone.core.client.model.collection_model import CollectionModel +from pinecone.core.client.model.configure_index_request import ConfigureIndexRequest +from pinecone.core.client.model.configure_index_request_spec import ConfigureIndexRequestSpec +from pinecone.core.client.model.configure_index_request_spec_pod import ConfigureIndexRequestSpecPod from pinecone.core.client.model.create_collection_request import CreateCollectionRequest -from pinecone.core.client.model.create_request import CreateRequest +from pinecone.core.client.model.create_index_request import CreateIndexRequest from pinecone.core.client.model.delete_request import DeleteRequest from pinecone.core.client.model.describe_index_stats_request import DescribeIndexStatsRequest from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse +from pinecone.core.client.model.error_response import ErrorResponse +from pinecone.core.client.model.error_response_error import ErrorResponseError from pinecone.core.client.model.fetch_response import FetchResponse -from pinecone.core.client.model.hnsw_config import HnswConfig -from pinecone.core.client.model.index_list_meta import IndexListMeta -from pinecone.core.client.model.index_meta import IndexMeta -from pinecone.core.client.model.index_meta_database import IndexMetaDatabase -from pinecone.core.client.model.index_meta_status import IndexMetaStatus -from pinecone.core.client.model.inline_response200 import InlineResponse200 +from pinecone.core.client.model.gcp_regions import GcpRegions +from pinecone.core.client.model.index_dimension import IndexDimension +from pinecone.core.client.model.index_list import IndexList +from pinecone.core.client.model.index_metric import IndexMetric +from pinecone.core.client.model.index_model import IndexModel +from pinecone.core.client.model.index_model_spec import IndexModelSpec +from pinecone.core.client.model.index_model_status import IndexModelStatus from pinecone.core.client.model.namespace_summary import NamespaceSummary -from pinecone.core.client.model.patch_request import PatchRequest +from pinecone.core.client.model.pod_spec import PodSpec +from pinecone.core.client.model.pod_spec_metadata_config import PodSpecMetadataConfig +from pinecone.core.client.model.pod_spec_pod_type import PodSpecPodType +from pinecone.core.client.model.pod_spec_replicas import PodSpecReplicas +from pinecone.core.client.model.pod_spec_shards import PodSpecShards from pinecone.core.client.model.protobuf_any import ProtobufAny from pinecone.core.client.model.protobuf_null_value import ProtobufNullValue from pinecone.core.client.model.query_request import QueryRequest @@ -32,6 +43,7 @@ from pinecone.core.client.model.query_vector import QueryVector from pinecone.core.client.model.rpc_status import RpcStatus from pinecone.core.client.model.scored_vector import ScoredVector +from pinecone.core.client.model.serverless_spec import ServerlessSpec from pinecone.core.client.model.single_query_results import SingleQueryResults from pinecone.core.client.model.sparse_values import SparseValues from pinecone.core.client.model.update_request import UpdateRequest diff --git a/pinecone/core/client/rest.py b/pinecone/core/client/rest.py index 8a9aafcb6..eed678cbf 100644 --- a/pinecone/core/client/rest.py +++ b/pinecone/core/client/rest.py @@ -1,10 +1,9 @@ """ - Pinecone API + Pineonce.io Public API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. # noqa: E501 - The version of the OpenAPI document: version not set - Contact: support@pinecone.io + The version of the OpenAPI document: 1.0 Generated by: https://openapi-generator.tech """ @@ -14,6 +13,7 @@ import logging import re import ssl +import os from urllib.parse import urlencode import urllib3 @@ -21,6 +21,17 @@ from pinecone.core.client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError +class bcolors: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKCYAN = '\033[96m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + logger = logging.getLogger(__name__) @@ -121,6 +132,20 @@ def request(self, method, url, query_params=None, headers=None, assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] + if os.environ.get('PINECONE_DEBUG_CURL'): + formatted_headers = ' '.join(["-H '{0}: {1}'".format(k, v) + for k, v in headers.items()]) + formatted_query = urlencode(query_params) + if formatted_query: + formatted_url = f'{url}?{formatted_query}' + else: + formatted_url = url + if body is None: + print(bcolors.OKBLUE + "curl -X {method} '{url}' {formatted_headers}".format(method=method, url=formatted_url, formatted_headers=formatted_headers) + bcolors.ENDC) + else: + formatted_body = json.dumps(body) + print(bcolors.OKBLUE + "curl -X {method} '{url}' {formatted_headers} -d '{data}'".format(method=method, url=formatted_url, formatted_headers=formatted_headers, data=formatted_body) + bcolors.ENDC) + if post_params and body: raise ApiValueError( "body parameter cannot be used with post_params parameter." @@ -204,9 +229,18 @@ def request(self, method, url, query_params=None, headers=None, msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) - if _preload_content: + if os.environ.get('PINECONE_DEBUG_CURL'): r = RESTResponse(r) + if r.status <= 300: + print(bcolors.OKGREEN + r.data.decode('utf-8') + bcolors.ENDC) + else: + print(bcolors.FAIL + r.data.decode('utf-8') + bcolors.ENDC) + + + if _preload_content: + r = RESTResponse(r) + # log response body logger.debug("response body: %s", r.data) diff --git a/pinecone/models/__init__.py b/pinecone/models/__init__.py new file mode 100644 index 000000000..50cb959e0 --- /dev/null +++ b/pinecone/models/__init__.py @@ -0,0 +1,12 @@ +from .index_description import IndexDescription, IndexStatus, PodSpec, PodSpecDefinition, ServerlessSpec, ServerlessSpecDefinition +from .collection_description import CollectionDescription + +__all__ = [ + 'CollectionDescription', + 'IndexDescription', + 'IndexStatus', + 'PodSpec', + 'PodSpecDefinition', + 'ServerlessSpec', + 'ServerlessSpecDefinition' +] \ No newline at end of file diff --git a/pinecone/models/collection_description.py b/pinecone/models/collection_description.py new file mode 100644 index 000000000..44c5f51e0 --- /dev/null +++ b/pinecone/models/collection_description.py @@ -0,0 +1,5 @@ +from typing import NamedTuple + +class CollectionDescription(NamedTuple): + name: str + source: str \ No newline at end of file diff --git a/pinecone/models/index_description.py b/pinecone/models/index_description.py new file mode 100644 index 000000000..8135241d7 --- /dev/null +++ b/pinecone/models/index_description.py @@ -0,0 +1,31 @@ +from typing import NamedTuple, Dict, Optional, Union, Literal + +class IndexStatus(NamedTuple): + state: str + ready: bool + +PodKey = Literal['pod'] +class PodSpecDefinition(NamedTuple): + replicas: int + shards: int + pods: int + pod_type: str + environment: str + metadata_config: Optional[Dict] + +PodSpec = Dict[PodKey, PodSpecDefinition] + +ServerlessKey = Literal['serverless'] +class ServerlessSpecDefinition(NamedTuple): + cloud: str + region: str + +ServerlessSpec = Dict[ServerlessKey, ServerlessSpecDefinition] + +class IndexDescription(NamedTuple): + name: str + dimension: int + metric: str + host: str + spec: Union[PodSpec, ServerlessSpec] + status: IndexStatus diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py new file mode 100644 index 000000000..09bfaba85 --- /dev/null +++ b/tests/integration/conftest.py @@ -0,0 +1,80 @@ +import pytest +from pinecone import Pinecone +from .helpers.helpers import generate_index_name, get_environment_var + +@pytest.fixture() +def client(): + api_key = get_environment_var('PINECONE_API_KEY') + return Pinecone(api_key=api_key) + +@pytest.fixture() +def environment(): + return get_environment_var('PINECONE_ENVIRONMENT') + +@pytest.fixture() +def create_sl_index_params(index_name): + spec = { + 'cloud': 'aws', + 'region': 'us-east1' + } + return dict(name=index_name, dimension=10, metric='cosine', spec=spec, timeout=-1) + +@pytest.fixture() +def create_pod_index_params(index_name, environment): + spec = { + 'environment': environment + } + return dict(name=index_name, dimension=10, metric='cosine', spec=spec, timeout=-1) + +@pytest.fixture() +def index_name(request): + test_name = request.node.name + return generate_index_name(test_name) + +@pytest.fixture() +def ready_sl_index(client, index_name, create_sl_index_params): + del create_sl_index_params['timeout'] + client.create_index(**create_sl_index_params) + yield index_name + client.delete_index(index_name, -1) + +@pytest.fixture() +def notready_sl_index(client, index_name, create_sl_index_params): + client.create_index(**create_sl_index_params) + yield index_name + client.delete_index(index_name, -1) + +@pytest.fixture() +def ready_pod_index(client, index_name, create_pod_index_params): + del create_pod_index_params['timeout'] + client.create_index(**create_pod_index_params) + yield index_name + client.delete_index(index_name, -1) + +@pytest.fixture() +def notready_pod_index(client, index_name, create_pod_index_params): + client.create_index(**create_pod_index_params) + yield index_name + client.delete_index(index_name, -1) + +@pytest.fixture(autouse=True) +def cleanup(client, index_name): + yield + + client.delete_index(index_name, -1) + + try: + client.delete_index(index_name, -1) + except: + pass + +@pytest.fixture(autouse=True, scope='session') +def cleanup_all(): + yield + + client = Pinecone() + for index in client.list_indexes().databases: + try: + client.delete_index(index.name, -1) + except: + pass \ No newline at end of file diff --git a/tests/integration/helpers/__init__.py b/tests/integration/helpers/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/integration/helpers/helpers.py b/tests/integration/helpers/helpers.py new file mode 100644 index 000000000..1e40f6fac --- /dev/null +++ b/tests/integration/helpers/helpers.py @@ -0,0 +1,45 @@ +import re +import os +import random +import string + +def random_string(length): + return ''.join(random.choice(string.ascii_lowercase) for i in range(length)) + +def generate_index_name(test_name: str) -> str: + buildNumber = os.getenv('GITHUB_BUILD_NUMBER', None) + + if test_name.startswith('test_'): + test_name = test_name[5:] + + # Trim name length to save space for other info in name + test_name = test_name[:20] + + # Remove trailing underscore, if any + if test_name.endswith('_'): + test_name = test_name[:-1] + + name_parts = [buildNumber, test_name, random_string(45)] + index_name = '-'.join([x for x in name_parts if x is not None]) + + # Remove invalid characters + replace_with_hyphen = re.compile(r'[\[\(_,\s]') + index_name = re.sub(replace_with_hyphen, '-', index_name) + replace_with_empty = re.compile(r'[\]\)\.]') + index_name = re.sub(replace_with_empty, '', index_name) + + max_length = 45 + index_name = index_name[:max_length] + + # Trim final character if it is not alphanumeric + if test_name.endswith('_') or test_name.endswith('-'): + test_name = test_name[:-1] + + return index_name.lower() + +def get_environment_var(name: str) -> str: + val = os.getenv(name) + if (val is None): + raise Exception('Expected environment variable ' + name + ' is not set') + else: + return val diff --git a/tests/integration/test_collections.py b/tests/integration/test_collections.py new file mode 100644 index 000000000..976724540 --- /dev/null +++ b/tests/integration/test_collections.py @@ -0,0 +1,39 @@ +import pytest +from pinecone import CollectionDescription + +@pytest.mark.skip() +class TestCollection: + def test_create_collection_from_ready_index_w_data(self, client, ready_index): + index = client.Index(ready_index) + index.upsert([{'id': '1', 'values': [0.1, 0.2]}]) + + name = 'test_collection' + client.create_collection(name, ready_index) + desc = client.describe_collection(name) + assert type(desc) == CollectionDescription + assert desc.name == name + assert desc.index == ready_index + + client.delete_collection(name) + + def test_create_collection_from_ready_index_w_no_data(self, client, ready_index): + name = 'test_collection' + client.create_collection(name, ready_index) + desc = client.describe_collection(name) + assert type(desc) == CollectionDescription + assert desc.name == name + assert desc.index == ready_index + + client.delete_collection(name) + + def test_create_collection_from_not_ready_index(self, client, notready_index): + name = 'test_collection' + with pytest.raises(Exception) as e: + client.create_collection(name, notready_index) + assert 'Index is not ready' in str(e.value) + + def test_create_collection_with_invalid_index(self, client): + name = 'test_collection' + with pytest.raises(Exception) as e: + client.create_collection(name, 'invalid_index') + assert 'Index not found' in str(e.value) \ No newline at end of file diff --git a/tests/integration/test_create_index_api_errors.py b/tests/integration/test_create_index_api_errors.py new file mode 100644 index 000000000..1e7f56a7b --- /dev/null +++ b/tests/integration/test_create_index_api_errors.py @@ -0,0 +1,31 @@ +import pytest +from pinecone import ApiException + +class TestCreateIndexApiErrorCases: + def test_create_index_with_invalid_name(self, client, create_index_params): + create_index_params['name'] = '-invalid-name' + with pytest.raises(ApiException): + client.create_index(**create_index_params) + + def test_create_index_invalid_metric(self, client, create_index_params): + create_index_params['metric'] = 'invalid' + with pytest.raises(ApiException): + client.create_index(**create_index_params) + + def test_create_index_with_invalid_neg_dimension(self, client, create_index_params): + create_index_params['dimension'] = -1 + with pytest.raises(ApiException): + client.create_index(**create_index_params) + + def test_create_index_that_already_exists(self, client, create_index_params): + client.create_index(**create_index_params) + with pytest.raises(ApiException): + client.create_index(**create_index_params) + + @pytest.mark.skip(reason='Bug filed https://app.asana.com/0/1205078872348810/1205917627868143') + def test_create_index_w_incompatible_options(self, client, create_index_params): + create_index_params['pod_type'] = 'p1.x2' + create_index_params['environment'] = 'us-east1-gcp' + create_index_params['replicas'] = 2 + with pytest.raises(ApiException): + client.create_index(**create_index_params) \ No newline at end of file diff --git a/tests/integration/test_create_index_happy_path.py b/tests/integration/test_create_index_happy_path.py new file mode 100644 index 000000000..4b813912e --- /dev/null +++ b/tests/integration/test_create_index_happy_path.py @@ -0,0 +1,18 @@ +import pytest + +class TestCreateSLIndexHappyPath: + def test_create_index(self, client, create_sl_index_params): + name = create_sl_index_params['name'] + dimension = create_sl_index_params['dimension'] + client.create_index(**create_sl_index_params) + desc = client.describe_index(name) + assert desc.name == name + assert desc.dimension == dimension + assert desc.metric == 'cosine' + + @pytest.mark.parametrize('metric', ['cosine', 'euclidean', 'dotproduct']) + def test_create_index_with_metric(self, client, create_sl_index_params, metric): + create_sl_index_params['metric'] = metric + client.create_index(**create_sl_index_params) + desc = client.describe_index(create_sl_index_params['name']) + assert desc.metric == metric \ No newline at end of file diff --git a/tests/integration/test_create_index_timeouts.py b/tests/integration/test_create_index_timeouts.py new file mode 100644 index 000000000..e9d5b4137 --- /dev/null +++ b/tests/integration/test_create_index_timeouts.py @@ -0,0 +1,28 @@ +import pytest + +class TestCreateIndexWithTimeout: + def test_create_index_default_timeout(self, client, create_sl_index_params): + del create_sl_index_params['timeout'] + client.create_index(**create_sl_index_params) + # Waits infinitely for index to be ready + desc = client.describe_index(create_sl_index_params['name']) + assert desc.status.ready == True + + def test_create_index_when_timeout_set(self, client, create_sl_index_params): + create_sl_index_params['timeout'] = 1000 # effectively infinite, but different code path from None + client.create_index(**create_sl_index_params) + desc = client.describe_index(create_sl_index_params['name']) + assert desc.status.ready == True + + def test_create_index_when_timeout_error(self, client, create_sl_index_params): + create_sl_index_params['timeout'] = 1 + with pytest.raises(TimeoutError): + client.create_index(**create_sl_index_params) + + def test_create_index_with_negative_timeout(self, client, create_sl_index_params): + create_sl_index_params['timeout'] = -1 + client.create_index(**create_sl_index_params) + desc = client.describe_index(create_sl_index_params['name']) + # Returns immediately without waiting for index to be ready + assert desc.status.ready == False + diff --git a/tests/integration/test_create_index_type_errors.py b/tests/integration/test_create_index_type_errors.py new file mode 100644 index 000000000..b4f649c07 --- /dev/null +++ b/tests/integration/test_create_index_type_errors.py @@ -0,0 +1,13 @@ +import pytest +from pinecone import ApiTypeError + +class TestCreateIndexTypeErrorCases: + def test_create_index_with_invalid_str_dimension(self, client, create_sl_index_params): + create_sl_index_params['dimension'] = '10' + with pytest.raises(ApiTypeError): + client.create_index(**create_sl_index_params) + + def test_create_index_with_missing_dimension(self, client, create_sl_index_params): + del create_sl_index_params['dimension'] + with pytest.raises(TypeError): + client.create_index(**create_sl_index_params) \ No newline at end of file diff --git a/tests/integration/test_describe_index.py b/tests/integration/test_describe_index.py new file mode 100644 index 000000000..0e1cecb36 --- /dev/null +++ b/tests/integration/test_describe_index.py @@ -0,0 +1,30 @@ +import pytest +from pinecone import IndexDescription + +class TestDescribeIndex: + def test_describe_index_when_ready(self, client, ready_sl_index, create_sl_index_params): + description = client.describe_index(ready_sl_index) + assert type(description) == IndexDescription + assert description.name == ready_sl_index + assert description.dimension == create_sl_index_params['dimension'] + assert description.metric == create_sl_index_params['metric'] + assert description.capacity_mode == create_sl_index_params['capacity_mode'] + + assert type(description.status.host) == str + assert description.status.host != "" + assert description.status.state == 'Ready' + assert ready_sl_index in description.status.host + assert description.status.ready == True + + def test_describe_index_when_not_ready(self, client, notready_sl_index, create_sl_index_params): + description = client.describe_index(notready_sl_index) + + assert type(description) == IndexDescription + assert description.name == notready_sl_index + assert description.dimension == create_sl_index_params['dimension'] + assert description.metric == create_sl_index_params['metric'] + + assert type(description.status.host) == str + assert description.status.host != "" + assert notready_sl_index in description.status.host + assert description.status.ready == False \ No newline at end of file diff --git a/tests/integration/test_list_indexes.py b/tests/integration/test_list_indexes.py new file mode 100644 index 000000000..66fa39e19 --- /dev/null +++ b/tests/integration/test_list_indexes.py @@ -0,0 +1,23 @@ +from pinecone import IndexModel + +class TestListIndexes(): + def test_list_indexes_includes_ready_indexes(self, client, ready_index, create_index_params): + list_response = client.list_indexes() + assert len(list_response.indexes) != 0 + assert type(list_response.indexes[0]) == IndexModel + + created_index = [index for index in list_response.indexes if index.name == ready_index][0] + assert created_index.name == ready_index + assert created_index.dimension == create_index_params['dimension'] + assert created_index.metric == create_index_params['metric'] + assert ready_index in created_index.host + assert created_index.capacity_mode == create_index_params['capacity_mode'] + + def test_list_indexes_includes_not_ready_indexes(self, client, notready_index): + list_response = client.list_indexes() + assert len(list_response.indexes) != 0 + assert type(list_response.indexes[0]) == IndexModel + + created_index = [index for index in list_response.indexes if index.name == notready_index][0] + assert created_index.name == notready_index + assert notready_index in created_index.name diff --git a/tests/unit/test_control.py b/tests/unit/test_control.py index 1d54e736b..1b3e2fc56 100644 --- a/tests/unit/test_control.py +++ b/tests/unit/test_control.py @@ -28,7 +28,7 @@ def test_create_index_with_timeout(self, mocker, timeout_value, describe_index_r mocker.patch.object(p.index_api, 'create_index') mocker.patch('time.sleep') - p.create_index("my-index", 10, timeout=timeout_value, cloud="aws", region="us-west1", capacity_mode="pod") + p.create_serverless_index(name="my-index", dimension=10, cloud="aws", region="us-west1", timeout=timeout_value) assert p.index_api.create_index.call_count == 1 assert p.index_api.describe_index.call_count == expected_describe_index_calls @@ -43,4 +43,4 @@ def test_create_index_when_timeout_exceeded(self, mocker): mocker.patch.object(p.index_api, 'describe_index', side_effect=describe_index_response) mocker.patch('time.sleep') - p.create_index("my-index", 10, timeout=10, cloud="aws", region="us-west1", capacity_mode="pod") + p.create_pod_index(name="my-index", dimension=10, timeout=10, environment="us-west1-gcp")