Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 137 additions & 137 deletions pinecone/core/client/api/index_operations_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,143 +45,6 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client

def __configure_index(
self,
index_name,
**kwargs
):
"""configure_index # noqa: E501

Configure index to change pod type and number of replicas. # noqa: E501
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)
>>> result = thread.get()

Args:
index_name (str): The name of the index

Keyword Args:
patch_request (PatchRequest): The desired configuration changes 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
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:
str
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.configure_index = _Endpoint(
settings={
'response_type': (str,),
'auth': [
'ApiKeyAuth'
],
'endpoint_path': '/databases/{indexName}',
'operation_id': 'configure_index',
'http_method': 'PATCH',
'servers': [
{
'url': "https://controller.{environment}.pinecone.io",
'description': "No description provided",
'variables': {
'environment': {
'description': "No description provided",
'default_value': "unknown",
}
}
},
]
},
params_map={
'all': [
'index_name',
'patch_request',
],
'required': [
'index_name',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'index_name':
(str,),
'patch_request':
(PatchRequest,),
},
'attribute_map': {
'index_name': 'indexName',
},
'location_map': {
'index_name': 'path',
'patch_request': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'text/plain'
],
'content_type': [
'application/json'
]
},
api_client=api_client,
callable=__configure_index
)

def __create_collection(
self,
**kwargs
Expand Down Expand Up @@ -1187,3 +1050,140 @@ def __list_indexes(
api_client=api_client,
callable=__list_indexes
)

def __scale_index(
self,
index_name,
**kwargs
):
"""scale_index # noqa: E501

This operation increases or decreases the number of replicas in 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.scale_index(index_name, async_req=True)
>>> result = thread.get()

Args:
index_name (str): The name of the index

Keyword Args:
patch_request (PatchRequest): The number of replicas. [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
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:
str
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.scale_index = _Endpoint(
settings={
'response_type': (str,),
'auth': [
'ApiKeyAuth'
],
'endpoint_path': '/databases/{indexName}',
'operation_id': 'scale_index',
'http_method': 'PATCH',
'servers': [
{
'url': "https://controller.{environment}.pinecone.io",
'description': "No description provided",
'variables': {
'environment': {
'description': "No description provided",
'default_value': "unknown",
}
}
},
]
},
params_map={
'all': [
'index_name',
'patch_request',
],
'required': [
'index_name',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'index_name':
(str,),
'patch_request':
(PatchRequest,),
},
'attribute_map': {
'index_name': 'indexName',
},
'location_map': {
'index_name': 'path',
'patch_request': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'text/plain'
],
'content_type': [
'application/json'
]
},
api_client=api_client,
callable=__scale_index
)
6 changes: 3 additions & 3 deletions pinecone/core/client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,10 +767,10 @@ def __call__(self, *args, **kwargs):
Example:

api_instance = IndexOperationsApi()
api_instance.configure_index # this is an instance of the class Endpoint
api_instance.configure_index() # this invokes api_instance.configure_index.__call__()
api_instance.create_collection # this is an instance of the class Endpoint
api_instance.create_collection() # this invokes api_instance.create_collection.__call__()
which then invokes the callable functions stored in that endpoint at
api_instance.configure_index.callable or self.callable in this class
api_instance.create_collection.callable or self.callable in this class

"""
return self.callable(self, *args, **kwargs)
Expand Down
10 changes: 4 additions & 6 deletions pinecone/core/client/model/create_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,11 @@ def discriminator():

@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, name, dimension, *args, **kwargs): # noqa: E501
def _from_openapi_data(cls, name, *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

Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
Expand Down Expand Up @@ -163,6 +162,7 @@ def _from_openapi_data(cls, name, dimension, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
dimension (int): The dimensions of the vectors to be inserted in the index. [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
Expand Down Expand Up @@ -200,7 +200,6 @@ def _from_openapi_data(cls, name, dimension, *args, **kwargs): # noqa: E501
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)

self.name = name
self.dimension = dimension
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
Expand All @@ -221,12 +220,11 @@ def _from_openapi_data(cls, name, dimension, *args, **kwargs): # noqa: E501
])

@convert_js_args_to_python_args
def __init__(self, name, dimension, *args, **kwargs): # noqa: E501
def __init__(self, name, *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

Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
Expand Down Expand Up @@ -259,6 +257,7 @@ def __init__(self, name, dimension, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
dimension (int): The dimensions of the vectors to be inserted in the index. [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
Expand Down Expand Up @@ -294,7 +293,6 @@ def __init__(self, name, dimension, *args, **kwargs): # noqa: E501
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)

self.name = name
self.dimension = dimension
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
Expand Down
8 changes: 4 additions & 4 deletions pinecone/core/client/model/index_meta_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def openapi_types():
lazy_import()
return {
'name': (str,), # noqa: E501
'dimensions': (str,), # noqa: E501
'dimension': (str,), # noqa: E501
'index_type': (str,), # noqa: E501
'metric': (str,), # noqa: E501
'pods': (int,), # noqa: E501
Expand All @@ -111,7 +111,7 @@ def discriminator():

attribute_map = {
'name': 'name', # noqa: E501
'dimensions': 'dimensions', # noqa: E501
'dimension': 'dimension', # noqa: E501
'index_type': 'index_type', # noqa: E501
'metric': 'metric', # noqa: E501
'pods': 'pods', # noqa: E501
Expand Down Expand Up @@ -164,7 +164,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
name (str): [optional] # noqa: E501
dimensions (str): [optional] # noqa: E501
dimension (str): [optional] # noqa: E501
index_type (str): [optional] # noqa: E501
metric (str): [optional] # noqa: E501
pods (int): [optional] # noqa: E501
Expand Down Expand Up @@ -255,7 +255,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
name (str): [optional] # noqa: E501
dimensions (str): [optional] # noqa: E501
dimension (str): [optional] # noqa: E501
index_type (str): [optional] # noqa: E501
metric (str): [optional] # noqa: E501
pods (int): [optional] # noqa: E501
Expand Down
Loading