diff --git a/pinecone/control/pinecone.py b/pinecone/control/pinecone.py index 7091f6235..f39835d22 100644 --- a/pinecone/control/pinecone.py +++ b/pinecone/control/pinecone.py @@ -12,8 +12,6 @@ CreateCollectionRequest, CreateIndexRequest, ConfigureIndexRequest, - IndexMetric, - IndexDimension, ) from pinecone.models import ServerlessSpec, PodSpec, IndexList, CollectionList @@ -80,11 +78,11 @@ def create_index( api_instance = self.index_api if isinstance(spec, dict): - api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=IndexDimension(dimension), metric=IndexMetric(metric), spec=spec)) + api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=dimension, metric=metric, spec=spec)) elif isinstance(spec, ServerlessSpec): - api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=IndexDimension(dimension), metric=IndexMetric(metric), spec=spec.asdict())) + api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=dimension, metric=metric, spec=spec.asdict())) elif isinstance(spec, PodSpec): - api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=IndexDimension(dimension), metric=IndexMetric(metric), spec=spec.asdict())) + api_instance.create_index(create_index_request=CreateIndexRequest(name=name, dimension=dimension, metric=metric, spec=spec.asdict())) def is_ready(): status = self._get_status(name) diff --git a/pinecone/core/client/model/configure_index_request_spec_pod.py b/pinecone/core/client/model/configure_index_request_spec_pod.py index fbfde79c1..809c21c9f 100644 --- a/pinecone/core/client/model/configure_index_request_spec_pod.py +++ b/pinecone/core/client/model/configure_index_request_spec_pod.py @@ -29,12 +29,6 @@ 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 ConfigureIndexRequestSpecPod(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. @@ -61,9 +55,26 @@ class ConfigureIndexRequestSpecPod(ModelNormal): """ allowed_values = { + ('pod_type',): { + '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 = { + ('replicas',): { + 'inclusive_minimum': 1, + }, } @cached_property @@ -72,7 +83,6 @@ 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 @@ -87,10 +97,9 @@ def openapi_types(): openapi_types (dict): The key is attribute name and the value is attribute type. """ - lazy_import() return { - 'replicas': (PodSpecReplicas,), # noqa: E501 - 'pod_type': (PodSpecPodType,), # noqa: E501 + 'replicas': (int,), # noqa: E501 + 'pod_type': (str,), # noqa: E501 } @cached_property @@ -144,8 +153,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 (PodSpecReplicas): [optional] # noqa: E501 - pod_type (PodSpecPodType): [optional] # noqa: E501 + replicas (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.. [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 """ _check_type = kwargs.pop('_check_type', True) @@ -227,8 +236,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 (PodSpecReplicas): [optional] # noqa: E501 - pod_type (PodSpecPodType): [optional] # noqa: E501 + replicas (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.. [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 """ _check_type = kwargs.pop('_check_type', True) diff --git a/pinecone/core/client/model/create_index_request.py b/pinecone/core/client/model/create_index_request.py index d0fd33ce3..1bd0b2a83 100644 --- a/pinecone/core/client/model/create_index_request.py +++ b/pinecone/core/client/model/create_index_request.py @@ -29,12 +29,6 @@ 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 CreateIndexRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. @@ -61,9 +55,18 @@ class CreateIndexRequest(ModelNormal): """ allowed_values = { + ('metric',): { + 'COSINE': "cosine", + 'EUCLIDEAN': "euclidean", + 'DOTPRODUCT': "dotproduct", + }, } validations = { + ('dimension',): { + 'inclusive_maximum': 20000, + 'inclusive_minimum': 1, + }, } @cached_property @@ -72,7 +75,6 @@ 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 @@ -87,12 +89,11 @@ def openapi_types(): 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': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'dimension': (int,), # noqa: E501 + 'metric': (str,), # noqa: E501 + 'spec': (dict,), # noqa: E501 } @cached_property @@ -119,9 +120,9 @@ def _from_openapi_data(cls, name, dimension, metric, spec, *args, **kwargs): # 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 ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Spec objects describe how the index should be deployed + dimension (int): The dimensions of the vectors to be inserted in the index + metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + spec (dict): Spec objects describe how the index should be deployed Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -210,9 +211,9 @@ def __init__(self, name, dimension, metric, spec, *args, **kwargs): # noqa: E50 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 ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Spec objects describe how the index should be deployed + dimension (int): The dimensions of the vectors to be inserted in the index + metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + spec (dict): Spec objects describe how the index should be deployed Keyword Args: _check_type (bool): if True, values for parameters in openapi_types diff --git a/pinecone/core/client/model/index_dimension.py b/pinecone/core/client/model/index_dimension.py deleted file mode 100644 index d6372eb12..000000000 --- a/pinecone/core/client/model/index_dimension.py +++ /dev/null @@ -1,288 +0,0 @@ -""" - 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/index_metric.py b/pinecone/core/client/model/index_metric.py deleted file mode 100644 index 989d34f0c..000000000 --- a/pinecone/core/client/model/index_metric.py +++ /dev/null @@ -1,289 +0,0 @@ -""" - 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 index eb3eeab5f..d7f46e91c 100644 --- a/pinecone/core/client/model/index_model.py +++ b/pinecone/core/client/model/index_model.py @@ -30,12 +30,8 @@ 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 @@ -65,9 +61,18 @@ class IndexModel(ModelNormal): """ allowed_values = { + ('metric',): { + 'COSINE': "cosine", + 'EUCLIDEAN': "euclidean", + 'DOTPRODUCT': "dotproduct", + }, } validations = { + ('dimension',): { + 'inclusive_maximum': 20000, + 'inclusive_minimum': 1, + }, } @cached_property @@ -94,8 +99,9 @@ def openapi_types(): lazy_import() return { 'name': (str,), # noqa: E501 - 'dimension': (IndexDimension,), # noqa: E501 - 'metric': (IndexMetric,), # noqa: E501 + 'dimension': (int,), # noqa: E501 + 'metric': (str,), # noqa: E501 + 'host': (str,), # noqa: E501 'spec': (IndexModelSpec,), # noqa: E501 'status': (IndexModelStatus,), # noqa: E501 } @@ -109,6 +115,7 @@ def discriminator(): 'name': 'name', # noqa: E501 'dimension': 'dimension', # noqa: E501 'metric': 'metric', # noqa: E501 + 'host': 'host', # noqa: E501 'spec': 'spec', # noqa: E501 'status': 'status', # noqa: E501 } @@ -120,13 +127,14 @@ def discriminator(): @classmethod @convert_js_args_to_python_args - def _from_openapi_data(cls, name, dimension, metric, spec, status, *args, **kwargs): # noqa: E501 + def _from_openapi_data(cls, name, dimension, metric, host, 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): + dimension (int): The dimensions of the vectors to be inserted in the index + metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + host (str): The URL address where the index is hosted. spec (IndexModelSpec): status (IndexModelStatus): @@ -191,6 +199,7 @@ def _from_openapi_data(cls, name, dimension, metric, spec, status, *args, **kwar self.name = name self.dimension = dimension self.metric = metric + self.host = host self.spec = spec self.status = status for var_name, var_value in kwargs.items(): @@ -213,13 +222,14 @@ def _from_openapi_data(cls, name, dimension, metric, spec, status, *args, **kwar ]) @convert_js_args_to_python_args - def __init__(self, name, dimension, metric, spec, status, *args, **kwargs): # noqa: E501 + def __init__(self, name, dimension, metric, host, 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): + dimension (int): The dimensions of the vectors to be inserted in the index + metric (str): The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + host (str): The URL address where the index is hosted. spec (IndexModelSpec): status (IndexModelStatus): @@ -282,6 +292,7 @@ def __init__(self, name, dimension, metric, spec, status, *args, **kwargs): # n self.name = name self.dimension = dimension self.metric = metric + self.host = host self.spec = spec self.status = status for var_name, var_value in kwargs.items(): diff --git a/pinecone/core/client/model/pod_spec.py b/pinecone/core/client/model/pod_spec.py index bc54f1514..a8b89cbfe 100644 --- a/pinecone/core/client/model/pod_spec.py +++ b/pinecone/core/client/model/pod_spec.py @@ -31,13 +31,7 @@ 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): @@ -65,9 +59,29 @@ class PodSpec(ModelNormal): """ allowed_values = { + ('pod_type',): { + '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 = { + ('replicas',): { + 'inclusive_minimum': 1, + }, + ('shards',): { + 'inclusive_minimum': 1, + }, ('pods',): { 'inclusive_minimum': 1, }, @@ -97,11 +111,12 @@ def openapi_types(): lazy_import() return { 'environment': (str,), # noqa: E501 - 'replicas': (PodSpecReplicas,), # noqa: E501 - 'shards': (PodSpecShards,), # noqa: E501 - 'pod_type': (PodSpecPodType,), # noqa: E501 + 'replicas': (int,), # noqa: E501 + 'shards': (int,), # noqa: E501 + 'pod_type': (str,), # noqa: E501 'pods': (int,), # noqa: E501 'metadata_config': (PodSpecMetadataConfig,), # noqa: E501 + 'source_collection': (str,), # noqa: E501 } @cached_property @@ -116,6 +131,7 @@ def discriminator(): 'pod_type': 'pod_type', # noqa: E501 'pods': 'pods', # noqa: E501 'metadata_config': 'metadata_config', # noqa: E501 + 'source_collection': 'source_collection', # noqa: E501 } read_only_vars = { @@ -132,6 +148,10 @@ def _from_openapi_data(cls, environment, *args, **kwargs): # noqa: E501 environment (str): The environment where the index is hosted. Keyword Args: + replicas (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.. defaults to 1 # noqa: E501 + shards (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. defaults to 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`.. 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 + pods (int): The number of pods to be used in the index. This should be equal to `shards` x `replicas`.. defaults to 1 # 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. @@ -162,13 +182,14 @@ def _from_openapi_data(cls, environment, *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 (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 + source_collection (str): The name of the collection to be used as the source for the index.. [optional] # noqa: E501 """ + replicas = kwargs.get('replicas', 1) + shards = kwargs.get('shards', 1) + pod_type = kwargs.get('pod_type', "p1.x1") + pods = kwargs.get('pods', 1) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) @@ -195,6 +216,10 @@ def _from_openapi_data(cls, environment, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.environment = environment + self.replicas = replicas + self.shards = shards + self.pod_type = pod_type + self.pods = pods for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ @@ -222,6 +247,10 @@ def __init__(self, environment, *args, **kwargs): # noqa: E501 environment (str): The environment where the index is hosted. Keyword Args: + replicas (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.. defaults to 1 # noqa: E501 + shards (int): The number of shards. Shards split your data across multiple pods so you can fit more data into an index.. defaults to 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`.. 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 + pods (int): The number of pods to be used in the index. This should be equal to `shards` x `replicas`.. defaults to 1 # 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. @@ -252,13 +281,14 @@ def __init__(self, environment, *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 (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 + source_collection (str): The name of the collection to be used as the source for the index.. [optional] # noqa: E501 """ + replicas = kwargs.get('replicas', 1) + shards = kwargs.get('shards', 1) + pod_type = kwargs.get('pod_type', "p1.x1") + pods = kwargs.get('pods', 1) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) @@ -283,6 +313,10 @@ def __init__(self, environment, *args, **kwargs): # noqa: E501 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.environment = environment + self.replicas = replicas + self.shards = shards + self.pod_type = pod_type + self.pods = pods 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/pod_spec_pod_type.py b/pinecone/core/client/model/pod_spec_pod_type.py deleted file mode 100644 index 120642ee3..000000000 --- a/pinecone/core/client/model/pod_spec_pod_type.py +++ /dev/null @@ -1,290 +0,0 @@ -""" - 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 deleted file mode 100644 index 44ab8f5ac..000000000 --- a/pinecone/core/client/model/pod_spec_replicas.py +++ /dev/null @@ -1,287 +0,0 @@ -""" - 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 deleted file mode 100644 index c434e207f..000000000 --- a/pinecone/core/client/model/pod_spec_shards.py +++ /dev/null @@ -1,287 +0,0 @@ -""" - 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/serverless_spec.py b/pinecone/core/client/model/serverless_spec.py index af9792912..1fd00c6d0 100644 --- a/pinecone/core/client/model/serverless_spec.py +++ b/pinecone/core/client/model/serverless_spec.py @@ -112,7 +112,7 @@ def _from_openapi_data(cls, cloud, region, *args, **kwargs): # noqa: E501 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. + region (str): The region where you would like your index to be created. Different cloud providers have different regions available. See AwsRegions and GcpRegions for a list of available options. Keyword Args: _check_type (bool): if True, values for parameters in openapi_types @@ -199,7 +199,7 @@ def __init__(self, cloud, region, *args, **kwargs): # noqa: E501 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. + region (str): The region where you would like your index to be created. Different cloud providers have different regions available. See AwsRegions and GcpRegions for a list of available options. Keyword Args: _check_type (bool): if True, values for parameters in openapi_types diff --git a/pinecone/core/client/models/__init__.py b/pinecone/core/client/models/__init__.py index 8cb83d215..11efdc9de 100644 --- a/pinecone/core/client/models/__init__.py +++ b/pinecone/core/client/models/__init__.py @@ -24,18 +24,13 @@ from pinecone.core.client.model.error_response_error import ErrorResponseError from pinecone.core.client.model.fetch_response import FetchResponse 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.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 diff --git a/tests/unit/test_control.py b/tests/unit/test_control.py index 570cc96f4..6a1ab8180 100644 --- a/tests/unit/test_control.py +++ b/tests/unit/test_control.py @@ -6,9 +6,9 @@ @pytest.fixture def index_list_response(): return IndexList(indexes=[ - IndexModel(name="index1", dimension=10, metric="euclidean", status={"ready": True}, spec={}, _check_type=False), - IndexModel(name="index2", dimension=10, metric="euclidean", status={"ready": True}, spec={}, _check_type=False), - IndexModel(name="index3", dimension=10, metric="euclidean", status={"ready": True}, spec={}, _check_type=False), + IndexModel(name="index1", dimension=10, metric="euclidean", host="asdf", status={"ready": True}, spec={}, _check_type=False), + IndexModel(name="index2", dimension=10, metric="euclidean", host="asdf", status={"ready": True}, spec={}, _check_type=False), + IndexModel(name="index3", dimension=10, metric="euclidean", host="asdf", status={"ready": True}, spec={}, _check_type=False), ])