Skip to content

Commit 8c77c13

Browse files
authored
Merge pull request #47 from pinecone-io/sc-8169/metadata-partial-updates
partial updates
2 parents f466a64 + 0cecf71 commit 8c77c13

File tree

8 files changed

+622
-19
lines changed

8 files changed

+622
-19
lines changed

pinecone/core/client/api/vector_operations_api.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from pinecone.core.client.model.query_request import QueryRequest
3232
from pinecone.core.client.model.query_response import QueryResponse
3333
from pinecone.core.client.model.rpc_status import RpcStatus
34+
from pinecone.core.client.model.update_request import UpdateRequest
3435
from pinecone.core.client.model.upsert_request import UpsertRequest
3536
from pinecone.core.client.model.upsert_response import UpsertResponse
3637

@@ -526,6 +527,126 @@ def __query(
526527
callable=__query
527528
)
528529

530+
def __update(
531+
self,
532+
update_request,
533+
**kwargs
534+
):
535+
"""Update # noqa: E501
536+
537+
The `Update` operation updates vector in a namespace. If a value is included, it will overwrite the previous value. If a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value. # noqa: E501
538+
This method makes a synchronous HTTP request by default. To make an
539+
asynchronous HTTP request, please pass async_req=True
540+
541+
>>> thread = api.update(update_request, async_req=True)
542+
>>> result = thread.get()
543+
544+
Args:
545+
update_request (UpdateRequest):
546+
547+
Keyword Args:
548+
_return_http_data_only (bool): response data without head status
549+
code and headers. Default is True.
550+
_preload_content (bool): if False, the urllib3.HTTPResponse object
551+
will be returned without reading/decoding response data.
552+
Default is True.
553+
_request_timeout (int/float/tuple): timeout setting for this request. If
554+
one number provided, it will be total request timeout. It can also
555+
be a pair (tuple) of (connection, read) timeouts.
556+
Default is None.
557+
_check_input_type (bool): specifies if type checking
558+
should be done one the data sent to the server.
559+
Default is True.
560+
_check_return_type (bool): specifies if type checking
561+
should be done one the data received from the server.
562+
Default is True.
563+
_host_index (int/None): specifies the index of the server
564+
that we want to use.
565+
Default is read from the configuration.
566+
async_req (bool): execute request asynchronously
567+
568+
Returns:
569+
{str: (bool, date, datetime, dict, float, int, list, str, none_type)}
570+
If the method is called asynchronously, returns the request
571+
thread.
572+
"""
573+
kwargs['async_req'] = kwargs.get(
574+
'async_req', False
575+
)
576+
kwargs['_return_http_data_only'] = kwargs.get(
577+
'_return_http_data_only', True
578+
)
579+
kwargs['_preload_content'] = kwargs.get(
580+
'_preload_content', True
581+
)
582+
kwargs['_request_timeout'] = kwargs.get(
583+
'_request_timeout', None
584+
)
585+
kwargs['_check_input_type'] = kwargs.get(
586+
'_check_input_type', True
587+
)
588+
kwargs['_check_return_type'] = kwargs.get(
589+
'_check_return_type', True
590+
)
591+
kwargs['_host_index'] = kwargs.get('_host_index')
592+
kwargs['update_request'] = \
593+
update_request
594+
return self.call_with_http_info(**kwargs)
595+
596+
self.update = _Endpoint(
597+
settings={
598+
'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},),
599+
'auth': [
600+
'ApiKeyAuth'
601+
],
602+
'endpoint_path': '/vectors/update',
603+
'operation_id': 'update',
604+
'http_method': 'POST',
605+
'servers': None,
606+
},
607+
params_map={
608+
'all': [
609+
'update_request',
610+
],
611+
'required': [
612+
'update_request',
613+
],
614+
'nullable': [
615+
],
616+
'enum': [
617+
],
618+
'validation': [
619+
]
620+
},
621+
root_map={
622+
'validations': {
623+
},
624+
'allowed_values': {
625+
},
626+
'openapi_types': {
627+
'update_request':
628+
(UpdateRequest,),
629+
},
630+
'attribute_map': {
631+
},
632+
'location_map': {
633+
'update_request': 'body',
634+
},
635+
'collection_format_map': {
636+
}
637+
},
638+
headers_map={
639+
'accept': [
640+
'application/json'
641+
],
642+
'content_type': [
643+
'application/json'
644+
]
645+
},
646+
api_client=api_client,
647+
callable=__update
648+
)
649+
529650
def __upsert(
530651
self,
531652
upsert_request,

0 commit comments

Comments
 (0)