Skip to content

Commit 7aeaa06

Browse files
committed
Add delete by metadata filter support
1 parent 2c4b4c7 commit 7aeaa06

File tree

8 files changed

+606
-42
lines changed

8 files changed

+606
-42
lines changed

pinecone/core/client/api/vector_operations_api.py

Lines changed: 125 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
none_type,
2727
validate_and_convert_types
2828
)
29+
from pinecone.core.client.model.delete_request import DeleteRequest
2930
from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse
3031
from pinecone.core.client.model.fetch_response import FetchResponse
3132
from pinecone.core.client.model.query_request import QueryRequest
@@ -50,6 +51,7 @@ def __init__(self, api_client=None):
5051

5152
def __delete(
5253
self,
54+
delete_request,
5355
**kwargs
5456
):
5557
"""Delete # noqa: E501
@@ -58,7 +60,126 @@ def __delete(
5860
This method makes a synchronous HTTP request by default. To make an
5961
asynchronous HTTP request, please pass async_req=True
6062
61-
>>> thread = api.delete(async_req=True)
63+
>>> thread = api.delete(delete_request, async_req=True)
64+
>>> result = thread.get()
65+
66+
Args:
67+
delete_request (DeleteRequest):
68+
69+
Keyword Args:
70+
_return_http_data_only (bool): response data without head status
71+
code and headers. Default is True.
72+
_preload_content (bool): if False, the urllib3.HTTPResponse object
73+
will be returned without reading/decoding response data.
74+
Default is True.
75+
_request_timeout (int/float/tuple): timeout setting for this request. If
76+
one number provided, it will be total request timeout. It can also
77+
be a pair (tuple) of (connection, read) timeouts.
78+
Default is None.
79+
_check_input_type (bool): specifies if type checking
80+
should be done one the data sent to the server.
81+
Default is True.
82+
_check_return_type (bool): specifies if type checking
83+
should be done one the data received from the server.
84+
Default is True.
85+
_host_index (int/None): specifies the index of the server
86+
that we want to use.
87+
Default is read from the configuration.
88+
async_req (bool): execute request asynchronously
89+
90+
Returns:
91+
{str: (bool, date, datetime, dict, float, int, list, str, none_type)}
92+
If the method is called asynchronously, returns the request
93+
thread.
94+
"""
95+
kwargs['async_req'] = kwargs.get(
96+
'async_req', False
97+
)
98+
kwargs['_return_http_data_only'] = kwargs.get(
99+
'_return_http_data_only', True
100+
)
101+
kwargs['_preload_content'] = kwargs.get(
102+
'_preload_content', True
103+
)
104+
kwargs['_request_timeout'] = kwargs.get(
105+
'_request_timeout', None
106+
)
107+
kwargs['_check_input_type'] = kwargs.get(
108+
'_check_input_type', True
109+
)
110+
kwargs['_check_return_type'] = kwargs.get(
111+
'_check_return_type', True
112+
)
113+
kwargs['_host_index'] = kwargs.get('_host_index')
114+
kwargs['delete_request'] = \
115+
delete_request
116+
return self.call_with_http_info(**kwargs)
117+
118+
self.delete = _Endpoint(
119+
settings={
120+
'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},),
121+
'auth': [
122+
'ApiKeyAuth'
123+
],
124+
'endpoint_path': '/vectors/delete',
125+
'operation_id': 'delete',
126+
'http_method': 'POST',
127+
'servers': None,
128+
},
129+
params_map={
130+
'all': [
131+
'delete_request',
132+
],
133+
'required': [
134+
'delete_request',
135+
],
136+
'nullable': [
137+
],
138+
'enum': [
139+
],
140+
'validation': [
141+
]
142+
},
143+
root_map={
144+
'validations': {
145+
},
146+
'allowed_values': {
147+
},
148+
'openapi_types': {
149+
'delete_request':
150+
(DeleteRequest,),
151+
},
152+
'attribute_map': {
153+
},
154+
'location_map': {
155+
'delete_request': 'body',
156+
},
157+
'collection_format_map': {
158+
}
159+
},
160+
headers_map={
161+
'accept': [
162+
'application/json'
163+
],
164+
'content_type': [
165+
'application/json'
166+
]
167+
},
168+
api_client=api_client,
169+
callable=__delete
170+
)
171+
172+
def __delete1(
173+
self,
174+
**kwargs
175+
):
176+
"""Delete # noqa: E501
177+
178+
The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501
179+
This method makes a synchronous HTTP request by default. To make an
180+
asynchronous HTTP request, please pass async_req=True
181+
182+
>>> thread = api.delete1(async_req=True)
62183
>>> result = thread.get()
63184
64185
@@ -112,14 +233,14 @@ def __delete(
112233
kwargs['_host_index'] = kwargs.get('_host_index')
113234
return self.call_with_http_info(**kwargs)
114235

115-
self.delete = _Endpoint(
236+
self.delete1 = _Endpoint(
116237
settings={
117238
'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},),
118239
'auth': [
119240
'ApiKeyAuth'
120241
],
121242
'endpoint_path': '/vectors/delete',
122-
'operation_id': 'delete',
243+
'operation_id': 'delete1',
123244
'http_method': 'DELETE',
124245
'servers': None,
125246
},
@@ -171,7 +292,7 @@ def __delete(
171292
'content_type': [],
172293
},
173294
api_client=api_client,
174-
callable=__delete
295+
callable=__delete1
175296
)
176297

177298
def __describe_index_stats(

0 commit comments

Comments
 (0)