Skip to content

Commit e257894

Browse files
fsxfreakjhamon
andauthored
Sync models from pinecone-protos (#315)
## Problem See context in #313. This PR also includes other changes such as renaming vector_operations_api to data_plane_api and updating documentation. ## Solution Followed steps to regenerate the python client from the protos. ## Type of Change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) --------- Co-authored-by: Jen Hamon <[email protected]>
1 parent 0d3cc45 commit e257894

16 files changed

+333
-214
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,4 @@ pc.delete_collection("example-collection")
401401
# Contributing
402402

403403
If you'd like to make a contribution, or get setup locally to develop the Pinecone python client, please see our [contributing guide](./CONTRIBUTING.md)
404+

pinecone/core/client/api/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# do not import all apis into this module because that uses a lot of memory and stack frames
22
# if you need the ability to import all apis from one package, import them with
3-
# from pinecone.core.client.apis import ManageIndexesApi
3+
# from pinecone.core.client.apis import DataPlaneApi

pinecone/core/client/api/vector_operations_api.py renamed to pinecone/core/client/api/data_plane_api.py

Lines changed: 93 additions & 93 deletions
Large diffs are not rendered by default.

pinecone/core/client/api/manage_indexes_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def __create_index(
311311
):
312312
"""Create an index # noqa: E501
313313
314-
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
314+
This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/docs/manage-indexes#create-a-serverless-index). # noqa: E501
315315
This method makes a synchronous HTTP request by default. To make an
316316
asynchronous HTTP request, please pass async_req=True
317317
@@ -436,7 +436,7 @@ def __delete_collection(
436436
):
437437
"""Delete a collection # noqa: E501
438438
439-
This operation deletes an existing collection. Serverless and starter indexes do not support collections. # noqa: E501
439+
This operation deletes an existing collection. Serverless and starter indexes do not support collections. # noqa: E501
440440
This method makes a synchronous HTTP request by default. To make an
441441
asynchronous HTTP request, please pass async_req=True
442442
@@ -685,7 +685,7 @@ def __describe_collection(
685685
):
686686
"""Describe a collection # noqa: E501
687687
688-
This operation gets a description of a collection. Serverless and starter indexes do not support collections. # noqa: E501
688+
This operation gets a description of a collection. Serverless and starter indexes do not support collections. # noqa: E501
689689
This method makes a synchronous HTTP request by default. To make an
690690
asynchronous HTTP request, please pass async_req=True
691691
@@ -932,7 +932,7 @@ def __list_collections(
932932
):
933933
"""List collections # noqa: E501
934934
935-
This operation returns a list of your Pinecone collections. Serverless and starter indexes do not support collections. # noqa: E501
935+
This operation returns a list of all collections in a project. Serverless and starter indexes do not support collections. # noqa: E501
936936
This method makes a synchronous HTTP request by default. To make an
937937
asynchronous HTTP request, please pass async_req=True
938938

pinecone/core/client/api_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,11 @@ def __call__(self, *args, **kwargs):
762762
""" This method is invoked when endpoints are called
763763
Example:
764764
765-
api_instance = ManageIndexesApi()
766-
api_instance.configure_index # this is an instance of the class Endpoint
767-
api_instance.configure_index() # this invokes api_instance.configure_index.__call__()
765+
api_instance = DataPlaneApi()
766+
api_instance.alt_delete # this is an instance of the class Endpoint
767+
api_instance.alt_delete() # this invokes api_instance.alt_delete.__call__()
768768
which then invokes the callable functions stored in that endpoint at
769-
api_instance.configure_index.callable or self.callable in this class
769+
api_instance.alt_delete.callable or self.callable in this class
770770
771771
"""
772772
return self.callable(self, *args, **kwargs)

pinecone/core/client/apis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# raise a `RecursionError`.
77
# In order to avoid this, import only the API that you directly need like:
88
#
9-
# from .api.manage_indexes_api import ManageIndexesApi
9+
# from .api.data_plane_api import DataPlaneApi
1010
#
1111
# or import this package, but before doing it, use:
1212
#
1313
# import sys
1414
# sys.setrecursionlimit(n)
1515

1616
# Import APIs into API package:
17+
from pinecone.core.client.api.data_plane_api import DataPlaneApi
1718
from pinecone.core.client.api.manage_indexes_api import ManageIndexesApi
18-
from pinecone.core.client.api.vector_operations_api import VectorOperationsApi

pinecone/core/client/model/create_collection_request.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ class CreateCollectionRequest(ModelNormal):
6262
('name',): {
6363
'max_length': 45,
6464
'min_length': 1,
65-
'regex': {
66-
'pattern': r'^[A-Za-z0-9].*[A-Za-z0-9]$', # noqa: E501
67-
},
6865
},
6966
}
7067

pinecone/core/client/model/create_index_request.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ class CreateIndexRequest(ModelNormal):
6767
('name',): {
6868
'max_length': 45,
6969
'min_length': 1,
70-
'regex': {
71-
'pattern': r'^[A-Za-z0-9].*[A-Za-z0-9]$', # noqa: E501
72-
},
7370
},
7471
('dimension',): {
7572
'inclusive_maximum': 20000,
@@ -129,7 +126,7 @@ def _from_openapi_data(cls, name, dimension, spec, *args, **kwargs): # noqa: E5
129126
Args:
130127
name (str): The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
131128
dimension (int): The dimensions of the vectors to be inserted in the index.
132-
spec (dict): The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 region. Test thoroughly before using serverless indexes in production.
129+
spec (dict): The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 region. Test thoroughly before using serverless indexes in production.
133130
134131
Keyword Args:
135132
_check_type (bool): if True, values for parameters in openapi_types
@@ -219,7 +216,7 @@ def __init__(self, name, dimension, spec, *args, **kwargs): # noqa: E501
219216
Args:
220217
name (str): The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
221218
dimension (int): The dimensions of the vectors to be inserted in the index.
222-
spec (dict): The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 region. Test thoroughly before using serverless indexes in production.
219+
spec (dict): The spec object defines how the index should be deployed. For serverless indexes, you define only the cloud and region where the index should be hosted. For pod-based indexes, you define the environment where the index should be hosted, the pod type and size to use, and other index characteristics. Serverless indexes are in public preview and are available only on AWS in the us-west-2 region. Test thoroughly before using serverless indexes in production.
223220
224221
Keyword Args:
225222
_check_type (bool): if True, values for parameters in openapi_types

pinecone/core/client/model/index_model.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ class IndexModel(ModelNormal):
7373
('name',): {
7474
'max_length': 45,
7575
'min_length': 1,
76-
'regex': {
77-
'pattern': r'^[A-Za-z0-9].*[A-Za-z0-9]$', # noqa: E501
78-
},
7976
},
8077
('dimension',): {
8178
'inclusive_maximum': 20000,
@@ -109,9 +106,9 @@ def openapi_types():
109106
'name': (str,), # noqa: E501
110107
'dimension': (int,), # noqa: E501
111108
'metric': (str,), # noqa: E501
109+
'host': (str,), # noqa: E501
112110
'spec': (IndexModelSpec,), # noqa: E501
113111
'status': (IndexModelStatus,), # noqa: E501
114-
'host': (str,), # noqa: E501
115112
}
116113

117114
@cached_property
@@ -123,9 +120,9 @@ def discriminator():
123120
'name': 'name', # noqa: E501
124121
'dimension': 'dimension', # noqa: E501
125122
'metric': 'metric', # noqa: E501
123+
'host': 'host', # noqa: E501
126124
'spec': 'spec', # noqa: E501
127125
'status': 'status', # noqa: E501
128-
'host': 'host', # noqa: E501
129126
}
130127

131128
read_only_vars = {
@@ -135,12 +132,13 @@ def discriminator():
135132

136133
@classmethod
137134
@convert_js_args_to_python_args
138-
def _from_openapi_data(cls, name, dimension, spec, status, *args, **kwargs): # noqa: E501
135+
def _from_openapi_data(cls, name, dimension, host, spec, status, *args, **kwargs): # noqa: E501
139136
"""IndexModel - a model defined in OpenAPI
140137
141138
Args:
142139
name (str): The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
143140
dimension (int): The dimensions of the vectors to be inserted in the index.
141+
host (str): The URL address where the index is hosted.
144142
spec (IndexModelSpec):
145143
status (IndexModelStatus):
146144
@@ -176,7 +174,6 @@ def _from_openapi_data(cls, name, dimension, spec, status, *args, **kwargs): #
176174
Animal class but this time we won't travel
177175
through its discriminator because we passed in
178176
_visited_composed_classes = (Animal,)
179-
host (str): The URL address where the index is hosted.. [optional] # noqa: E501
180177
"""
181178

182179
metric = kwargs.get('metric', "cosine")
@@ -208,6 +205,7 @@ def _from_openapi_data(cls, name, dimension, spec, status, *args, **kwargs): #
208205
self.name = name
209206
self.dimension = dimension
210207
self.metric = metric
208+
self.host = host
211209
self.spec = spec
212210
self.status = status
213211
for var_name, var_value in kwargs.items():
@@ -230,12 +228,13 @@ def _from_openapi_data(cls, name, dimension, spec, status, *args, **kwargs): #
230228
])
231229

232230
@convert_js_args_to_python_args
233-
def __init__(self, name, dimension, spec, status, *args, **kwargs): # noqa: E501
231+
def __init__(self, name, dimension, host, spec, status, *args, **kwargs): # noqa: E501
234232
"""IndexModel - a model defined in OpenAPI
235233
236234
Args:
237235
name (str): The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'.
238236
dimension (int): The dimensions of the vectors to be inserted in the index.
237+
host (str): The URL address where the index is hosted.
239238
spec (IndexModelSpec):
240239
status (IndexModelStatus):
241240
@@ -271,7 +270,6 @@ def __init__(self, name, dimension, spec, status, *args, **kwargs): # noqa: E50
271270
Animal class but this time we won't travel
272271
through its discriminator because we passed in
273272
_visited_composed_classes = (Animal,)
274-
host (str): The URL address where the index is hosted.. [optional] # noqa: E501
275273
"""
276274

277275
metric = kwargs.get('metric', "cosine")
@@ -301,6 +299,7 @@ def __init__(self, name, dimension, spec, status, *args, **kwargs): # noqa: E50
301299
self.name = name
302300
self.dimension = dimension
303301
self.metric = metric
302+
self.host = host
304303
self.spec = spec
305304
self.status = status
306305
for var_name, var_value in kwargs.items():

pinecone/core/client/model/index_model_status.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class IndexModelStatus(ModelNormal):
6363
'SCALINGDOWN': "ScalingDown",
6464
'SCALINGUPPODSIZE': "ScalingUpPodSize",
6565
'SCALINGDOWNPODSIZE': "ScalingDownPodSize",
66-
'UPGRADING': "Upgrading",
6766
'TERMINATING': "Terminating",
6867
'READY': "Ready",
6968
},

0 commit comments

Comments
 (0)