diff --git a/pinecone/config/openapi.py b/pinecone/config/openapi.py index 952a672d..83f9a9cc 100644 --- a/pinecone/config/openapi.py +++ b/pinecone/config/openapi.py @@ -17,7 +17,7 @@ class OpenApiConfigFactory: @classmethod def build(cls, api_key: str, host: str = None, **kwargs): - openapi_config = OpenApiConfiguration.get_default() + openapi_config = OpenApiConfiguration() openapi_config.host = host openapi_config.ssl_ca_cert = certifi.where() openapi_config.socket_options = cls._get_socket_options() diff --git a/pinecone/control/pinecone.py b/pinecone/control/pinecone.py index c6d3037b..535b087e 100644 --- a/pinecone/control/pinecone.py +++ b/pinecone/control/pinecone.py @@ -10,9 +10,7 @@ from pinecone.core.client.api.index_operations_api import IndexOperationsApi from pinecone.core.client.api_client import ApiClient -from pinecone.core.client.models.create_request import CreateRequest -from pinecone.core.client.models.patch_request import PatchRequest -from pinecone.core.client.models.create_collection_request import CreateCollectionRequest +from pinecone.core.client.models import CreateCollectionRequest, CreateRequest, PatchRequest from pinecone.utils import get_user_agent from pinecone.data import Index diff --git a/pinecone/core/client/__init__.py b/pinecone/core/client/__init__.py index 3e4f7ad7..584d1219 100644 --- a/pinecone/core/client/__init__.py +++ b/pinecone/core/client/__init__.py @@ -1,65 +1,28 @@ -# coding: utf-8 - # flake8: noqa """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" __version__ = "1.0.0" -# import apis into sdk package -from pinecone.core.client.api.index_operations_api import IndexOperationsApi -from pinecone.core.client.api.vector_operations_api import VectorOperationsApi - # import ApiClient -from pinecone.core.client.api_response import ApiResponse from pinecone.core.client.api_client import ApiClient + +# import Configuration from pinecone.core.client.configuration import Configuration + +# import exceptions from pinecone.core.client.exceptions import OpenApiException +from pinecone.core.client.exceptions import ApiAttributeError from pinecone.core.client.exceptions import ApiTypeError from pinecone.core.client.exceptions import ApiValueError from pinecone.core.client.exceptions import ApiKeyError -from pinecone.core.client.exceptions import ApiAttributeError from pinecone.core.client.exceptions import ApiException - -# import models into sdk package -from pinecone.core.client.models.approximated_config import ApproximatedConfig -from pinecone.core.client.models.collection_meta import CollectionMeta -from pinecone.core.client.models.create_collection_request import CreateCollectionRequest -from pinecone.core.client.models.create_request import CreateRequest -from pinecone.core.client.models.create_request_index_config import CreateRequestIndexConfig -from pinecone.core.client.models.delete_request import DeleteRequest -from pinecone.core.client.models.describe_index_stats_request import DescribeIndexStatsRequest -from pinecone.core.client.models.describe_index_stats_response import DescribeIndexStatsResponse -from pinecone.core.client.models.fetch_response import FetchResponse -from pinecone.core.client.models.hnsw_config import HnswConfig -from pinecone.core.client.models.index_meta import IndexMeta -from pinecone.core.client.models.index_meta_database import IndexMetaDatabase -from pinecone.core.client.models.index_meta_database_index_config import IndexMetaDatabaseIndexConfig -from pinecone.core.client.models.index_meta_status import IndexMetaStatus -from pinecone.core.client.models.list_indexes200_response import ListIndexes200Response -from pinecone.core.client.models.namespace_summary import NamespaceSummary -from pinecone.core.client.models.patch_request import PatchRequest -from pinecone.core.client.models.protobuf_any import ProtobufAny -from pinecone.core.client.models.protobuf_null_value import ProtobufNullValue -from pinecone.core.client.models.query_request import QueryRequest -from pinecone.core.client.models.query_response import QueryResponse -from pinecone.core.client.models.query_vector import QueryVector -from pinecone.core.client.models.rpc_status import RpcStatus -from pinecone.core.client.models.scored_vector import ScoredVector -from pinecone.core.client.models.single_query_results import SingleQueryResults -from pinecone.core.client.models.sparse_values import SparseValues -from pinecone.core.client.models.update_request import UpdateRequest -from pinecone.core.client.models.upsert_request import UpsertRequest -from pinecone.core.client.models.upsert_response import UpsertResponse -from pinecone.core.client.models.vector import Vector diff --git a/pinecone/core/client/api/__init__.py b/pinecone/core/client/api/__init__.py index dc3b0a5b..14e30437 100644 --- a/pinecone/core/client/api/__init__.py +++ b/pinecone/core/client/api/__init__.py @@ -1,5 +1,3 @@ -# flake8: noqa - -# import apis into api package -from pinecone.core.client.api.index_operations_api import IndexOperationsApi -from pinecone.core.client.api.vector_operations_api import VectorOperationsApi +# do not import all apis into this module because that uses a lot of memory and stack frames +# if you need the ability to import all apis from one package, import them with +# from pinecone.core.client.apis import IndexOperationsApi diff --git a/pinecone/core/client/api/index_operations_api.py b/pinecone/core/client/api/index_operations_api.py index 52f58178..152af5ad 100644 --- a/pinecone/core/client/api/index_operations_api.py +++ b/pinecone/core/client/api/index_operations_api.py @@ -1,1411 +1,1185 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError - -from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import List, Optional - -from pinecone.core.client.models.collection_meta import CollectionMeta -from pinecone.core.client.models.create_collection_request import CreateCollectionRequest -from pinecone.core.client.models.create_request import CreateRequest -from pinecone.core.client.models.index_meta import IndexMeta -from pinecone.core.client.models.list_indexes200_response import ListIndexes200Response -from pinecone.core.client.models.patch_request import PatchRequest - -from pinecone.core.client.api_client import ApiClient -from pinecone.core.client.api_response import ApiResponse -from pinecone.core.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class IndexOperationsApi: +import sys # noqa: F401 + +from pinecone.core.client.api_client import ApiClient, Endpoint as _Endpoint +from pinecone.core.client.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from pinecone.core.client.model.collection_meta import CollectionMeta +from pinecone.core.client.model.create_collection_request import CreateCollectionRequest +from pinecone.core.client.model.create_request import CreateRequest +from pinecone.core.client.model.index_meta import IndexMeta +from pinecone.core.client.model.patch_request import PatchRequest + + +class IndexOperationsApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None) -> None: + def __init__(self, api_client=None): if api_client is None: - api_client = ApiClient.get_default() + api_client = ApiClient() self.api_client = api_client - @validate_arguments - def configure_index( - self, - index_name: Annotated[StrictStr, Field(..., description="The name of the index")], - patch_request: Annotated[ - Optional[PatchRequest], Field(description="The desired pod type and replica configuration for the index.") - ] = None, - **kwargs, - ) -> IndexMeta: # noqa: E501 - """configure_index # noqa: E501 - - This operation specifies the pod type and number of replicas for 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.configure_index(index_name, patch_request, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param patch_request: The desired pod type and replica configuration for the index. - :type patch_request: PatchRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IndexMeta - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the configure_index_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.configure_index_with_http_info(index_name, patch_request, **kwargs) # noqa: E501 - - @validate_arguments - def configure_index_with_http_info( - self, - index_name: Annotated[StrictStr, Field(..., description="The name of the index")], - patch_request: Annotated[ - Optional[PatchRequest], Field(description="The desired pod type and replica configuration for the index.") - ] = None, - **kwargs, - ) -> ApiResponse: # noqa: E501 - """configure_index # noqa: E501 - - This operation specifies the pod type and number of replicas for 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.configure_index_with_http_info(index_name, patch_request, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param patch_request: The desired pod type and replica configuration for the index. - :type patch_request: PatchRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IndexMeta, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["index_name", "patch_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method configure_index" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["index_name"]: - _path_params["indexName"] = _params["index_name"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["patch_request"] is not None: - _body_params = _params["patch_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "202": "IndexMeta", - "400": None, - "404": None, - "500": None, - } - - return self.api_client.call_api( - "/databases/{indexName}", - "PATCH", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def create_collection( - self, create_collection_request: Optional[CreateCollectionRequest] = None, **kwargs - ) -> str: # noqa: E501 - """create_collection # noqa: E501 - - This operation creates a Pinecone collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_collection(create_collection_request, async_req=True) - >>> result = thread.get() - - :param create_collection_request: - :type create_collection_request: CreateCollectionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_collection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_collection_with_http_info(create_collection_request, **kwargs) # noqa: E501 - - @validate_arguments - def create_collection_with_http_info( - self, create_collection_request: Optional[CreateCollectionRequest] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """create_collection # noqa: E501 - - This operation creates a Pinecone collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_collection_with_http_info(create_collection_request, async_req=True) - >>> result = thread.get() - - :param create_collection_request: - :type create_collection_request: CreateCollectionRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["create_collection_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_collection" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["create_collection_request"] is not None: - _body_params = _params["create_collection_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["text/plain"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "201": "str", - "400": None, - "409": None, - "500": None, - } - - return self.api_client.call_api( - "/collections", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def create_index(self, create_request: Optional[CreateRequest] = None, **kwargs) -> IndexMeta: # noqa: E501 - """create_index # noqa: E501 - - This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_index(create_request, async_req=True) - >>> result = thread.get() - - :param create_request: - :type create_request: CreateRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IndexMeta - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the create_index_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.create_index_with_http_info(create_request, **kwargs) # noqa: E501 - - @validate_arguments - def create_index_with_http_info( - self, create_request: Optional[CreateRequest] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """create_index # noqa: E501 - - This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.create_index_with_http_info(create_request, async_req=True) - >>> result = thread.get() - - :param create_request: - :type create_request: CreateRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IndexMeta, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["create_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method create_index" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["create_request"] is not None: - _body_params = _params["create_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "201": "IndexMeta", - "400": None, - "409": None, - "500": None, - } - - return self.api_client.call_api( - "/databases", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def delete_collection( - self, collection_name: Annotated[StrictStr, Field(..., description="The name of the collection")], **kwargs - ) -> str: # noqa: E501 - """delete_collection # noqa: E501 - - This operation deletes an existing collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_collection(collection_name, async_req=True) - >>> result = thread.get() - - :param collection_name: The name of the collection (required) - :type collection_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_collection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_collection_with_http_info(collection_name, **kwargs) # noqa: E501 - - @validate_arguments - def delete_collection_with_http_info( - self, collection_name: Annotated[StrictStr, Field(..., description="The name of the collection")], **kwargs - ) -> ApiResponse: # noqa: E501 - """delete_collection # noqa: E501 - - This operation deletes an existing collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_collection_with_http_info(collection_name, async_req=True) - >>> result = thread.get() - - :param collection_name: The name of the collection (required) - :type collection_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["collection_name"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete_collection" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["collection_name"]: - _path_params["collectionName"] = _params["collection_name"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["text/plain"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "202": "str", - "404": None, - "500": None, - } - - return self.api_client.call_api( - "/collections/{collectionName}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def delete_index( - self, index_name: Annotated[StrictStr, Field(..., description="The name of the index")], **kwargs - ) -> str: # noqa: E501 - """delete_index # noqa: E501 - - This operation deletes an existing 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.delete_index(index_name, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: str - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_index_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_index_with_http_info(index_name, **kwargs) # noqa: E501 - - @validate_arguments - def delete_index_with_http_info( - self, index_name: Annotated[StrictStr, Field(..., description="The name of the index")], **kwargs - ) -> ApiResponse: # noqa: E501 - """delete_index # noqa: E501 - - This operation deletes an existing 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.delete_index_with_http_info(index_name, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(str, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["index_name"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete_index" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["index_name"]: - _path_params["indexName"] = _params["index_name"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["text/plain"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "202": "str", - "404": None, - "500": None, - } - - return self.api_client.call_api( - "/databases/{indexName}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __configure_index( + self, + index_name, + **kwargs + ): + """configure_index # noqa: E501 + + This operation specifies the pod type and number of replicas for 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.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 pod type and replica configuration 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 ) - @validate_arguments - def describe_collection( - self, collection_name: Annotated[StrictStr, Field(..., description="The name of the collection")], **kwargs - ) -> CollectionMeta: # noqa: E501 - """describe_collection # noqa: E501 - - Get a description of a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.describe_collection(collection_name, async_req=True) - >>> result = thread.get() - - :param collection_name: The name of the collection (required) - :type collection_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: CollectionMeta - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the describe_collection_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.describe_collection_with_http_info(collection_name, **kwargs) # noqa: E501 - - @validate_arguments - def describe_collection_with_http_info( - self, collection_name: Annotated[StrictStr, Field(..., description="The name of the collection")], **kwargs - ) -> ApiResponse: # noqa: E501 - """describe_collection # noqa: E501 - - Get a description of a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.describe_collection_with_http_info(collection_name, async_req=True) - >>> result = thread.get() - - :param collection_name: The name of the collection (required) - :type collection_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(CollectionMeta, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["collection_name"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __create_collection( + self, + **kwargs + ): + """create_collection # noqa: E501 + + This operation creates a Pinecone collection. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_collection(async_req=True) + >>> result = thread.get() + + + Keyword Args: + create_collection_request (CreateCollectionRequest): [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') + return self.call_with_http_info(**kwargs) + + self.create_collection = _Endpoint( + settings={ + 'response_type': (str,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/collections', + 'operation_id': 'create_collection', + 'http_method': 'POST', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + 'create_collection_request', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'create_collection_request': + (CreateCollectionRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'create_collection_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'text/plain' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create_collection ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method describe_collection" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["collection_name"]: - _path_params["collectionName"] = _params["collection_name"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "CollectionMeta", - "404": None, - "500": None, - } - - return self.api_client.call_api( - "/collections/{collectionName}", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __create_index( + self, + **kwargs + ): + """create_index # noqa: E501 + + This operation creates a Pinecone index. You can use it to specify the measure of similarity, the dimension of vectors to be stored in the index, the numbers of shards and replicas to use, and more. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.create_index(async_req=True) + >>> result = thread.get() + + + Keyword Args: + create_request (CreateRequest): [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') + return self.call_with_http_info(**kwargs) + + self.create_index = _Endpoint( + settings={ + 'response_type': (str,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/databases', + 'operation_id': 'create_index', + 'http_method': 'POST', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + 'create_request', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'create_request': + (CreateRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'create_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'text/plain' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__create_index ) - @validate_arguments - def describe_index( - self, index_name: Annotated[StrictStr, Field(..., description="The name of the index")], **kwargs - ) -> IndexMeta: # noqa: E501 - """describe_index # noqa: E501 - - Get a description of 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.describe_index(index_name, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: IndexMeta - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the describe_index_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.describe_index_with_http_info(index_name, **kwargs) # noqa: E501 - - @validate_arguments - def describe_index_with_http_info( - self, index_name: Annotated[StrictStr, Field(..., description="The name of the index")], **kwargs - ) -> ApiResponse: # noqa: E501 - """describe_index # noqa: E501 - - Get a description of 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.describe_index_with_http_info(index_name, async_req=True) - >>> result = thread.get() - - :param index_name: The name of the index (required) - :type index_name: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(IndexMeta, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = ["index_name"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __delete_collection( + self, + collection_name, + **kwargs + ): + """delete_collection # noqa: E501 + + This operation deletes an existing collection. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete_collection(collection_name, async_req=True) + >>> result = thread.get() + + Args: + collection_name (str): The name of the collection + + Keyword Args: + _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['collection_name'] = \ + collection_name + return self.call_with_http_info(**kwargs) + + self.delete_collection = _Endpoint( + settings={ + 'response_type': (str,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/collections/{collectionName}', + 'operation_id': 'delete_collection', + 'http_method': 'DELETE', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + 'collection_name', + ], + 'required': [ + 'collection_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'collection_name': + (str,), + }, + 'attribute_map': { + 'collection_name': 'collectionName', + }, + 'location_map': { + 'collection_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'text/plain' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__delete_collection ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method describe_index" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["index_name"]: - _path_params["indexName"] = _params["index_name"] - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "IndexMeta", - "404": None, - "500": None, - } - - return self.api_client.call_api( - "/databases/{indexName}", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __delete_index( + self, + index_name, + **kwargs + ): + """delete_index # noqa: E501 + + This operation deletes an existing 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.delete_index(index_name, async_req=True) + >>> result = thread.get() + + Args: + index_name (str): The name of the index + + Keyword Args: + _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.delete_index = _Endpoint( + settings={ + 'response_type': (str,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/databases/{indexName}', + 'operation_id': 'delete_index', + 'http_method': 'DELETE', + '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', + ], + 'required': [ + 'index_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'index_name': + (str,), + }, + 'attribute_map': { + 'index_name': 'indexName', + }, + 'location_map': { + 'index_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'text/plain' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__delete_index ) - @validate_arguments - def list_collections(self, **kwargs) -> List[str]: # noqa: E501 - """list_collections # noqa: E501 - - This operation returns a list of your Pinecone collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_collections(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[str] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_collections_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_collections_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_collections_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """list_collections # noqa: E501 - - This operation returns a list of your Pinecone collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_collections_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[str], status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __describe_collection( + self, + collection_name, + **kwargs + ): + """describe_collection # noqa: E501 + + Get a description of a collection. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.describe_collection(collection_name, async_req=True) + >>> result = thread.get() + + Args: + collection_name (str): The name of the collection + + Keyword Args: + _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: + CollectionMeta + 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['collection_name'] = \ + collection_name + return self.call_with_http_info(**kwargs) + + self.describe_collection = _Endpoint( + settings={ + 'response_type': (CollectionMeta,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/collections/{collectionName}', + 'operation_id': 'describe_collection', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + 'collection_name', + ], + 'required': [ + 'collection_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'collection_name': + (str,), + }, + 'attribute_map': { + 'collection_name': 'collectionName', + }, + 'location_map': { + 'collection_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__describe_collection ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_collections" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json; charset=utf-8"] - ) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "List[str]", - } - - return self.api_client.call_api( - "/collections", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __describe_index( + self, + index_name, + **kwargs + ): + """describe_index # noqa: E501 + + Get a description of 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.describe_index(index_name, async_req=True) + >>> result = thread.get() + + Args: + index_name (str): The name of the index + + Keyword Args: + _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: + IndexMeta + 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.describe_index = _Endpoint( + settings={ + 'response_type': (IndexMeta,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/databases/{indexName}', + 'operation_id': 'describe_index', + 'http_method': 'GET', + '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', + ], + 'required': [ + 'index_name', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'index_name': + (str,), + }, + 'attribute_map': { + 'index_name': 'indexName', + }, + 'location_map': { + 'index_name': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__describe_index ) - @validate_arguments - def list_indexes(self, **kwargs) -> ListIndexes200Response: # noqa: E501 - """list_indexes # noqa: E501 - - This operation returns a list of your Pinecone indexes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_indexes(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: ListIndexes200Response - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the list_indexes_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.list_indexes_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def list_indexes_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """list_indexes # noqa: E501 - - This operation returns a list of your Pinecone indexes. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.list_indexes_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(ListIndexes200Response, status_code(int), headers(HTTPHeaderDict)) - """ - - _hosts = ["https://api.pinecone.io"] - _host = _hosts[0] - if kwargs.get("_host_index"): - _host_index = int(kwargs.get("_host_index")) - if _host_index < 0 or _host_index >= len(_hosts): - raise ApiValueError("Invalid host index. Must be 0 <= index < %s" % len(_host)) - _host = _hosts[_host_index] - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __list_collections( + self, + **kwargs + ): + """list_collections # noqa: E501 + + This operation returns a list of your Pinecone collections. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_collections(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _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') + return self.call_with_http_info(**kwargs) + + self.list_collections = _Endpoint( + settings={ + 'response_type': ([str],), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/collections', + 'operation_id': 'list_collections', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json; charset=utf-8' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list_collections ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params and _key != "_host_index": - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method list_indexes" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json; charset=utf-8"] - ) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "ListIndexes200Response", - } - - return self.api_client.call_api( - "/databases", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - _host=_host, - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __list_indexes( + self, + **kwargs + ): + """list_indexes # noqa: E501 + + This operation returns a list of your Pinecone indexes. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.list_indexes(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _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') + return self.call_with_http_info(**kwargs) + + self.list_indexes = _Endpoint( + settings={ + 'response_type': ([str],), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/databases', + 'operation_id': 'list_indexes', + 'http_method': 'GET', + 'servers': [ + { + 'url': "https://controller.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } + }, + ] + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json; charset=utf-8' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list_indexes ) diff --git a/pinecone/core/client/api/vector_operations_api.py b/pinecone/core/client/api/vector_operations_api.py index 98c1d1a6..c5bc02a2 100644 --- a/pinecone/core/client/api/vector_operations_api.py +++ b/pinecone/core/client/api/vector_operations_api.py @@ -1,1233 +1,1006 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError - -from typing_extensions import Annotated -from pydantic import Field, StrictBool, StrictStr, conlist - -from typing import Any, Dict, Optional - -from pinecone.core.client.models.delete_request import DeleteRequest -from pinecone.core.client.models.describe_index_stats_request import DescribeIndexStatsRequest -from pinecone.core.client.models.describe_index_stats_response import DescribeIndexStatsResponse -from pinecone.core.client.models.fetch_response import FetchResponse -from pinecone.core.client.models.query_request import QueryRequest -from pinecone.core.client.models.query_response import QueryResponse -from pinecone.core.client.models.update_request import UpdateRequest -from pinecone.core.client.models.upsert_request import UpsertRequest -from pinecone.core.client.models.upsert_response import UpsertResponse - -from pinecone.core.client.api_client import ApiClient -from pinecone.core.client.api_response import ApiResponse -from pinecone.core.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class VectorOperationsApi: +import sys # noqa: F401 + +from pinecone.core.client.api_client import ApiClient, Endpoint as _Endpoint +from pinecone.core.client.model_utils import ( # noqa: F401 + check_allowed_values, + check_validations, + date, + datetime, + file_type, + none_type, + validate_and_convert_types +) +from pinecone.core.client.model.delete_request import DeleteRequest +from pinecone.core.client.model.describe_index_stats_request import DescribeIndexStatsRequest +from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse +from pinecone.core.client.model.fetch_response import FetchResponse +from pinecone.core.client.model.query_request import QueryRequest +from pinecone.core.client.model.query_response import QueryResponse +from pinecone.core.client.model.rpc_status import RpcStatus +from pinecone.core.client.model.update_request import UpdateRequest +from pinecone.core.client.model.upsert_request import UpsertRequest +from pinecone.core.client.model.upsert_response import UpsertResponse + + +class VectorOperationsApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ - def __init__(self, api_client=None) -> None: + def __init__(self, api_client=None): if api_client is None: - api_client = ApiClient.get_default() + api_client = ApiClient() self.api_client = api_client - @validate_arguments - def delete(self, delete_request: DeleteRequest, **kwargs) -> object: # noqa: E501 - """Delete # noqa: E501 - - The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete(delete_request, async_req=True) - >>> result = thread.get() - - :param delete_request: (required) - :type delete_request: DeleteRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: object - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete_with_http_info(delete_request, **kwargs) # noqa: E501 - - @validate_arguments - def delete_with_http_info(self, delete_request: DeleteRequest, **kwargs) -> ApiResponse: # noqa: E501 - """Delete # noqa: E501 - - The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete_with_http_info(delete_request, async_req=True) - >>> result = thread.get() - - :param delete_request: (required) - :type delete_request: DeleteRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["delete_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["delete_request"] is not None: - _body_params = _params["delete_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "object", - } - - return self.api_client.call_api( - "/vectors/delete", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def delete1( - self, - ids: Annotated[Optional[conlist(StrictStr)], Field(description="Vectors to delete.")] = None, - delete_all: Annotated[ - Optional[StrictBool], - Field(description="This indicates that all vectors in the index namespace should be deleted."), - ] = None, - namespace: Annotated[ - Optional[StrictStr], Field(description="The namespace to delete vectors from, if applicable.") - ] = None, - **kwargs, - ) -> object: # noqa: E501 - """Delete # noqa: E501 - - The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete1(ids, delete_all, namespace, async_req=True) - >>> result = thread.get() - - :param ids: Vectors to delete. - :type ids: List[str] - :param delete_all: This indicates that all vectors in the index namespace should be deleted. - :type delete_all: bool - :param namespace: The namespace to delete vectors from, if applicable. - :type namespace: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: object - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the delete1_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.delete1_with_http_info(ids, delete_all, namespace, **kwargs) # noqa: E501 - - @validate_arguments - def delete1_with_http_info( - self, - ids: Annotated[Optional[conlist(StrictStr)], Field(description="Vectors to delete.")] = None, - delete_all: Annotated[ - Optional[StrictBool], - Field(description="This indicates that all vectors in the index namespace should be deleted."), - ] = None, - namespace: Annotated[ - Optional[StrictStr], Field(description="The namespace to delete vectors from, if applicable.") - ] = None, - **kwargs, - ) -> ApiResponse: # noqa: E501 - """Delete # noqa: E501 - - The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.delete1_with_http_info(ids, delete_all, namespace, async_req=True) - >>> result = thread.get() - - :param ids: Vectors to delete. - :type ids: List[str] - :param delete_all: This indicates that all vectors in the index namespace should be deleted. - :type delete_all: bool - :param namespace: The namespace to delete vectors from, if applicable. - :type namespace: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["ids", "delete_all", "namespace"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __delete( + self, + delete_request, + **kwargs + ): + """Delete # noqa: E501 + + The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete(delete_request, async_req=True) + >>> result = thread.get() + + Args: + delete_request (DeleteRequest): + + Keyword Args: + _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: (bool, date, datetime, dict, float, int, list, str, none_type)} + 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['delete_request'] = \ + delete_request + return self.call_with_http_info(**kwargs) + + self.delete = _Endpoint( + settings={ + 'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/vectors/delete', + 'operation_id': 'delete', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'delete_request', + ], + 'required': [ + 'delete_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'delete_request': + (DeleteRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'delete_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__delete ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method delete1" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("ids") is not None: # noqa: E501 - _query_params.append(("ids", _params["ids"])) - _collection_formats["ids"] = "multi" - - if _params.get("delete_all") is not None: # noqa: E501 - _query_params.append(("deleteAll", _params["delete_all"])) - - if _params.get("namespace") is not None: # noqa: E501 - _query_params.append(("namespace", _params["namespace"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "object", - } - - return self.api_client.call_api( - "/vectors/delete", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __delete1( + self, + **kwargs + ): + """Delete # noqa: E501 + + The `Delete` operation deletes vectors, by id, from a single namespace. You can delete items by their id, from a single namespace. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.delete1(async_req=True) + >>> result = thread.get() + + + Keyword Args: + ids ([str]): Vectors to delete.. [optional] + delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False + namespace (str): The namespace to delete vectors from, if applicable.. [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: (bool, date, datetime, dict, float, int, list, str, none_type)} + 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') + return self.call_with_http_info(**kwargs) + + self.delete1 = _Endpoint( + settings={ + 'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/vectors/delete', + 'operation_id': 'delete1', + 'http_method': 'DELETE', + 'servers': None, + }, + params_map={ + 'all': [ + 'ids', + 'delete_all', + 'namespace', + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'ids': + ([str],), + 'delete_all': + (bool,), + 'namespace': + (str,), + }, + 'attribute_map': { + 'ids': 'ids', + 'delete_all': 'deleteAll', + 'namespace': 'namespace', + }, + 'location_map': { + 'ids': 'query', + 'delete_all': 'query', + 'namespace': 'query', + }, + 'collection_format_map': { + 'ids': 'multi', + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__delete1 ) - @validate_arguments - def describe_index_stats( - self, describe_index_stats_request: DescribeIndexStatsRequest, **kwargs - ) -> DescribeIndexStatsResponse: # noqa: E501 - """DescribeIndexStats # noqa: E501 - - The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats(describe_index_stats_request, async_req=True) - >>> result = thread.get() - - :param describe_index_stats_request: (required) - :type describe_index_stats_request: DescribeIndexStatsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DescribeIndexStatsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the describe_index_stats_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.describe_index_stats_with_http_info(describe_index_stats_request, **kwargs) # noqa: E501 - - @validate_arguments - def describe_index_stats_with_http_info( - self, describe_index_stats_request: DescribeIndexStatsRequest, **kwargs - ) -> ApiResponse: # noqa: E501 - """DescribeIndexStats # noqa: E501 - - The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats_with_http_info(describe_index_stats_request, async_req=True) - >>> result = thread.get() - - :param describe_index_stats_request: (required) - :type describe_index_stats_request: DescribeIndexStatsRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DescribeIndexStatsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["describe_index_stats_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __describe_index_stats( + self, + describe_index_stats_request, + **kwargs + ): + """DescribeIndexStats # noqa: E501 + + The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats(describe_index_stats_request, async_req=True) + >>> result = thread.get() + + Args: + describe_index_stats_request (DescribeIndexStatsRequest): + + Keyword Args: + _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: + DescribeIndexStatsResponse + 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['describe_index_stats_request'] = \ + describe_index_stats_request + return self.call_with_http_info(**kwargs) + + self.describe_index_stats = _Endpoint( + settings={ + 'response_type': (DescribeIndexStatsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/describe_index_stats', + 'operation_id': 'describe_index_stats', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'describe_index_stats_request', + ], + 'required': [ + 'describe_index_stats_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'describe_index_stats_request': + (DescribeIndexStatsRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'describe_index_stats_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__describe_index_stats ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method describe_index_stats" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["describe_index_stats_request"] is not None: - _body_params = _params["describe_index_stats_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "DescribeIndexStatsResponse", - } - - return self.api_client.call_api( - "/describe_index_stats", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def describe_index_stats1(self, **kwargs) -> DescribeIndexStatsResponse: # noqa: E501 - """DescribeIndexStats # noqa: E501 - - The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats1(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: DescribeIndexStatsResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the describe_index_stats1_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.describe_index_stats1_with_http_info(**kwargs) # noqa: E501 - - @validate_arguments - def describe_index_stats1_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 - """DescribeIndexStats # noqa: E501 - - The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats1_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(DescribeIndexStatsResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = [] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method describe_index_stats1" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "DescribeIndexStatsResponse", - } - - return self.api_client.call_api( - "/describe_index_stats", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def fetch( - self, - ids: Annotated[ - conlist(StrictStr), - Field(..., description="The vector IDs to fetch. Does not accept values containing spaces."), - ], - namespace: Optional[StrictStr] = None, - **kwargs, - ) -> FetchResponse: # noqa: E501 - """Fetch # noqa: E501 - - The `Fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.fetch(ids, namespace, async_req=True) - >>> result = thread.get() - - :param ids: The vector IDs to fetch. Does not accept values containing spaces. (required) - :type ids: List[str] - :param namespace: - :type namespace: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: FetchResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the fetch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.fetch_with_http_info(ids, namespace, **kwargs) # noqa: E501 - - @validate_arguments - def fetch_with_http_info( - self, - ids: Annotated[ - conlist(StrictStr), - Field(..., description="The vector IDs to fetch. Does not accept values containing spaces."), - ], - namespace: Optional[StrictStr] = None, - **kwargs, - ) -> ApiResponse: # noqa: E501 - """Fetch # noqa: E501 - - The `Fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.fetch_with_http_info(ids, namespace, async_req=True) - >>> result = thread.get() - - :param ids: The vector IDs to fetch. Does not accept values containing spaces. (required) - :type ids: List[str] - :param namespace: - :type namespace: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(FetchResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["ids", "namespace"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method fetch" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("ids") is not None: # noqa: E501 - _query_params.append(("ids", _params["ids"])) - _collection_formats["ids"] = "multi" - - if _params.get("namespace") is not None: # noqa: E501 - _query_params.append(("namespace", _params["namespace"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "FetchResponse", - } - - return self.api_client.call_api( - "/vectors/fetch", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @validate_arguments - def query(self, query_request: QueryRequest, **kwargs) -> QueryResponse: # noqa: E501 - """Query # noqa: E501 - - The `Query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.query(query_request, async_req=True) - >>> result = thread.get() - - :param query_request: (required) - :type query_request: QueryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: QueryResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the query_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.query_with_http_info(query_request, **kwargs) # noqa: E501 - - @validate_arguments - def query_with_http_info(self, query_request: QueryRequest, **kwargs) -> ApiResponse: # noqa: E501 - """Query # noqa: E501 - - The `Query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.query_with_http_info(query_request, async_req=True) - >>> result = thread.get() - - :param query_request: (required) - :type query_request: QueryRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(QueryResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["query_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method query" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["query_request"] is not None: - _body_params = _params["query_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "QueryResponse", - } - - return self.api_client.call_api( - "/query", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __describe_index_stats1( + self, + **kwargs + ): + """DescribeIndexStats # noqa: E501 + + The `DescribeIndexStats` operation returns statistics about the index's contents, including the vector count per namespace, the number of dimensions, and the index fullness. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_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.describe_index_stats1(async_req=True) + >>> result = thread.get() + + + Keyword Args: + _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: + DescribeIndexStatsResponse + 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') + return self.call_with_http_info(**kwargs) + + self.describe_index_stats1 = _Endpoint( + settings={ + 'response_type': (DescribeIndexStatsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/describe_index_stats', + 'operation_id': 'describe_index_stats1', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + ], + 'required': [], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + }, + 'attribute_map': { + }, + 'location_map': { + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__describe_index_stats1 ) - @validate_arguments - def update(self, update_request: UpdateRequest, **kwargs) -> object: # noqa: E501 - """Update # noqa: E501 - - 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 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update(update_request, async_req=True) - >>> result = thread.get() - - :param update_request: (required) - :type update_request: UpdateRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: object - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the update_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.update_with_http_info(update_request, **kwargs) # noqa: E501 - - @validate_arguments - def update_with_http_info(self, update_request: UpdateRequest, **kwargs) -> ApiResponse: # noqa: E501 - """Update # noqa: E501 - - 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 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.update_with_http_info(update_request, async_req=True) - >>> result = thread.get() - - :param update_request: (required) - :type update_request: UpdateRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(object, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["update_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __fetch( + self, + ids, + **kwargs + ): + """Fetch # noqa: E501 + + The `Fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.fetch(ids, async_req=True) + >>> result = thread.get() + + Args: + ids ([str]): The vector IDs to fetch. Does not accept values containing spaces. + + Keyword Args: + namespace (str): [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: + FetchResponse + 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['ids'] = \ + ids + return self.call_with_http_info(**kwargs) + + self.fetch = _Endpoint( + settings={ + 'response_type': (FetchResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/vectors/fetch', + 'operation_id': 'fetch', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'ids', + 'namespace', + ], + 'required': [ + 'ids', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'ids': + ([str],), + 'namespace': + (str,), + }, + 'attribute_map': { + 'ids': 'ids', + 'namespace': 'namespace', + }, + 'location_map': { + 'ids': 'query', + 'namespace': 'query', + }, + 'collection_format_map': { + 'ids': 'multi', + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__fetch ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method update" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["update_request"] is not None: - _body_params = _params["update_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "object", - } - - return self.api_client.call_api( - "/vectors/update", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __query( + self, + query_request, + **kwargs + ): + """Query # noqa: E501 + + The `Query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.query(query_request, async_req=True) + >>> result = thread.get() + + Args: + query_request (QueryRequest): + + Keyword Args: + _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: + QueryResponse + 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['query_request'] = \ + query_request + return self.call_with_http_info(**kwargs) + + self.query = _Endpoint( + settings={ + 'response_type': (QueryResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/query', + 'operation_id': 'query', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'query_request', + ], + 'required': [ + 'query_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'query_request': + (QueryRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'query_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__query ) - @validate_arguments - def upsert(self, upsert_request: UpsertRequest, **kwargs) -> UpsertResponse: # noqa: E501 - """Upsert # noqa: E501 - - The `Upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.upsert(upsert_request, async_req=True) - >>> result = thread.get() - - :param upsert_request: (required) - :type upsert_request: UpsertRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: 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. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: UpsertResponse - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the upsert_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - return self.upsert_with_http_info(upsert_request, **kwargs) # noqa: E501 - - @validate_arguments - def upsert_with_http_info(self, upsert_request: UpsertRequest, **kwargs) -> ApiResponse: # noqa: E501 - """Upsert # noqa: E501 - - The `Upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.upsert_with_http_info(upsert_request, async_req=True) - >>> result = thread.get() - - :param upsert_request: (required) - :type upsert_request: UpsertRequest - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(UpsertResponse, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["upsert_request"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] + def __update( + self, + update_request, + **kwargs + ): + """Update # noqa: E501 + + 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 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.update(update_request, async_req=True) + >>> result = thread.get() + + Args: + update_request (UpdateRequest): + + Keyword Args: + _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: (bool, date, datetime, dict, float, int, list, str, none_type)} + 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['update_request'] = \ + update_request + return self.call_with_http_info(**kwargs) + + self.update = _Endpoint( + settings={ + 'response_type': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/vectors/update', + 'operation_id': 'update', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'update_request', + ], + 'required': [ + 'update_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'update_request': + (UpdateRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'update_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__update ) - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError("Got an unexpected keyword argument '%s'" " to method upsert" % _key) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["upsert_request"] is not None: - _body_params = _params["upsert_request"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", self.api_client.select_header_content_type(["application/json"]) - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = ["ApiKeyAuth"] # noqa: E501 - - _response_types_map = { - "200": "UpsertResponse", - } - - return self.api_client.call_api( - "/vectors/upsert", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), + def __upsert( + self, + upsert_request, + **kwargs + ): + """Upsert # noqa: E501 + + The `Upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.upsert(upsert_request, async_req=True) + >>> result = thread.get() + + Args: + upsert_request (UpsertRequest): + + Keyword Args: + _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: + UpsertResponse + 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['upsert_request'] = \ + upsert_request + return self.call_with_http_info(**kwargs) + + self.upsert = _Endpoint( + settings={ + 'response_type': (UpsertResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/vectors/upsert', + 'operation_id': 'upsert', + 'http_method': 'POST', + 'servers': None, + }, + params_map={ + 'all': [ + 'upsert_request', + ], + 'required': [ + 'upsert_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'upsert_request': + (UpsertRequest,), + }, + 'attribute_map': { + }, + 'location_map': { + 'upsert_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, + api_client=api_client, + callable=__upsert ) diff --git a/pinecone/core/client/api_client.py b/pinecone/core/client/api_client.py index 3c5bf896..770fc07c 100644 --- a/pinecone/core/client/api_client.py +++ b/pinecone/core/client/api_client.py @@ -1,38 +1,46 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" -import atexit -import datetime -from dateutil.parser import parse import json +import atexit import mimetypes from multiprocessing.pool import ThreadPool +import io import os import re -import tempfile - +import typing from urllib.parse import quote - -from pinecone.core.client.configuration import Configuration -from pinecone.core.client.api_response import ApiResponse -import pinecone.core.client.models -from pinecone.core.client import rest -from pinecone.core.client.exceptions import ApiValueError, ApiException +from urllib3.fields import RequestField -class ApiClient: +from pinecone.core.client import rest +from pinecone.core.client.configuration import Configuration +from pinecone.core.client.exceptions import ApiTypeError, ApiValueError, ApiException +from pinecone.core.client.model_utils import ( + ModelNormal, + ModelSimple, + ModelComposed, + check_allowed_values, + check_validations, + date, + datetime, + deserialize_file, + file_type, + model_to_dict, + none_type, + validate_and_convert_types +) + + +class ApiClient(object): """Generic API client for OpenAPI client library builds. OpenAPI generic API client. This client handles the client- @@ -40,6 +48,10 @@ class ApiClient: the methods and models for each application are generated from the OpenAPI templates. + NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + Do not edit the class manually. + :param configuration: .Configuration object for this client :param header_name: a header to pass when making calls to the API. :param header_value: a header value to pass when making calls to @@ -50,23 +62,12 @@ class ApiClient: to the API. More threads means more concurrent API requests. """ - PRIMITIVE_TYPES = (float, bool, bytes, str, int) - NATIVE_TYPES_MAPPING = { - "int": int, - "long": int, # TODO remove as only py3 is supported? - "float": float, - "str": str, - "bool": bool, - "date": datetime.date, - "datetime": datetime.datetime, - "object": object, - } _pool = None - def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None, pool_threads=1) -> None: - # use default configuration if none is provided + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): if configuration is None: - configuration = Configuration.get_default() + configuration = Configuration.get_default_copy() self.configuration = configuration self.pool_threads = pool_threads @@ -76,8 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, cook self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = "OpenAPI-Generator/1.0.0/python" - self.client_side_validation = configuration.client_side_validation + self.user_agent = 'OpenAPI-Generator/1.0.0/python' def __enter__(self): return self @@ -90,13 +90,13 @@ def close(self): self._pool.close() self._pool.join() self._pool = None - if hasattr(atexit, "unregister"): + if hasattr(atexit, 'unregister'): atexit.unregister(self.close) @property def pool(self): """Create thread pool on first request - avoids instantiating unused threadpool for blocking clients. + avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: atexit.register(self.close) @@ -106,95 +106,84 @@ def pool(self): @property def user_agent(self): """User agent for this API client""" - return self.default_headers["User-Agent"] + return self.default_headers['User-Agent'] @user_agent.setter def user_agent(self, value): - self.default_headers["User-Agent"] = value + self.default_headers['User-Agent'] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - _default = None - - @classmethod - def get_default(cls): - """Return new instance of ApiClient. - - This method returns newly created, based on default constructor, - object of ApiClient class or returns a copy of default - ApiClient. - - :return: The ApiClient object. - """ - if cls._default is None: - cls._default = ApiClient() - return cls._default - - @classmethod - def set_default(cls, default): - """Set default instance of ApiClient. - - It stores default ApiClient. - - :param default: object of ApiClient. - """ - cls._default = default - def __call_api( self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_types_map=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - _request_auth=None, + resource_path: str, + method: str, + path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + body: typing.Optional[typing.Any] = None, + post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, + response_type: typing.Optional[typing.Tuple[typing.Any]] = None, + auth_settings: typing.Optional[typing.List[str]] = None, + _return_http_data_only: typing.Optional[bool] = None, + collection_formats: typing.Optional[typing.Dict[str, str]] = None, + _preload_content: bool = True, + _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, + _host: typing.Optional[str] = None, + _check_type: typing.Optional[bool] = None ): + config = self.configuration # header parameters header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params["Cookie"] = self.cookie + header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, collection_formats)) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) # path parameters if path_params: path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, collection_formats) + path_params = self.parameters_to_tuples(path_params, + collection_formats) for k, v in path_params: # specified safe chars, encode everything - resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)) + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + query_params = self.parameters_to_tuples(query_params, + collection_formats) # post parameters if post_params or files: post_params = post_params if post_params else [] post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) + post_params = self.parameters_to_tuples(post_params, + collection_formats) post_params.extend(self.files_parameters(files)) - - # auth setting - self.update_params_for_auth( - header_params, query_params, auth_settings, resource_path, method, body, request_auth=_request_auth - ) + if header_params['Content-Type'].startswith("multipart"): + post_params = self.parameters_to_multipart(post_params, + (dict) ) # body if body: body = self.sanitize_for_serialization(body) + # auth setting + self.update_params_for_auth(header_params, query_params, + auth_settings, resource_path, method, body) + # request url if _host is None: url = self.configuration.host + resource_path @@ -202,70 +191,73 @@ def __call_api( # use server/host defined in path or operation instead url = _host + resource_path - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - url_query = self.parameters_to_url_query(query_params, collection_formats) - url += "?" + url_query - try: # perform request and return response response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) + _request_timeout=_request_timeout) except ApiException as e: - if e.body: - e.body = e.body.decode("utf-8") + e.body = e.body.decode('utf-8') raise e self.last_response = response_data - return_data = None # assuming derialization is not needed - # data needs deserialization or returns HTTP data (deserialized) only - if _preload_content or _return_http_data_only: - response_type = response_types_map.get(str(response_data.status), None) - if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: - # if not found, look for '1XX', '2XX', etc. - response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + return_data = response_data - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader("content-type") + if not _preload_content: + return (return_data) + return return_data + + # deserialize response data + if response_type: + if response_type != (file_type,): + encoding = "utf-8" + content_type = response_data.getheader('content-type') if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s\;]?", content_type) + if match: + encoding = match.group(1) response_data.data = response_data.data.decode(encoding) - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + return_data = self.deserialize( + response_data, + response_type, + _check_type + ) + else: + return_data = None if _return_http_data_only: - return return_data + return (return_data) else: - return ApiResponse( - status_code=response_data.status, - data=return_data, - headers=response_data.getheaders(), - raw_data=response_data.data, - ) + return (return_data, response_data.status, + response_data.getheaders()) - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. + def parameters_to_multipart(self, params, collection_types): + """Get parameters as list of tuples, formatting as json if value is collection_types + :param params: Parameters as list of two-tuples + :param dict collection_types: Parameter collection types + :return: Parameters as list of tuple or urllib3.fields.RequestField + """ + new_params = [] + if collection_types is None: + collection_types = (dict) + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, collection_types): # v is instance of collection_type, formatting as application/json + v = json.dumps(v, ensure_ascii=False).encode("utf-8") + field = RequestField(k, v) + field.make_multipart(content_type="application/json; charset=utf-8") + new_params.append(field) + else: + new_params.append((k, v)) + return new_params + + @classmethod + def sanitize_for_serialization(cls, obj): + """Prepares data for transmission before it is sent with the rest client If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date @@ -273,111 +265,92 @@ def sanitize_for_serialization(self, obj): If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. - + If obj is io.IOBase, return the bytes :param obj: The data to serialize. :return: The serialized form of data. """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): + if isinstance(obj, (ModelNormal, ModelComposed)): + return { + key: cls.sanitize_for_serialization(val) for key, val in model_to_dict(obj, serialize=True).items() + } + elif isinstance(obj, io.IOBase): + return cls.get_file_data_and_close_file(obj) + elif isinstance(obj, (str, int, float, none_type, bool)): return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): + elif isinstance(obj, (datetime, date)): return obj.isoformat() - + elif isinstance(obj, ModelSimple): + return cls.sanitize_for_serialization(obj.value) + elif isinstance(obj, (list, tuple)): + return [cls.sanitize_for_serialization(item) for item in obj] if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `openapi_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = obj.to_dict() + return {key: cls.sanitize_for_serialization(val) for key, val in obj.items()} + raise ApiValueError('Unable to prepare type {} for serialization'.format(obj.__class__.__name__)) - return {key: self.sanitize_for_serialization(val) for key, val in obj_dict.items()} - - def deserialize(self, response, response_type): + def deserialize(self, response, response_type, _check_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. - :param response_type: class literal for - deserialized object, or string of class name. + :param response_type: For the response, a tuple containing: + valid classes + a list containing valid classes (for list schemas) + a dict containing a tuple of valid classes as the value + Example values: + (str,) + (Pet,) + (float, none_type) + ([int, none_type],) + ({str: (bool, str, int, float, date, datetime, str, none_type)},) + :param _check_type: boolean, whether to check the types of the data + received from the server + :type _check_type: bool :return: deserialized object. """ # handle file downloading # save response body into a tmp file and return the instance - if response_type == "file": - return self.__deserialize_file(response) + if response_type == (file_type,): + content_disposition = response.getheader("Content-Disposition") + return deserialize_file(response.data, self.configuration, + content_disposition=content_disposition) # fetch data from response object try: - data = json.loads(response.data) + received_data = json.loads(response.data) except ValueError: - data = response.data - - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if isinstance(klass, str): - if klass.startswith("List["): - sub_kls = re.match(r"List\[(.*)]", klass).group(1) - return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - - if klass.startswith("Dict["): - sub_kls = re.match(r"Dict\[([^,]*), (.*)]", klass).group(2) - return {k: self.__deserialize(v, sub_kls) for k, v in data.items()} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(pinecone.core.client.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datetime(data) - else: - return self.__deserialize_model(data, klass) + received_data = response.data + + # store our data under the key of 'received_data' so users have some + # context if they are deserializing a string and the data type is wrong + deserialized_data = validate_and_convert_types( + received_data, + response_type, + ['received_data'], + True, + _check_type, + configuration=self.configuration + ) + return deserialized_data def call_api( self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_types_map=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None, - _host=None, - _request_auth=None, + resource_path: str, + method: str, + path_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + query_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + header_params: typing.Optional[typing.Dict[str, typing.Any]] = None, + body: typing.Optional[typing.Any] = None, + post_params: typing.Optional[typing.List[typing.Tuple[str, typing.Any]]] = None, + files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None, + response_type: typing.Optional[typing.Tuple[typing.Any]] = None, + auth_settings: typing.Optional[typing.List[str]] = None, + async_req: typing.Optional[bool] = None, + _return_http_data_only: typing.Optional[bool] = None, + collection_formats: typing.Optional[typing.Dict[str, str]] = None, + _preload_content: bool = True, + _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, + _host: typing.Optional[str] = None, + _check_type: typing.Optional[bool] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -393,26 +366,38 @@ def call_api( :param post_params dict: Request post form parameters, for `application/x-www-form-urlencoded`, `multipart/form-data`. :param auth_settings list: Auth Settings names for the request. - :param response: Response data type. - :param files dict: key -> filename, value -> filepath, - for `multipart/form-data`. + :param response_type: For the response, a tuple containing: + valid classes + a list containing valid classes (for list schemas) + a dict containing a tuple of valid classes as the value + Example values: + (str,) + (Pet,) + (float, none_type) + ([int, none_type],) + ({str: (bool, str, int, float, date, datetime, str, none_type)},) + :param files: key -> field name, value -> a list of open file + objects for `multipart/form-data`. + :type files: dict :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. + :type async_req: bool, optional + :param _return_http_data_only: response data without head status code + and headers + :type _return_http_data_only: bool, optional :param collection_formats: dict of collection formats for path, query, header, and post parameters. + :type collection_formats: dict, optional + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :type _preload_content: bool, optional :param _request_timeout: 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. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_token: dict, optional + :param _check_type: boolean describing if the data back from the server + should have its type checked. + :type _check_type: bool, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -421,124 +406,87 @@ def call_api( then the method will return the response directly. """ if not async_req: - return self.__call_api( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ) - - return self.pool.apply_async( - self.__call_api, - ( - resource_path, - method, - path_params, - query_params, - header_params, - body, - post_params, - files, - response_types_map, - auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host, - _request_auth, - ), - ) - - def request( - self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host, + _check_type) + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, _check_type)) + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.get_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "HEAD": - return self.rest_client.head_request( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers, - ) + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "OPTIONS": - return self.rest_client.options_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - ) + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "POST": - return self.rest_client.post_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PUT": - return self.rest_client.put_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PATCH": - return self.rest_client.patch_request( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "DELETE": - return self.rest_client.delete_request( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) else: - raise ApiValueError("http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`.") + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -553,78 +501,59 @@ def parameters_to_tuples(self, params, collection_formats): for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] - if collection_format == "multi": + if collection_format == 'multi': new_params.extend((k, value) for value in v) else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(str(value) for value in v))) + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params - def parameters_to_url_query(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. + @staticmethod + def get_file_data_and_close_file(file_instance: io.IOBase) -> bytes: + file_data = file_instance.read() + file_instance.close() + return file_data - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: URL query string (e.g. a=Hello%20World&b=123) - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 - if isinstance(v, (int, float)): - v = str(v) - if isinstance(v, bool): - v = str(v).lower() - if isinstance(v, dict): - v = json.dumps(v) - - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == "multi": - new_params.extend((k, value) for value in v) - else: - if collection_format == "ssv": - delimiter = " " - elif collection_format == "tsv": - delimiter = "\t" - elif collection_format == "pipes": - delimiter = "|" - else: # csv is the default - delimiter = "," - new_params.append((k, delimiter.join(quote(str(value)) for value in v))) - else: - new_params.append((k, quote(str(v)))) - - return "&".join(["=".join(item) for item in new_params]) - - def files_parameters(self, files=None): + def files_parameters(self, files: typing.Optional[typing.Dict[str, typing.List[io.IOBase]]] = None): """Builds form parameters. - :param files: File parameters. - :return: Form parameters with files. + :param files: None or a dict with key=param_name and + value is a list of open file objects + :return: List of tuples of form parameters with file data """ - params = [] + if files is None: + return [] - if files: - for k, v in files.items(): - if not v: + params = [] + for param_name, file_instances in files.items(): + if file_instances is None: + # if the file field is nullable, skip None values + continue + for file_instance in file_instances: + if file_instance is None: + # if the file field is nullable, skip None values continue - file_names = v if type(v) is list else [v] - for n in file_names: - with open(n, "rb") as f: - filename = os.path.basename(f.name) - filedata = f.read() - mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" - params.append(tuple([k, tuple([filename, filedata, mimetype])])) + if file_instance.closed is True: + raise ApiValueError( + "Cannot read a closed file. The passed in file_type " + "for %s must be open." % param_name + ) + filename = os.path.basename(file_instance.name) + filedata = self.get_file_data_and_close_file(file_instance) + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([param_name, tuple([filename, filedata, mimetype])])) return params @@ -637,11 +566,12 @@ def select_header_accept(self, accepts): if not accepts: return - for accept in accepts: - if re.search("json", accept, re.IGNORECASE): - return accept + accepts = [x.lower() for x in accepts] - return accepts[0] + if 'application/json' in accepts: + return 'application/json' + else: + return ', '.join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -650,139 +580,271 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return None + return 'application/json' - for content_type in content_types: - if re.search("json", content_type, re.IGNORECASE): - return content_type + content_types = [x.lower() for x in content_types] - return content_types[0] + if 'application/json' in content_types or '*/*' in content_types: + return 'application/json' + else: + return content_types[0] - def update_params_for_auth(self, headers, queries, auth_settings, resource_path, method, body, request_auth=None): + def update_params_for_auth(self, headers, querys, auth_settings, + resource_path, method, body): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. + :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param request_auth: if set, the provided settings will - override the token in the configuration. + :param resource_path: A string representation of the HTTP request resource path. + :param method: A string representation of the HTTP request method. + :param body: A object representing the body of the HTTP request. + The object type is the return value of _encoder.default(). """ if not auth_settings: return - if request_auth: - self._apply_auth_params(headers, queries, resource_path, method, body, request_auth) - return - for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) - - def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): - """Updates the request parameters based on a single auth_setting - - :param headers: Header parameters dict to be updated. - :param queries: Query parameters tuple list to be updated. - :resource_path: A string representation of the HTTP request resource path. - :method: A string representation of the HTTP request method. - :body: A object representing the body of the HTTP request. - The object type is the return value of sanitize_for_serialization(). - :param auth_setting: auth settings for the endpoint - """ - if auth_setting["in"] == "cookie": - headers["Cookie"] = auth_setting["value"] - elif auth_setting["in"] == "header": - if auth_setting["type"] != "http-signature": - headers[auth_setting["key"]] = auth_setting["value"] - elif auth_setting["in"] == "query": - queries.append((auth_setting["key"], auth_setting["value"])) - else: - raise ApiValueError("Authentication token must be in `query` or `header`") - - def __deserialize_file(self, response): - """Deserializes body to file - - Saves response body into a file in a temporary folder, - using the filename from the `Content-Disposition` header if provided. - - :param response: RESTResponse. - :return: file path. + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + +class Endpoint(object): + def __init__(self, settings=None, params_map=None, root_map=None, + headers_map=None, api_client=None, callable=None): + """Creates an endpoint + + Args: + settings (dict): see below key value pairs + 'response_type' (tuple/None): response type + 'auth' (list): a list of auth type keys + 'endpoint_path' (str): the endpoint path + 'operation_id' (str): endpoint string identifier + 'http_method' (str): POST/PUT/PATCH/GET etc + 'servers' (list): list of str servers that this endpoint is at + params_map (dict): see below key value pairs + 'all' (list): list of str endpoint parameter names + 'required' (list): list of required parameter names + 'nullable' (list): list of nullable parameter names + 'enum' (list): list of parameters with enum values + 'validation' (list): list of parameters with validations + root_map + 'validations' (dict): the dict mapping endpoint parameter tuple + paths to their validation dictionaries + 'allowed_values' (dict): the dict mapping endpoint parameter + tuple paths to their allowed_values (enum) dictionaries + 'openapi_types' (dict): param_name to openapi type + 'attribute_map' (dict): param_name to camelCase name + 'location_map' (dict): param_name to 'body', 'file', 'form', + 'header', 'path', 'query' + collection_format_map (dict): param_name to `csv` etc. + headers_map (dict): see below key value pairs + 'accept' (list): list of Accept header strings + 'content_type' (list): list of Content-Type header strings + api_client (ApiClient) api client instance + callable (function): the function which is invoked when the + Endpoint is called """ - fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) - os.close(fd) - os.remove(path) - - content_disposition = response.getheader("Content-Disposition") - if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).group(1) - path = os.path.join(os.path.dirname(path), filename) - - with open(path, "wb") as f: - f.write(response.data) - - return path - - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. + self.settings = settings + self.params_map = params_map + self.params_map['all'].extend([ + 'async_req', + '_host_index', + '_preload_content', + '_request_timeout', + '_return_http_data_only', + '_check_input_type', + '_check_return_type' + ]) + self.params_map['nullable'].extend(['_request_timeout']) + self.validations = root_map['validations'] + self.allowed_values = root_map['allowed_values'] + self.openapi_types = root_map['openapi_types'] + extra_types = { + 'async_req': (bool,), + '_host_index': (none_type, int), + '_preload_content': (bool,), + '_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]), + '_return_http_data_only': (bool,), + '_check_input_type': (bool,), + '_check_return_type': (bool,) + } + self.openapi_types.update(extra_types) + self.attribute_map = root_map['attribute_map'] + self.location_map = root_map['location_map'] + self.collection_format_map = root_map['collection_format_map'] + self.headers_map = headers_map + self.api_client = api_client + self.callable = callable + + def __validate_inputs(self, kwargs): + for param in self.params_map['enum']: + if param in kwargs: + check_allowed_values( + self.allowed_values, + (param,), + kwargs[param] + ) + + for param in self.params_map['validation']: + if param in kwargs: + check_validations( + self.validations, + (param,), + kwargs[param], + configuration=self.api_client.configuration + ) + + if kwargs['_check_input_type'] is False: + return - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return str(data) - except TypeError: - return data + for key, value in kwargs.items(): + fixed_val = validate_and_convert_types( + value, + self.openapi_types[key], + [key], + False, + kwargs['_check_input_type'], + configuration=self.api_client.configuration + ) + kwargs[key] = fixed_val + + def __gather_params(self, kwargs): + params = { + 'body': None, + 'collection_format': {}, + 'file': {}, + 'form': [], + 'header': {}, + 'path': {}, + 'query': [] + } + + for param_name, param_value in kwargs.items(): + param_location = self.location_map.get(param_name) + if param_location is None: + continue + if param_location: + if param_location == 'body': + params['body'] = param_value + continue + base_name = self.attribute_map[param_name] + if (param_location == 'form' and + self.openapi_types[param_name] == (file_type,)): + params['file'][param_name] = [param_value] + elif (param_location == 'form' and + self.openapi_types[param_name] == ([file_type],)): + # param_value is already a list + params['file'][param_name] = param_value + elif param_location in {'form', 'query'}: + param_value_full = (base_name, param_value) + params[param_location].append(param_value_full) + if param_location not in {'form', 'query'}: + params[param_location][base_name] = param_value + collection_format = self.collection_format_map.get(param_name) + if collection_format: + params['collection_format'][base_name] = collection_format - def __deserialize_object(self, value): - """Return an original value. + return params - :return: object. - """ - return value + def __call__(self, *args, **kwargs): + """ This method is invoked when endpoints are called + Example: - def __deserialize_date(self, string): - """Deserializes string to date. + 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__() + which then invokes the callable functions stored in that endpoint at + api_instance.configure_index.callable or self.callable in this class - :param string: str. - :return: date. """ - try: - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException(status=0, reason="Failed to parse `{0}` as date object".format(string)) + return self.callable(self, *args, **kwargs) - def __deserialize_datetime(self, string): - """Deserializes string to datetime. + def call_with_http_info(self, **kwargs): - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ try: - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException(status=0, reason=("Failed to parse `{0}` as datetime object".format(string))) - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - return klass.from_dict(data) + index = self.api_client.configuration.server_operation_index.get( + self.settings['operation_id'], self.api_client.configuration.server_index + ) if kwargs['_host_index'] is None else kwargs['_host_index'] + server_variables = self.api_client.configuration.server_operation_variables.get( + self.settings['operation_id'], self.api_client.configuration.server_variables + ) + _host = self.api_client.configuration.get_host_from_settings( + index, variables=server_variables, servers=self.settings['servers'] + ) + except IndexError: + if self.settings['servers']: + raise ApiValueError( + "Invalid host index. Must be 0 <= index < %s" % + len(self.settings['servers']) + ) + _host = None + + for key, value in kwargs.items(): + if key not in self.params_map['all']: + raise ApiTypeError( + "Got an unexpected parameter '%s'" + " to method `%s`" % + (key, self.settings['operation_id']) + ) + # only throw this nullable ApiValueError if _check_input_type + # is False, if _check_input_type==True we catch this case + # in self.__validate_inputs + if (key not in self.params_map['nullable'] and value is None + and kwargs['_check_input_type'] is False): + raise ApiValueError( + "Value may not be None for non-nullable parameter `%s`" + " when calling `%s`" % + (key, self.settings['operation_id']) + ) + + for key in self.params_map['required']: + if key not in kwargs.keys(): + raise ApiValueError( + "Missing the required parameter `%s` when calling " + "`%s`" % (key, self.settings['operation_id']) + ) + + self.__validate_inputs(kwargs) + + params = self.__gather_params(kwargs) + + accept_headers_list = self.headers_map['accept'] + if accept_headers_list: + params['header']['Accept'] = self.api_client.select_header_accept( + accept_headers_list) + + content_type_headers_list = self.headers_map['content_type'] + if content_type_headers_list: + header_list = self.api_client.select_header_content_type( + content_type_headers_list) + params['header']['Content-Type'] = header_list + + return self.api_client.call_api( + self.settings['endpoint_path'], self.settings['http_method'], + params['path'], + params['query'], + params['header'], + body=params['body'], + post_params=params['form'], + files=params['file'], + response_type=self.settings['response_type'], + auth_settings=self.settings['auth'], + async_req=kwargs['async_req'], + _check_type=kwargs['_check_return_type'], + _return_http_data_only=kwargs['_return_http_data_only'], + _preload_content=kwargs['_preload_content'], + _request_timeout=kwargs['_request_timeout'], + _host=_host, + collection_formats=params['collection_format']) diff --git a/pinecone/core/client/api_response.py b/pinecone/core/client/api_response.py deleted file mode 100644 index 7bc03cb6..00000000 --- a/pinecone/core/client/api_response.py +++ /dev/null @@ -1,22 +0,0 @@ -"""API response object.""" - -from __future__ import annotations -from typing import Any, Dict, Optional -from pydantic import Field, StrictInt, StrictStr - - -class ApiResponse: - """ - API response object - """ - - status_code: Optional[StrictInt] = Field(None, description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") - data: Optional[Any] = Field(None, description="Deserialized data given the data type") - raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") - - def __init__(self, status_code=None, headers=None, data=None, raw_data=None) -> None: - self.status_code = status_code - self.headers = headers - self.data = data - self.raw_data = raw_data diff --git a/pinecone/core/client/apis/__init__.py b/pinecone/core/client/apis/__init__.py new file mode 100644 index 00000000..ec42b1a8 --- /dev/null +++ b/pinecone/core/client/apis/__init__.py @@ -0,0 +1,18 @@ + +# flake8: noqa + +# Import all APIs into this package. +# If you have many APIs here with many many models used in each API this may +# raise a `RecursionError`. +# In order to avoid this, import only the API that you directly need like: +# +# from .api.index_operations_api import IndexOperationsApi +# +# or import this package, but before doing it, use: +# +# import sys +# sys.setrecursionlimit(n) + +# Import APIs into API package: +from pinecone.core.client.api.index_operations_api import IndexOperationsApi +from pinecone.core.client.api.vector_operations_api import VectorOperationsApi diff --git a/pinecone/core/client/configuration.py b/pinecone/core/client/configuration.py index 7ebb57e5..6e2d4949 100644 --- a/pinecone/core/client/configuration.py +++ b/pinecone/core/client/configuration.py @@ -1,16 +1,12 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" import copy @@ -19,88 +15,104 @@ import sys import urllib3 -import http.client as httplib +from http import client as http_client +from pinecone.core.client.exceptions import ApiValueError + JSON_SCHEMA_VALIDATION_KEYWORDS = { - "multipleOf", - "maximum", - "exclusiveMaximum", - "minimum", - "exclusiveMinimum", - "maxLength", - "minLength", - "pattern", - "maxItems", - "minItems", + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' } +class Configuration(object): + """NOTE: This class is auto generated by OpenAPI Generator + + Ref: https://openapi-generator.tech + Do not edit the class manually. -class Configuration: - """This class contains various settings of the API client. - - :param host: Base url. - :param api_key: Dict to store API key(s). - Each entry in the dict specifies an API key. - The dict key is the name of the security scheme in the OAS specification. - The dict value is the API key secret. - :param api_key_prefix: Dict to store API prefix (e.g. Bearer). - The dict key is the name of the security scheme in the OAS specification. - The dict value is an API key prefix when generating the auth data. - :param username: Username for HTTP basic authentication. - :param password: Password for HTTP basic authentication. - :param access_token: Access token. - :param server_index: Index to servers configuration. - :param server_variables: Mapping with string values to replace variables in - templated server configuration. The validation of enums is performed for - variables with defined enum values before. - :param server_operation_index: Mapping from operation ID to an index to server - configuration. - :param server_operation_variables: Mapping from operation ID to a mapping with - string values to replace variables in templated server configuration. - The validation of enums is performed for variables with defined enum - values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates - in PEM format. - - :Example: - - API Key Authentication Example. - Given the following security scheme in the OpenAPI specification: - components: - securitySchemes: - cookieAuth: # name for the security scheme - type: apiKey - in: cookie - name: JSESSIONID # cookie name - - You can programmatically set the cookie: - - conf = pinecone.core.client.Configuration( - api_key={'cookieAuth': 'abc123'} - api_key_prefix={'cookieAuth': 'JSESSIONID'} - ) - - The following cookie will be added to the HTTP request: - Cookie: JSESSIONID abc123 + :param host: Base url + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication + :param password: Password for HTTP basic authentication + :param discard_unknown_keys: Boolean value indicating whether to discard + unknown properties. A server may send a response that includes additional + properties that are not known by the client in the following scenarios: + 1. The OpenAPI document is incomplete, i.e. it does not match the server + implementation. + 2. The client was generated using an older version of the OpenAPI document + and the server has been upgraded since then. + If a schema in the OpenAPI document defines the additionalProperties attribute, + then all undeclared properties received by the server are injected into the + additional properties map. In that case, there are undeclared properties, and + nothing to discard. + :param disabled_client_side_validations (string): Comma-separated list of + JSON schema validation keywords to disable JSON schema structural validation + rules. The following keywords may be specified: multipleOf, maximum, + exclusiveMaximum, minimum, exclusiveMinimum, maxLength, minLength, pattern, + maxItems, minItems. + By default, the validation is performed for data generated locally by the client + and data received from the server, independent of any validation performed by + the server side. If the input data does not satisfy the JSON schema validation + rules specified in the OpenAPI document, an exception is raised. + If disabled_client_side_validations is set, structural validation is + disabled. This can be useful to troubleshoot data validation problem, such as + when the OpenAPI document validation rules do not match the actual API data + received by the server. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = pinecone.core.client.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 """ _default = None - def __init__( - self, - host=None, - api_key=None, - api_key_prefix=None, - username=None, - password=None, - access_token=None, - server_index=None, - server_variables=None, - server_operation_index=None, - server_operation_variables=None, - ssl_ca_cert=None, - ) -> None: - """Constructor""" + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + access_token=None, + username=None, password=None, + discard_unknown_keys=False, + disabled_client_side_validations="", + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ): + """Constructor + """ self._base_path = "https://unknown-unknown.svc.unknown.pinecone.io" if host is None else host """Default Base url """ @@ -116,6 +128,7 @@ def __init__( """Temp file folder for downloading files """ # Authentication Settings + self.access_token = access_token self.api_key = {} if api_key: self.api_key = api_key @@ -135,15 +148,14 @@ def __init__( self.password = password """Password for HTTP basic authentication """ - self.access_token = access_token - """Access token - """ + self.discard_unknown_keys = discard_unknown_keys + self.disabled_client_side_validations = disabled_client_side_validations self.logger = {} """Logging Settings """ self.logger["package_logger"] = logging.getLogger("pinecone.core.client") self.logger["urllib3_logger"] = logging.getLogger("urllib3") - self.logger_format = "%(asctime)s %(levelname)s %(message)s" + self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ self.logger_stream_handler = None @@ -176,10 +188,6 @@ def __init__( self.assert_hostname = None """Set this to True/False to enable/disable SSL hostname verification. """ - self.tls_server_name = None - """SSL/TLS Server Name Indication (SNI) - Set this to the SNI value expected by the server. - """ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 """urllib3 connection pool's maximum number of connections saved @@ -195,7 +203,7 @@ def __init__( self.proxy_headers = None """Proxy headers """ - self.safe_chars_for_path_param = "" + self.safe_chars_for_path_param = '' """Safe chars for path_param """ self.retries = None @@ -204,24 +212,15 @@ def __init__( # Enable client side validation self.client_side_validation = True + # Options to pass down to the underlying urllib3 socket self.socket_options = None - """Options to pass down to the underlying urllib3 socket - """ - - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" - """datetime format - """ - - self.date_format = "%Y-%m-%d" - """date format - """ def __deepcopy__(self, memo): cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result for k, v in self.__dict__.items(): - if k not in ("logger", "logger_file_handler"): + if k not in ('logger', 'logger_file_handler'): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) @@ -232,6 +231,13 @@ def __deepcopy__(self, memo): def __setattr__(self, name, value): object.__setattr__(self, name, value) + if name == 'disabled_client_side_validations': + s = set(filter(None, value.split(','))) + for v in s: + if v not in JSON_SCHEMA_VALIDATION_KEYWORDS: + raise ApiValueError( + "Invalid keyword: '{0}''".format(v)) + self._disabled_client_side_validations = s @classmethod def set_default(cls, default): @@ -242,31 +248,21 @@ def set_default(cls, default): :param default: object of Configuration """ - cls._default = default + cls._default = copy.deepcopy(default) @classmethod def get_default_copy(cls): - """Deprecated. Please use `get_default` instead. - - Deprecated. Please use `get_default` instead. - - :return: The configuration object. - """ - return cls.get_default() - - @classmethod - def get_default(cls): - """Return the default configuration. + """Return new instance of configuration. This method returns newly created, based on default constructor, object of Configuration class or returns a copy of default - configuration. + configuration passed by the set_default method. :return: The configuration object. """ - if cls._default is None: - cls._default = Configuration() - return cls._default + if cls._default is not None: + return copy.deepcopy(cls._default) + return Configuration() @property def logger_file(self): @@ -320,15 +316,15 @@ def debug(self, value): # if debug status is True, turn on debug logging for _, logger in self.logger.items(): logger.setLevel(logging.DEBUG) - # turn on httplib debug - httplib.HTTPConnection.debuglevel = 1 + # turn on http_client debug + http_client.HTTPConnection.debuglevel = 1 else: # if debug status is False, turn off debug logging, # setting log level to default `logging.WARNING` for _, logger in self.logger.items(): logger.setLevel(logging.WARNING) - # turn off httplib debug - httplib.HTTPConnection.debuglevel = 0 + # turn off http_client debug + http_client.HTTPConnection.debuglevel = 0 @property def logger_format(self): @@ -381,7 +377,9 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers(basic_auth=username + ":" + password).get("authorization") + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -389,13 +387,13 @@ def auth_settings(self): :return: The Auth Settings information dict. """ auth = {} - if "ApiKeyAuth" in self.api_key: - auth["ApiKeyAuth"] = { - "type": "api_key", - "in": "header", - "key": "Api-Key", - "value": self.get_api_key_with_prefix( - "ApiKeyAuth", + if 'ApiKeyAuth' in self.api_key: + auth['ApiKeyAuth'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'Api-Key', + 'value': self.get_api_key_with_prefix( + 'ApiKeyAuth', ), } return auth @@ -405,13 +403,12 @@ def to_debug_report(self): :return: The report for debugging. """ - return ( - "Python SDK Debug Report:\n" - "OS: {env}\n" - "Python Version: {pyversion}\n" - "Version of the API: version not set\n" - "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) - ) + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: version not set\n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): """Gets an array of host settings @@ -420,22 +417,22 @@ def get_host_settings(self): """ return [ { - "url": "https://{index_name}-{project_name}.svc.{environment}.pinecone.io", - "description": "No description provided", - "variables": { - "index_name": { - "description": "No description provided", - "default_value": "unknown", - }, - "project_name": { - "description": "No description provided", - "default_value": "unknown", - }, - "environment": { - "description": "No description provided", - "default_value": "unknown", - }, - }, + 'url': "https://{index_name}-{project_name}.svc.{environment}.pinecone.io", + 'description': "No description provided", + 'variables': { + 'index_name': { + 'description': "No description provided", + 'default_value': "unknown", + }, + 'project_name': { + 'description': "No description provided", + 'default_value': "unknown", + }, + 'environment': { + 'description': "No description provided", + 'default_value': "unknown", + } + } } ] @@ -457,20 +454,22 @@ def get_host_from_settings(self, index, variables=None, servers=None): except IndexError: raise ValueError( "Invalid index {0} when selecting the host settings. " - "Must be less than {1}".format(index, len(servers)) - ) + "Must be less than {1}".format(index, len(servers))) - url = server["url"] + url = server['url'] # go through variables and replace placeholders - for variable_name, variable in server.get("variables", {}).items(): - used_value = variables.get(variable_name, variable["default_value"]) + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) - if "enum_values" in variable and used_value not in variable["enum_values"]: + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " - "{1}. Must be {2}.".format(variable_name, variables[variable_name], variable["enum_values"]) - ) + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) url = url.replace("{" + variable_name + "}", used_value) diff --git a/pinecone/core/client/exceptions.py b/pinecone/core/client/exceptions.py index 7a26ac07..dd777d02 100644 --- a/pinecone/core/client/exceptions.py +++ b/pinecone/core/client/exceptions.py @@ -1,16 +1,13 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) + Generated by: https://openapi-generator.tech +""" - Do not edit the class manually. -""" # noqa: E501 class OpenApiException(Exception): @@ -18,8 +15,9 @@ class OpenApiException(Exception): class ApiTypeError(OpenApiException, TypeError): - def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None: - """Raises an exception for TypeErrors + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors Args: msg (str): the exception message @@ -46,7 +44,7 @@ def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> class ApiValueError(OpenApiException, ValueError): - def __init__(self, msg, path_to_item=None) -> None: + def __init__(self, msg, path_to_item=None): """ Args: msg (str): the exception message @@ -64,7 +62,7 @@ def __init__(self, msg, path_to_item=None) -> None: class ApiAttributeError(OpenApiException, AttributeError): - def __init__(self, msg, path_to_item=None) -> None: + def __init__(self, msg, path_to_item=None): """ Raised when an attribute reference or assignment fails. @@ -83,7 +81,7 @@ def __init__(self, msg, path_to_item=None) -> None: class ApiKeyError(OpenApiException, KeyError): - def __init__(self, msg, path_to_item=None) -> None: + def __init__(self, msg, path_to_item=None): """ Args: msg (str): the exception message @@ -100,7 +98,8 @@ def __init__(self, msg, path_to_item=None) -> None: class ApiException(OpenApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status self.reason = http_resp.reason @@ -114,9 +113,11 @@ def __init__(self, status=None, reason=None, http_resp=None) -> None: def __str__(self): """Custom error messages for exception""" - error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason) + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) if self.headers: - error_message += "HTTP response headers: {0}\n".format(self.headers) + error_message += "HTTP response headers: {0}\n".format( + self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) @@ -124,28 +125,27 @@ def __str__(self): return error_message -class BadRequestException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: - super(BadRequestException, self).__init__(status, reason, http_resp) - - class NotFoundException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__(self, status=None, reason=None, http_resp=None): super(NotFoundException, self).__init__(status, reason, http_resp) class UnauthorizedException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__(self, status=None, reason=None, http_resp=None): super(UnauthorizedException, self).__init__(status, reason, http_resp) class ForbiddenException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__(self, status=None, reason=None, http_resp=None): super(ForbiddenException, self).__init__(status, reason, http_resp) class ServiceException(ApiException): - def __init__(self, status=None, reason=None, http_resp=None) -> None: + + def __init__(self, status=None, reason=None, http_resp=None): super(ServiceException, self).__init__(status, reason, http_resp) diff --git a/pinecone/core/client/model/__init__.py b/pinecone/core/client/model/__init__.py new file mode 100644 index 00000000..cfe32b78 --- /dev/null +++ b/pinecone/core/client/model/__init__.py @@ -0,0 +1,5 @@ +# we can not import model classes here because that would create a circular +# reference which would not work in python2 +# do not import all models into this module because that uses a lot of memory and stack frames +# if you need the ability to import all models from one package, import them with +# from {{packageName}.models import ModelA, ModelB diff --git a/pinecone/core/client/model/approximated_config.py b/pinecone/core/client/model/approximated_config.py new file mode 100644 index 00000000..9e881a94 --- /dev/null +++ b/pinecone/core/client/model/approximated_config.py @@ -0,0 +1,260 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 ApproximatedConfig(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'k_bits': (int,), # noqa: E501 + 'hybrid': (bool,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'k_bits': 'k_bits', # noqa: E501 + 'hybrid': 'hybrid', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """ApproximatedConfig - a model defined in OpenAPI + + Keyword Args: + _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,) + k_bits (int): [optional] if omitted the server will use the default value of 512 # noqa: E501 + hybrid (bool): [optional] if omitted the server will use the default value of False # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """ApproximatedConfig - a model defined in OpenAPI + + Keyword Args: + _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,) + k_bits (int): [optional] if omitted the server will use the default value of 512 # noqa: E501 + hybrid (bool): [optional] if omitted the server will use the default value of False # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/collection_meta.py b/pinecone/core/client/model/collection_meta.py new file mode 100644 index 00000000..cc3bfa5f --- /dev/null +++ b/pinecone/core/client/model/collection_meta.py @@ -0,0 +1,272 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 CollectionMeta(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'name': (str,), # noqa: E501 + 'size': (int,), # noqa: E501 + 'status': (str,), # noqa: E501 + 'dimension': (int,), # noqa: E501 + 'vector_count': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'size': 'size', # noqa: E501 + 'status': 'status', # noqa: E501 + 'dimension': 'dimension', # noqa: E501 + 'vector_count': 'vector_count', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """CollectionMeta - a model defined in OpenAPI + + Keyword Args: + _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,) + name (str): [optional] # noqa: E501 + size (int): The size of the collection in bytes.. [optional] # noqa: E501 + status (str): The status of the collection.. [optional] # noqa: E501 + dimension (int): [optional] # noqa: E501 + vector_count (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """CollectionMeta - a model defined in OpenAPI + + Keyword Args: + _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,) + name (str): [optional] # noqa: E501 + size (int): The size of the collection in bytes.. [optional] # noqa: E501 + status (str): The status of the collection.. [optional] # noqa: E501 + dimension (int): [optional] # noqa: E501 + vector_count (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/create_collection_request.py b/pinecone/core/client/model/create_collection_request.py new file mode 100644 index 00000000..ac547441 --- /dev/null +++ b/pinecone/core/client/model/create_collection_request.py @@ -0,0 +1,268 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 CreateCollectionRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'name': (str,), # noqa: E501 + 'source': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'source': 'source', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, name, source, *args, **kwargs): # noqa: E501 + """CreateCollectionRequest - a model defined in OpenAPI + + Args: + name (str): The name of the collection to be created. + source (str): The name of the source index to be used as the source for the collection. + + Keyword Args: + _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,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.name = name + self.source = source + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, name, source, *args, **kwargs): # noqa: E501 + """CreateCollectionRequest - a model defined in OpenAPI + + Args: + name (str): The name of the collection to be created. + source (str): The name of the source index to be used as the source for the collection. + + Keyword Args: + _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,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.name = name + self.source = source + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/create_request.py b/pinecone/core/client/model/create_request.py new file mode 100644 index 00000000..0dbb9f90 --- /dev/null +++ b/pinecone/core/client/model/create_request.py @@ -0,0 +1,304 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 CreateRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'name': (str,), # noqa: E501 + 'dimension': (int,), # noqa: E501 + 'index_type': (str,), # noqa: E501 + 'metric': (str,), # noqa: E501 + 'pods': (int,), # noqa: E501 + 'replicas': (int,), # noqa: E501 + 'shards': (int,), # noqa: E501 + 'pod_type': (str,), # noqa: E501 + 'index_config': (dict,), # noqa: E501 + 'metadata_config': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501 + 'source_collection': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'dimension': 'dimension', # noqa: E501 + 'index_type': 'index_type', # noqa: E501 + 'metric': 'metric', # noqa: E501 + 'pods': 'pods', # noqa: E501 + 'replicas': 'replicas', # noqa: E501 + 'shards': 'shards', # noqa: E501 + 'pod_type': 'pod_type', # noqa: E501 + 'index_config': 'index_config', # noqa: E501 + 'metadata_config': 'metadata_config', # noqa: E501 + 'source_collection': 'source_collection', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, name, dimension, *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 + 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,) + 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 + replicas (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.. [optional] if omitted the server will use the default value of 1 # noqa: E501 + shards (int): The number of shards to be used in the index.. [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 + index_config (dict): [optional] # noqa: E501 + metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: ``` {\"indexed\": [\"example_metadata_field\"]} ``` . [optional] # noqa: E501 + source_collection (str): The name of the collection to create an index from. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.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 \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, name, dimension, *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 + 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,) + 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 + replicas (int): The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.. [optional] if omitted the server will use the default value of 1 # noqa: E501 + shards (int): The number of shards to be used in the index.. [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 + index_config (dict): [optional] # noqa: E501 + metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: ``` {\"indexed\": [\"example_metadata_field\"]} ``` . [optional] # noqa: E501 + source_collection (str): The name of the collection to create an index from. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.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 \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/delete_request.py b/pinecone/core/client/model/delete_request.py new file mode 100644 index 00000000..446466d5 --- /dev/null +++ b/pinecone/core/client/model/delete_request.py @@ -0,0 +1,270 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 DeleteRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('ids',): { + }, + } + + @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 { + 'ids': ([str],), # noqa: E501 + 'delete_all': (bool,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'filter': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'ids': 'ids', # noqa: E501 + 'delete_all': 'deleteAll', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'filter': 'filter', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """DeleteRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + ids ([str]): Vectors to delete.. [optional] # noqa: E501 + delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 + namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """DeleteRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + ids ([str]): Vectors to delete.. [optional] # noqa: E501 + delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 + namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/describe_index_stats_request.py b/pinecone/core/client/model/describe_index_stats_request.py new file mode 100644 index 00000000..da0eb0b2 --- /dev/null +++ b/pinecone/core/client/model/describe_index_stats_request.py @@ -0,0 +1,256 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 DescribeIndexStatsRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'filter': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'filter': 'filter', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """DescribeIndexStatsRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """DescribeIndexStatsRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/describe_index_stats_response.py b/pinecone/core/client/model/describe_index_stats_response.py new file mode 100644 index 00000000..9dc9c405 --- /dev/null +++ b/pinecone/core/client/model/describe_index_stats_response.py @@ -0,0 +1,274 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.namespace_summary import NamespaceSummary + globals()['NamespaceSummary'] = NamespaceSummary + + +class DescribeIndexStatsResponse(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'namespaces': ({str: (NamespaceSummary,)},), # noqa: E501 + 'dimension': (int,), # noqa: E501 + 'index_fullness': (float,), # noqa: E501 + 'total_vector_count': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'namespaces': 'namespaces', # noqa: E501 + 'dimension': 'dimension', # noqa: E501 + 'index_fullness': 'indexFullness', # noqa: E501 + 'total_vector_count': 'totalVectorCount', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """DescribeIndexStatsResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 + dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 + index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.. [optional] # noqa: E501 + total_vector_count (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """DescribeIndexStatsResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 + dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 + index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.. [optional] # noqa: E501 + total_vector_count (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/fetch_response.py b/pinecone/core/client/model/fetch_response.py new file mode 100644 index 00000000..d355980f --- /dev/null +++ b/pinecone/core/client/model/fetch_response.py @@ -0,0 +1,266 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.vector import Vector + globals()['Vector'] = Vector + + +class FetchResponse(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'vectors': ({str: (Vector,)},), # noqa: E501 + 'namespace': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'vectors': 'vectors', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """FetchResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + vectors ({str: (Vector,)}): [optional] # noqa: E501 + namespace (str): The namespace of the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """FetchResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + vectors ({str: (Vector,)}): [optional] # noqa: E501 + namespace (str): The namespace of the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/hnsw_config.py b/pinecone/core/client/model/hnsw_config.py new file mode 100644 index 00000000..d6a99a34 --- /dev/null +++ b/pinecone/core/client/model/hnsw_config.py @@ -0,0 +1,268 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 HnswConfig(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'ef_construction': (int,), # noqa: E501 + 'ef': (int,), # noqa: E501 + 'm': (int,), # noqa: E501 + 'max_elements': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'ef_construction': 'ef_construction', # noqa: E501 + 'ef': 'ef', # noqa: E501 + 'm': 'M', # noqa: E501 + 'max_elements': 'max_elements', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """HnswConfig - a model defined in OpenAPI + + Keyword Args: + _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,) + ef_construction (int): [optional] if omitted the server will use the default value of 500 # noqa: E501 + ef (int): [optional] if omitted the server will use the default value of 250 # noqa: E501 + m (int): [optional] if omitted the server will use the default value of 12 # noqa: E501 + max_elements (int): [optional] if omitted the server will use the default value of 50000000 # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """HnswConfig - a model defined in OpenAPI + + Keyword Args: + _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,) + ef_construction (int): [optional] if omitted the server will use the default value of 500 # noqa: E501 + ef (int): [optional] if omitted the server will use the default value of 250 # noqa: E501 + m (int): [optional] if omitted the server will use the default value of 12 # noqa: E501 + max_elements (int): [optional] if omitted the server will use the default value of 50000000 # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_meta.py b/pinecone/core/client/model/index_meta.py new file mode 100644 index 00000000..5f17947d --- /dev/null +++ b/pinecone/core/client/model/index_meta.py @@ -0,0 +1,268 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.index_meta_database import IndexMetaDatabase + from pinecone.core.client.model.index_meta_status import IndexMetaStatus + globals()['IndexMetaDatabase'] = IndexMetaDatabase + globals()['IndexMetaStatus'] = IndexMetaStatus + + +class IndexMeta(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'database': (IndexMetaDatabase,), # noqa: E501 + 'status': (IndexMetaStatus,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'database': 'database', # noqa: E501 + 'status': 'status', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """IndexMeta - a model defined in OpenAPI + + Keyword Args: + _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,) + database (IndexMetaDatabase): [optional] # noqa: E501 + status (IndexMetaStatus): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """IndexMeta - a model defined in OpenAPI + + Keyword Args: + _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,) + database (IndexMetaDatabase): [optional] # noqa: E501 + status (IndexMetaStatus): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_meta_database.py b/pinecone/core/client/model/index_meta_database.py new file mode 100644 index 00000000..d93ddf05 --- /dev/null +++ b/pinecone/core/client/model/index_meta_database.py @@ -0,0 +1,292 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 IndexMetaDatabase(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'name': (str,), # noqa: E501 + 'dimension': (str,), # noqa: E501 + 'index_type': (str,), # noqa: E501 + 'metric': (str,), # noqa: E501 + 'pods': (int,), # noqa: E501 + 'replicas': (int,), # noqa: E501 + 'shards': (int,), # noqa: E501 + 'pod_type': (str,), # noqa: E501 + 'index_config': (dict,), # noqa: E501 + 'metadata_config': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'name': 'name', # noqa: E501 + 'dimension': 'dimension', # noqa: E501 + 'index_type': 'index_type', # noqa: E501 + 'metric': 'metric', # noqa: E501 + 'pods': 'pods', # noqa: E501 + 'replicas': 'replicas', # noqa: E501 + 'shards': 'shards', # noqa: E501 + 'pod_type': 'pod_type', # noqa: E501 + 'index_config': 'index_config', # noqa: E501 + 'metadata_config': 'metadata_config', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """IndexMetaDatabase - a model defined in OpenAPI + + Keyword Args: + _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,) + name (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 + replicas (int): [optional] # noqa: E501 + shards (int): [optional] # noqa: E501 + pod_type (str): [optional] # noqa: E501 + index_config (dict): [optional] # noqa: E501 + metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """IndexMetaDatabase - a model defined in OpenAPI + + Keyword Args: + _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,) + name (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 + replicas (int): [optional] # noqa: E501 + shards (int): [optional] # noqa: E501 + pod_type (str): [optional] # noqa: E501 + index_config (dict): [optional] # noqa: E501 + metadata_config ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/index_meta_status.py b/pinecone/core/client/model/index_meta_status.py new file mode 100644 index 00000000..62abdbd6 --- /dev/null +++ b/pinecone/core/client/model/index_meta_status.py @@ -0,0 +1,278 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 IndexMetaStatus(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('state',): { + 'INITIALIZING': "Initializing", + 'INITIALIZATIONFAILED': "InitializationFailed", + 'SCALINGUP': "ScalingUp", + 'SCALINGDOWN': "ScalingDown", + 'SCALINGUPPODSIZE': "ScalingUpPodSize", + 'SCALINGDOWNPODSIZE': "ScalingDownPodSize", + 'TERMINATING': "Terminating", + 'READY': "Ready", + }, + } + + 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 { + 'ready': (bool,), # noqa: E501 + 'state': (str,), # noqa: E501 + 'host': (str,), # noqa: E501 + 'port': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'ready': 'ready', # noqa: E501 + 'state': 'state', # noqa: E501 + 'host': 'host', # noqa: E501 + 'port': 'port', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """IndexMetaStatus - a model defined in OpenAPI + + Keyword Args: + _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,) + ready (bool): [optional] # noqa: E501 + state (str): [optional] # noqa: E501 + host (str): [optional] # noqa: E501 + port (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """IndexMetaStatus - a model defined in OpenAPI + + Keyword Args: + _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,) + ready (bool): [optional] # noqa: E501 + state (str): [optional] # noqa: E501 + host (str): [optional] # noqa: E501 + port (int): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/namespace_summary.py b/pinecone/core/client/model/namespace_summary.py new file mode 100644 index 00000000..33633f79 --- /dev/null +++ b/pinecone/core/client/model/namespace_summary.py @@ -0,0 +1,256 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 NamespaceSummary(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'vector_count': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'vector_count': 'vectorCount', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """NamespaceSummary - a model defined in OpenAPI + + Keyword Args: + _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,) + vector_count (int): The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the underlying index and corresponding query results, etc.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """NamespaceSummary - a model defined in OpenAPI + + Keyword Args: + _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,) + vector_count (int): The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the underlying index and corresponding query results, etc.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/patch_request.py b/pinecone/core/client/model/patch_request.py new file mode 100644 index 00000000..53425c22 --- /dev/null +++ b/pinecone/core/client/model/patch_request.py @@ -0,0 +1,260 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 PatchRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'replicas': (int,), # noqa: E501 + 'pod_type': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'replicas': 'replicas', # noqa: E501 + 'pod_type': 'pod_type', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """PatchRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + replicas (int): The desired number of replicas for the index.. [optional] # noqa: E501 + pod_type (str): The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """PatchRequest - a model defined in OpenAPI + + Keyword Args: + _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,) + replicas (int): The desired number of replicas for the index.. [optional] # noqa: E501 + pod_type (str): The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/protobuf_any.py b/pinecone/core/client/model/protobuf_any.py new file mode 100644 index 00000000..365f5064 --- /dev/null +++ b/pinecone/core/client/model/protobuf_any.py @@ -0,0 +1,260 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 ProtobufAny(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'type_url': (str,), # noqa: E501 + 'value': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'type_url': 'typeUrl', # noqa: E501 + 'value': 'value', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """ProtobufAny - a model defined in OpenAPI + + Keyword Args: + _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,) + type_url (str): [optional] # noqa: E501 + value (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """ProtobufAny - a model defined in OpenAPI + + Keyword Args: + _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,) + type_url (str): [optional] # noqa: E501 + value (str): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/protobuf_null_value.py b/pinecone/core/client/model/protobuf_null_value.py new file mode 100644 index 00000000..63129117 --- /dev/null +++ b/pinecone/core/client/model/protobuf_null_value.py @@ -0,0 +1,280 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 ProtobufNullValue(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',): { + 'NULL_VALUE': "NULL_VALUE", + }, + } + + 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): + """ProtobufNullValue - 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): `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value.. if omitted defaults to "NULL_VALUE", must be one of ["NULL_VALUE", ] # noqa: E501 + + Keyword Args: + value (str): `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value.. if omitted defaults to "NULL_VALUE", must be one of ["NULL_VALUE", ] # 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 = "NULL_VALUE" + + _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): + """ProtobufNullValue - 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): `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value.. if omitted defaults to "NULL_VALUE", must be one of ["NULL_VALUE", ] # noqa: E501 + + Keyword Args: + value (str): `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value.. if omitted defaults to "NULL_VALUE", must be one of ["NULL_VALUE", ] # 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 = "NULL_VALUE" + + _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/query_request.py b/pinecone/core/client/model/query_request.py new file mode 100644 index 00000000..774d06f7 --- /dev/null +++ b/pinecone/core/client/model/query_request.py @@ -0,0 +1,313 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.query_vector import QueryVector + from pinecone.core.client.model.sparse_values import SparseValues + globals()['QueryVector'] = QueryVector + globals()['SparseValues'] = SparseValues + + +class QueryRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('top_k',): { + 'inclusive_maximum': 10000, + 'inclusive_minimum': 1, + }, + ('queries',): { + }, + ('vector',): { + }, + ('id',): { + 'max_length': 512, + }, + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'top_k': (int,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'filter': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'include_values': (bool,), # noqa: E501 + 'include_metadata': (bool,), # noqa: E501 + 'queries': ([QueryVector],), # noqa: E501 + 'vector': ([float],), # noqa: E501 + 'sparse_vector': (SparseValues,), # noqa: E501 + 'id': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'top_k': 'topK', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'filter': 'filter', # noqa: E501 + 'include_values': 'includeValues', # noqa: E501 + 'include_metadata': 'includeMetadata', # noqa: E501 + 'queries': 'queries', # noqa: E501 + 'vector': 'vector', # noqa: E501 + 'sparse_vector': 'sparseVector', # noqa: E501 + 'id': 'id', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, top_k, *args, **kwargs): # noqa: E501 + """QueryRequest - a model defined in OpenAPI + + Args: + top_k (int): The number of results to return for each query. + + Keyword Args: + _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,) + namespace (str): The namespace to query.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 + include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 + queries ([QueryVector]): DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 + vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.. [optional] # noqa: E501 + sparse_vector (SparseValues): [optional] # noqa: E501 + id (str): The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.top_k = top_k + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, top_k, *args, **kwargs): # noqa: E501 + """QueryRequest - a model defined in OpenAPI + + Args: + top_k (int): The number of results to return for each query. + + Keyword Args: + _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,) + namespace (str): The namespace to query.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.. [optional] # noqa: E501 + include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 + include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 + queries ([QueryVector]): DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 + vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.. [optional] # noqa: E501 + sparse_vector (SparseValues): [optional] # noqa: E501 + id (str): The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.top_k = top_k + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/query_response.py b/pinecone/core/client/model/query_response.py new file mode 100644 index 00000000..886c9300 --- /dev/null +++ b/pinecone/core/client/model/query_response.py @@ -0,0 +1,272 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.scored_vector import ScoredVector + from pinecone.core.client.model.single_query_results import SingleQueryResults + globals()['ScoredVector'] = ScoredVector + globals()['SingleQueryResults'] = SingleQueryResults + + +class QueryResponse(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'results': ([SingleQueryResults],), # noqa: E501 + 'matches': ([ScoredVector],), # noqa: E501 + 'namespace': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'results': 'results', # noqa: E501 + 'matches': 'matches', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """QueryResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.. [optional] # noqa: E501 + matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 + namespace (str): The namespace for the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """QueryResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.. [optional] # noqa: E501 + matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 + namespace (str): The namespace for the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/query_vector.py b/pinecone/core/client/model/query_vector.py new file mode 100644 index 00000000..b7220d5d --- /dev/null +++ b/pinecone/core/client/model/query_vector.py @@ -0,0 +1,290 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.sparse_values import SparseValues + globals()['SparseValues'] = SparseValues + + +class QueryVector(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('values',): { + }, + ('top_k',): { + 'inclusive_maximum': 10000, + '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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'values': ([float],), # noqa: E501 + 'sparse_values': (SparseValues,), # noqa: E501 + 'top_k': (int,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'filter': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'values': 'values', # noqa: E501 + 'sparse_values': 'sparseValues', # noqa: E501 + 'top_k': 'topK', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'filter': 'filter', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, values, *args, **kwargs): # noqa: E501 + """QueryVector - a model defined in OpenAPI + + Args: + values ([float]): The query vector values. This should be the same length as the dimension of the index being queried. + + Keyword Args: + _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,) + sparse_values (SparseValues): [optional] # noqa: E501 + top_k (int): An override for the number of results to return for this query vector.. [optional] # noqa: E501 + namespace (str): An override the namespace to search.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): An override for the metadata filter to apply. This replaces the request-level filter.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, values, *args, **kwargs): # noqa: E501 + """QueryVector - a model defined in OpenAPI + + Args: + values ([float]): The query vector values. This should be the same length as the dimension of the index being queried. + + Keyword Args: + _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,) + sparse_values (SparseValues): [optional] # noqa: E501 + top_k (int): An override for the number of results to return for this query vector.. [optional] # noqa: E501 + namespace (str): An override the namespace to search.. [optional] # noqa: E501 + filter ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): An override for the metadata filter to apply. This replaces the request-level filter.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/rpc_status.py b/pinecone/core/client/model/rpc_status.py new file mode 100644 index 00000000..30ff15f9 --- /dev/null +++ b/pinecone/core/client/model/rpc_status.py @@ -0,0 +1,270 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.protobuf_any import ProtobufAny + globals()['ProtobufAny'] = ProtobufAny + + +class RpcStatus(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'code': (int,), # noqa: E501 + 'message': (str,), # noqa: E501 + 'details': ([ProtobufAny],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'code': 'code', # noqa: E501 + 'message': 'message', # noqa: E501 + 'details': 'details', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """RpcStatus - a model defined in OpenAPI + + Keyword Args: + _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,) + code (int): [optional] # noqa: E501 + message (str): [optional] # noqa: E501 + details ([ProtobufAny]): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """RpcStatus - a model defined in OpenAPI + + Keyword Args: + _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,) + code (int): [optional] # noqa: E501 + message (str): [optional] # noqa: E501 + details ([ProtobufAny]): [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/scored_vector.py b/pinecone/core/client/model/scored_vector.py new file mode 100644 index 00000000..88cd807d --- /dev/null +++ b/pinecone/core/client/model/scored_vector.py @@ -0,0 +1,288 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.sparse_values import SparseValues + globals()['SparseValues'] = SparseValues + + +class ScoredVector(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('id',): { + 'max_length': 512, + 'min_length': 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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'id': (str,), # noqa: E501 + 'score': (float,), # noqa: E501 + 'values': ([float],), # noqa: E501 + 'sparse_values': (SparseValues,), # noqa: E501 + 'metadata': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'score': 'score', # noqa: E501 + 'values': 'values', # noqa: E501 + 'sparse_values': 'sparseValues', # noqa: E501 + 'metadata': 'metadata', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 + """ScoredVector - a model defined in OpenAPI + + Args: + id (str): This is the vector's unique id. + + Keyword Args: + _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,) + score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 + values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 + sparse_values (SparseValues): [optional] # noqa: E501 + metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.id = id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, id, *args, **kwargs): # noqa: E501 + """ScoredVector - a model defined in OpenAPI + + Args: + id (str): This is the vector's unique id. + + Keyword Args: + _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,) + score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 + values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 + sparse_values (SparseValues): [optional] # noqa: E501 + metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.id = id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/single_query_results.py b/pinecone/core/client/model/single_query_results.py new file mode 100644 index 00000000..0c741562 --- /dev/null +++ b/pinecone/core/client/model/single_query_results.py @@ -0,0 +1,266 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.scored_vector import ScoredVector + globals()['ScoredVector'] = ScoredVector + + +class SingleQueryResults(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'matches': ([ScoredVector],), # noqa: E501 + 'namespace': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'matches': 'matches', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """SingleQueryResults - a model defined in OpenAPI + + Keyword Args: + _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,) + matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 + namespace (str): The namespace for the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """SingleQueryResults - a model defined in OpenAPI + + Keyword Args: + _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,) + matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 + namespace (str): The namespace for the vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/sparse_values.py b/pinecone/core/client/model/sparse_values.py new file mode 100644 index 00000000..4d619531 --- /dev/null +++ b/pinecone/core/client/model/sparse_values.py @@ -0,0 +1,272 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 SparseValues(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('indices',): { + }, + ('values',): { + }, + } + + @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 { + 'indices': ([int],), # noqa: E501 + 'values': ([float],), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'indices': 'indices', # noqa: E501 + 'values': 'values', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, indices, values, *args, **kwargs): # noqa: E501 + """SparseValues - a model defined in OpenAPI + + Args: + indices ([int]): The indices of the sparse data. + values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices. + + Keyword Args: + _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,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.indices = indices + self.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, indices, values, *args, **kwargs): # noqa: E501 + """SparseValues - a model defined in OpenAPI + + Args: + indices ([int]): The indices of the sparse data. + values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices. + + Keyword Args: + _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,) + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.indices = indices + self.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/update_request.py b/pinecone/core/client/model/update_request.py new file mode 100644 index 00000000..1aec2bd8 --- /dev/null +++ b/pinecone/core/client/model/update_request.py @@ -0,0 +1,290 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.sparse_values import SparseValues + globals()['SparseValues'] = SparseValues + + +class UpdateRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('id',): { + 'max_length': 512, + 'min_length': 1, + }, + ('values',): { + }, + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'id': (str,), # noqa: E501 + 'values': ([float],), # noqa: E501 + 'sparse_values': (SparseValues,), # noqa: E501 + 'set_metadata': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + 'namespace': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'values': 'values', # noqa: E501 + 'sparse_values': 'sparseValues', # noqa: E501 + 'set_metadata': 'setMetadata', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 + """UpdateRequest - a model defined in OpenAPI + + Args: + id (str): Vector's unique id. + + Keyword Args: + _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,) + values ([float]): Vector data.. [optional] # noqa: E501 + sparse_values (SparseValues): [optional] # noqa: E501 + set_metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Metadata to *set* for the vector.. [optional] # noqa: E501 + namespace (str): Namespace name where to update the vector.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.id = id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, id, *args, **kwargs): # noqa: E501 + """UpdateRequest - a model defined in OpenAPI + + Args: + id (str): Vector's unique id. + + Keyword Args: + _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,) + values ([float]): Vector data.. [optional] # noqa: E501 + sparse_values (SparseValues): [optional] # noqa: E501 + set_metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Metadata to *set* for the vector.. [optional] # noqa: E501 + namespace (str): Namespace name where to update the vector.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.id = id + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/upsert_request.py b/pinecone/core/client/model/upsert_request.py new file mode 100644 index 00000000..0ebf0aae --- /dev/null +++ b/pinecone/core/client/model/upsert_request.py @@ -0,0 +1,274 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.vector import Vector + globals()['Vector'] = Vector + + +class UpsertRequest(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('vectors',): { + }, + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'vectors': ([Vector],), # noqa: E501 + 'namespace': (str,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'vectors': 'vectors', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, vectors, *args, **kwargs): # noqa: E501 + """UpsertRequest - a model defined in OpenAPI + + Args: + vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors. + + Keyword Args: + _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,) + namespace (str): This is the namespace name where you upsert vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.vectors = vectors + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, vectors, *args, **kwargs): # noqa: E501 + """UpsertRequest - a model defined in OpenAPI + + Args: + vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors. + + Keyword Args: + _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,) + namespace (str): This is the namespace name where you upsert vectors.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.vectors = vectors + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/upsert_response.py b/pinecone/core/client/model/upsert_response.py new file mode 100644 index 00000000..831fb39b --- /dev/null +++ b/pinecone/core/client/model/upsert_response.py @@ -0,0 +1,256 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 UpsertResponse(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + } + + @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 { + 'upserted_count': (int,), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'upserted_count': 'upsertedCount', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 + """UpsertResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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): # noqa: E501 + """UpsertResponse - a model defined in OpenAPI + + Keyword Args: + _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,) + upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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__,) + + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model/vector.py b/pinecone/core/client/model/vector.py new file mode 100644 index 00000000..e3aef790 --- /dev/null +++ b/pinecone/core/client/model/vector.py @@ -0,0 +1,288 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + 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 + + +def lazy_import(): + from pinecone.core.client.model.sparse_values import SparseValues + globals()['SparseValues'] = SparseValues + + +class Vector(ModelNormal): + """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. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + discriminator_value_class_map (dict): A dict to go from the discriminator + variable value to the discriminator class name. + 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 = { + ('id',): { + 'max_length': 512, + 'min_length': 1, + }, + ('values',): { + }, + } + + @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 + """ + lazy_import() + 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. + """ + lazy_import() + return { + 'id': (str,), # noqa: E501 + 'values': ([float],), # noqa: E501 + 'sparse_values': (SparseValues,), # noqa: E501 + 'metadata': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_property + def discriminator(): + return None + + + attribute_map = { + 'id': 'id', # noqa: E501 + 'values': 'values', # noqa: E501 + 'sparse_values': 'sparseValues', # noqa: E501 + 'metadata': 'metadata', # noqa: E501 + } + + read_only_vars = { + } + + _composed_schemas = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls, id, values, *args, **kwargs): # noqa: E501 + """Vector - a model defined in OpenAPI + + Args: + id (str): This is the vector's unique id. + values ([float]): This is the vector data included in the request. + + Keyword Args: + _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,) + sparse_values (SparseValues): [optional] # noqa: E501 + metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _configuration = kwargs.pop('_configuration', None) + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) + + self = super(OpenApiModel, cls).__new__(cls) + + 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.id = id + self.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + return self + + 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, id, values, *args, **kwargs): # noqa: E501 + """Vector - a model defined in OpenAPI + + Args: + id (str): This is the vector's unique id. + values ([float]): This is the vector data included in the request. + + Keyword Args: + _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,) + sparse_values (SparseValues): [optional] # noqa: E501 + metadata ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501 + """ + + _check_type = kwargs.pop('_check_type', True) + _spec_property_naming = kwargs.pop('_spec_property_naming', False) + _path_to_item = kwargs.pop('_path_to_item', ()) + _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.id = id + self.values = values + for var_name, var_value in kwargs.items(): + if var_name not in self.attribute_map and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self.additional_properties_type is None: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") diff --git a/pinecone/core/client/model_utils.py b/pinecone/core/client/model_utils.py new file mode 100644 index 00000000..940cc93a --- /dev/null +++ b/pinecone/core/client/model_utils.py @@ -0,0 +1,1993 @@ +""" + Pinecone API + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 + + The version of the OpenAPI document: version not set + Contact: support@pinecone.io + Generated by: https://openapi-generator.tech +""" + + +from datetime import date, datetime # noqa: F401 +import inspect +import io +import os +import pprint +import re +import tempfile + +from dateutil.parser import parse + +from pinecone.core.client.exceptions import ( + ApiKeyError, + ApiAttributeError, + ApiTypeError, + ApiValueError, +) + +none_type = type(None) +file_type = io.IOBase + + +def convert_js_args_to_python_args(fn): + from functools import wraps + @wraps(fn) + def wrapped_init(_self, *args, **kwargs): + """ + An attribute named `self` received from the api will conflicts with the reserved `self` + parameter of a class method. During generation, `self` attributes are mapped + to `_self` in models. Here, we name `_self` instead of `self` to avoid conflicts. + """ + spec_property_naming = kwargs.get('_spec_property_naming', False) + if spec_property_naming: + kwargs = change_keys_js_to_python(kwargs, _self if isinstance(_self, type) else _self.__class__) + return fn(_self, *args, **kwargs) + return wrapped_init + + +class cached_property(object): + # this caches the result of the function call for fn with no inputs + # use this as a decorator on function methods that you want converted + # into cached properties + result_key = '_results' + + def __init__(self, fn): + self._fn = fn + + def __get__(self, instance, cls=None): + if self.result_key in vars(self): + return vars(self)[self.result_key] + else: + result = self._fn() + setattr(self, self.result_key, result) + return result + + +PRIMITIVE_TYPES = (list, float, int, bool, datetime, date, str, file_type) + +def allows_single_value_input(cls): + """ + This function returns True if the input composed schema model or any + descendant model allows a value only input + This is true for cases where oneOf contains items like: + oneOf: + - float + - NumberWithValidation + - StringEnum + - ArrayModel + - null + TODO: lru_cache this + """ + if ( + issubclass(cls, ModelSimple) or + cls in PRIMITIVE_TYPES + ): + return True + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return False + return any(allows_single_value_input(c) for c in cls._composed_schemas['oneOf']) + return False + +def composed_model_input_classes(cls): + """ + This function returns a list of the possible models that can be accepted as + inputs. + TODO: lru_cache this + """ + if issubclass(cls, ModelSimple) or cls in PRIMITIVE_TYPES: + return [cls] + elif issubclass(cls, ModelNormal): + if cls.discriminator is None: + return [cls] + else: + return get_discriminated_classes(cls) + elif issubclass(cls, ModelComposed): + if not cls._composed_schemas['oneOf']: + return [] + if cls.discriminator is None: + input_classes = [] + for c in cls._composed_schemas['oneOf']: + input_classes.extend(composed_model_input_classes(c)) + return input_classes + else: + return get_discriminated_classes(cls) + return [] + + +class OpenApiModel(object): + """The base class for all OpenAPIModels""" + + def set_attribute(self, name, value): + # this is only used to set properties on self + + path_to_item = [] + if self._path_to_item: + path_to_item.extend(self._path_to_item) + path_to_item.append(name) + + if name in self.openapi_types: + required_types_mixed = self.openapi_types[name] + elif self.additional_properties_type is None: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + path_to_item + ) + elif self.additional_properties_type is not None: + required_types_mixed = self.additional_properties_type + + if get_simple_class(name) != str: + error_msg = type_error_message( + var_name=name, + var_value=name, + valid_classes=(str,), + key_type=True + ) + raise ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=(str,), + key_type=True + ) + + if self._check_type: + value = validate_and_convert_types( + value, required_types_mixed, path_to_item, self._spec_property_naming, + self._check_type, configuration=self._configuration) + if (name,) in self.allowed_values: + check_allowed_values( + self.allowed_values, + (name,), + value + ) + if (name,) in self.validations: + check_validations( + self.validations, + (name,), + value, + self._configuration + ) + self.__dict__['_data_store'][name] = value + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + return not self == other + + def __setattr__(self, attr, value): + """set the value of an attribute using dot notation: `instance.attr = val`""" + self[attr] = value + + def __getattr__(self, attr): + """get the value of an attribute using dot notation: `instance.attr`""" + return self.get(attr) + + def __new__(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + if len(args) == 1: + arg = args[0] + if arg is None and is_type_nullable(cls): + # The input data is the 'null' value and the type is nullable. + return None + + if issubclass(cls, ModelComposed) and allows_single_value_input(cls): + model_kwargs = {} + oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) + return oneof_instance + + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # Use case 1: this openapi schema (cls) does not have a discriminator + # Use case 2: we have already visited this class before and are sure that we + # want to instantiate it this time. We have visited this class deserializing + # a payload with a discriminator. During that process we traveled through + # this class but did not make an instance of it. Now we are making an + # instance of a composed class which contains cls in it, so this time make an instance of cls. + # + # Here's an example of use case 2: 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 the composed schema dog Dog, we will make an instance of the + # Animal class (because Dal has allOf: Animal) but this time we won't travel + # through Animal's discriminator because we passed in + # _visited_composed_classes = (Animal,) + + return super(OpenApiModel, cls).__new__(cls) + + # Get the name and value of the discriminator property. + # The discriminator name is obtained from the discriminator meta-data + # and the discriminator value is obtained from the input data. + discr_propertyname_py = list(cls.discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in kwargs: + discr_value = kwargs[discr_propertyname_js] + elif discr_propertyname_py in kwargs: + discr_value = kwargs[discr_propertyname_py] + else: + # The input data does not contain the discriminator property. + path_to_item = kwargs.get('_path_to_item', ()) + raise ApiValueError( + "Cannot deserialize input data due to missing discriminator. " + "The discriminator property '%s' is missing at path: %s" % + (discr_propertyname_js, path_to_item) + ) + + # Implementation note: the last argument to get_discriminator_class + # is a list of visited classes. get_discriminator_class may recursively + # call itself and update the list of visited classes, and the initial + # value must be an empty list. Hence not using 'visited_composed_classes' + new_cls = get_discriminator_class( + cls, discr_propertyname_py, discr_value, []) + if new_cls is None: + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + discr_propertyname_js, kwargs.get(discr_propertyname_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (discr_propertyname_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are making an instance of a composed schema Descendent + # which allOf includes Ancestor, then Ancestor contains + # a discriminator that includes Descendent. + # So if we make an instance of Descendent, we have to make an + # instance of Ancestor to hold the allOf properties. + # This code detects that use case and makes the instance of Ancestor + # For example: + # When making an instance of Dog, _visited_composed_classes = (Dog,) + # then we make an instance of Animal to include in dog._composed_instances + # so when we are here, cls is Animal + # cls.discriminator != None + # cls not in _visited_composed_classes + # new_cls = Dog + # but we know we know that we already have Dog + # because it is in visited_composed_classes + # so make Animal here + return super(OpenApiModel, cls).__new__(cls) + + # Build a list containing all oneOf and anyOf descendants. + oneof_anyof_classes = None + if cls._composed_schemas is not None: + oneof_anyof_classes = ( + cls._composed_schemas.get('oneOf', ()) + + cls._composed_schemas.get('anyOf', ())) + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # Validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = super(OpenApiModel, cls).__new__(cls) + self_inst.__init__(*args, **kwargs) + + new_inst = new_cls.__new__(new_cls, *args, **kwargs) + new_inst.__init__(*args, **kwargs) + return new_inst + + + @classmethod + @convert_js_args_to_python_args + def _new_from_openapi_data(cls, *args, **kwargs): + # this function uses the discriminator to + # pick a new schema/class to instantiate because a discriminator + # propertyName value was passed in + + if len(args) == 1: + arg = args[0] + if arg is None and is_type_nullable(cls): + # The input data is the 'null' value and the type is nullable. + return None + + if issubclass(cls, ModelComposed) and allows_single_value_input(cls): + model_kwargs = {} + oneof_instance = get_oneof_instance(cls, model_kwargs, kwargs, model_arg=arg) + return oneof_instance + + + visited_composed_classes = kwargs.get('_visited_composed_classes', ()) + if ( + cls.discriminator is None or + cls in visited_composed_classes + ): + # Use case 1: this openapi schema (cls) does not have a discriminator + # Use case 2: we have already visited this class before and are sure that we + # want to instantiate it this time. We have visited this class deserializing + # a payload with a discriminator. During that process we traveled through + # this class but did not make an instance of it. Now we are making an + # instance of a composed class which contains cls in it, so this time make an instance of cls. + # + # Here's an example of use case 2: 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 the composed schema dog Dog, we will make an instance of the + # Animal class (because Dal has allOf: Animal) but this time we won't travel + # through Animal's discriminator because we passed in + # _visited_composed_classes = (Animal,) + + return cls._from_openapi_data(*args, **kwargs) + + # Get the name and value of the discriminator property. + # The discriminator name is obtained from the discriminator meta-data + # and the discriminator value is obtained from the input data. + discr_propertyname_py = list(cls.discriminator.keys())[0] + discr_propertyname_js = cls.attribute_map[discr_propertyname_py] + if discr_propertyname_js in kwargs: + discr_value = kwargs[discr_propertyname_js] + elif discr_propertyname_py in kwargs: + discr_value = kwargs[discr_propertyname_py] + else: + # The input data does not contain the discriminator property. + path_to_item = kwargs.get('_path_to_item', ()) + raise ApiValueError( + "Cannot deserialize input data due to missing discriminator. " + "The discriminator property '%s' is missing at path: %s" % + (discr_propertyname_js, path_to_item) + ) + + # Implementation note: the last argument to get_discriminator_class + # is a list of visited classes. get_discriminator_class may recursively + # call itself and update the list of visited classes, and the initial + # value must be an empty list. Hence not using 'visited_composed_classes' + new_cls = get_discriminator_class( + cls, discr_propertyname_py, discr_value, []) + if new_cls is None: + path_to_item = kwargs.get('_path_to_item', ()) + disc_prop_value = kwargs.get( + discr_propertyname_js, kwargs.get(discr_propertyname_py)) + raise ApiValueError( + "Cannot deserialize input data due to invalid discriminator " + "value. The OpenAPI document has no mapping for discriminator " + "property '%s'='%s' at path: %s" % + (discr_propertyname_js, disc_prop_value, path_to_item) + ) + + if new_cls in visited_composed_classes: + # if we are making an instance of a composed schema Descendent + # which allOf includes Ancestor, then Ancestor contains + # a discriminator that includes Descendent. + # So if we make an instance of Descendent, we have to make an + # instance of Ancestor to hold the allOf properties. + # This code detects that use case and makes the instance of Ancestor + # For example: + # When making an instance of Dog, _visited_composed_classes = (Dog,) + # then we make an instance of Animal to include in dog._composed_instances + # so when we are here, cls is Animal + # cls.discriminator != None + # cls not in _visited_composed_classes + # new_cls = Dog + # but we know we know that we already have Dog + # because it is in visited_composed_classes + # so make Animal here + return cls._from_openapi_data(*args, **kwargs) + + # Build a list containing all oneOf and anyOf descendants. + oneof_anyof_classes = None + if cls._composed_schemas is not None: + oneof_anyof_classes = ( + cls._composed_schemas.get('oneOf', ()) + + cls._composed_schemas.get('anyOf', ())) + oneof_anyof_child = new_cls in oneof_anyof_classes + kwargs['_visited_composed_classes'] = visited_composed_classes + (cls,) + + if cls._composed_schemas.get('allOf') and oneof_anyof_child: + # Validate that we can make self because when we make the + # new_cls it will not include the allOf validations in self + self_inst = cls._from_openapi_data(*args, **kwargs) + + + new_inst = new_cls._new_from_openapi_data(*args, **kwargs) + return new_inst + + +class ModelSimple(OpenApiModel): + """the parent class of models whose type != object in their + swagger/openapi""" + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + self.set_attribute(name, value) + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + return self.__dict__['_data_store'].get(name, default) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + if name in self: + return self.get(name) + + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + if name in self.required_properties: + return name in self.__dict__ + + return name in self.__dict__['_data_store'] + + def to_str(self): + """Returns the string representation of the model""" + return str(self.value) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + this_val = self._data_store['value'] + that_val = other._data_store['value'] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + return vals_equal + + +class ModelNormal(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi""" + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + self.set_attribute(name, value) + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + return self.__dict__['_data_store'].get(name, default) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + if name in self: + return self.get(name) + + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + if name in self.required_properties: + return name in self.__dict__ + + return name in self.__dict__['_data_store'] + + def to_dict(self): + """Returns the model properties as a dict""" + return model_to_dict(self, serialize=False) + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + if not set(self._data_store.keys()) == set(other._data_store.keys()): + return False + for _var_name, this_val in self._data_store.items(): + that_val = other._data_store[_var_name] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + if not vals_equal: + return False + return True + + +class ModelComposed(OpenApiModel): + """the parent class of models whose type == object in their + swagger/openapi and have oneOf/allOf/anyOf + + When one sets a property we use var_name_to_model_instances to store the value in + the correct class instances + run any type checking + validation code. + When one gets a property we use var_name_to_model_instances to get the value + from the correct class instances. + This allows multiple composed schemas to contain the same property with additive + constraints on the value. + + _composed_schemas (dict) stores the anyOf/allOf/oneOf classes + key (str): allOf/oneOf/anyOf + value (list): the classes in the XOf definition. + Note: none_type can be included when the openapi document version >= 3.1.0 + _composed_instances (list): stores a list of instances of the composed schemas + defined in _composed_schemas. When properties are accessed in the self instance, + they are returned from the self._data_store or the data stores in the instances + in self._composed_schemas + _var_name_to_model_instances (dict): maps between a variable name on self and + the composed instances (self included) which contain that data + key (str): property name + value (list): list of class instances, self or instances in _composed_instances + which contain the value that the key is referring to. + """ + + def __setitem__(self, name, value): + """set the value of an attribute using square-bracket notation: `instance[attr] = val`""" + if name in self.required_properties: + self.__dict__[name] = value + return + + """ + Use cases: + 1. additional_properties_type is None (additionalProperties == False in spec) + Check for property presence in self.openapi_types + if not present then throw an error + if present set in self, set attribute + always set on composed schemas + 2. additional_properties_type exists + set attribute on self + always set on composed schemas + """ + if self.additional_properties_type is None: + """ + For an attribute to exist on a composed schema it must: + - fulfill schema_requirements in the self composed schema not considering oneOf/anyOf/allOf schemas AND + - fulfill schema_requirements in each oneOf/anyOf/allOf schemas + + schema_requirements: + For an attribute to exist on a schema it must: + - be present in properties at the schema OR + - have additionalProperties unset (defaults additionalProperties = any type) OR + - have additionalProperties set + """ + if name not in self.openapi_types: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + # attribute must be set on self and composed instances + self.set_attribute(name, value) + for model_instance in self._composed_instances: + setattr(model_instance, name, value) + if name not in self._var_name_to_model_instances: + # we assigned an additional property + self.__dict__['_var_name_to_model_instances'][name] = self._composed_instances + [self] + return None + + __unset_attribute_value__ = object() + + def get(self, name, default=None): + """returns the value of an attribute or some default value if the attribute was not set""" + if name in self.required_properties: + return self.__dict__[name] + + # get the attribute from the correct instance + model_instances = self._var_name_to_model_instances.get(name) + values = [] + # A composed model stores self and child (oneof/anyOf/allOf) models under + # self._var_name_to_model_instances. + # Any property must exist in self and all model instances + # The value stored in all model instances must be the same + if model_instances: + for model_instance in model_instances: + if name in model_instance._data_store: + v = model_instance._data_store[name] + if v not in values: + values.append(v) + len_values = len(values) + if len_values == 0: + return default + elif len_values == 1: + return values[0] + elif len_values > 1: + raise ApiValueError( + "Values stored for property {0} in {1} differ when looking " + "at self and self's composed instances. All values must be " + "the same".format(name, type(self).__name__), + [e for e in [self._path_to_item, name] if e] + ) + + def __getitem__(self, name): + """get the value of an attribute using square-bracket notation: `instance[attr]`""" + value = self.get(name, self.__unset_attribute_value__) + if value is self.__unset_attribute_value__: + raise ApiAttributeError( + "{0} has no attribute '{1}'".format( + type(self).__name__, name), + [e for e in [self._path_to_item, name] if e] + ) + return value + + def __contains__(self, name): + """used by `in` operator to check if an attrbute value was set in an instance: `'attr' in instance`""" + + if name in self.required_properties: + return name in self.__dict__ + + model_instances = self._var_name_to_model_instances.get( + name, self._additional_properties_model_instances) + + if model_instances: + for model_instance in model_instances: + if name in model_instance._data_store: + return True + + return False + + def to_dict(self): + """Returns the model properties as a dict""" + return model_to_dict(self, serialize=False) + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, self.__class__): + return False + + if not set(self._data_store.keys()) == set(other._data_store.keys()): + return False + for _var_name, this_val in self._data_store.items(): + that_val = other._data_store[_var_name] + types = set() + types.add(this_val.__class__) + types.add(that_val.__class__) + vals_equal = this_val == that_val + if not vals_equal: + return False + return True + + +COERCION_INDEX_BY_TYPE = { + ModelComposed: 0, + ModelNormal: 1, + ModelSimple: 2, + none_type: 3, # The type of 'None'. + list: 4, + dict: 5, + float: 6, + int: 7, + bool: 8, + datetime: 9, + date: 10, + str: 11, + file_type: 12, # 'file_type' is an alias for the built-in 'file' or 'io.IOBase' type. +} + +# these are used to limit what type conversions we try to do +# when we have a valid type already and we want to try converting +# to another type +UPCONVERSION_TYPE_PAIRS = ( + (str, datetime), + (str, date), + (int, float), # A float may be serialized as an integer, e.g. '3' is a valid serialized float. + (list, ModelComposed), + (dict, ModelComposed), + (str, ModelComposed), + (int, ModelComposed), + (float, ModelComposed), + (list, ModelComposed), + (list, ModelNormal), + (dict, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), +) + +COERCIBLE_TYPE_PAIRS = { + False: ( # client instantiation of a model with client data + # (dict, ModelComposed), + # (list, ModelComposed), + # (dict, ModelNormal), + # (list, ModelNormal), + # (str, ModelSimple), + # (int, ModelSimple), + # (float, ModelSimple), + # (list, ModelSimple), + # (str, int), + # (str, float), + # (str, datetime), + # (str, date), + # (int, str), + # (float, str), + ), + True: ( # server -> client data + (dict, ModelComposed), + (list, ModelComposed), + (dict, ModelNormal), + (list, ModelNormal), + (str, ModelSimple), + (int, ModelSimple), + (float, ModelSimple), + (list, ModelSimple), + # (str, int), + # (str, float), + (str, datetime), + (str, date), + # (int, str), + # (float, str), + (str, file_type) + ), +} + + +def get_simple_class(input_value): + """Returns an input_value's simple class that we will use for type checking + Python2: + float and int will return int, where int is the python3 int backport + str and unicode will return str, where str is the python3 str backport + Note: float and int ARE both instances of int backport + Note: str_py2 and unicode_py2 are NOT both instances of str backport + + Args: + input_value (class/class_instance): the item for which we will return + the simple class + """ + if isinstance(input_value, type): + # input_value is a class + return input_value + elif isinstance(input_value, tuple): + return tuple + elif isinstance(input_value, list): + return list + elif isinstance(input_value, dict): + return dict + elif isinstance(input_value, none_type): + return none_type + elif isinstance(input_value, file_type): + return file_type + elif isinstance(input_value, bool): + # this must be higher than the int check because + # isinstance(True, int) == True + return bool + elif isinstance(input_value, int): + return int + elif isinstance(input_value, datetime): + # this must be higher than the date check because + # isinstance(datetime_instance, date) == True + return datetime + elif isinstance(input_value, date): + return date + elif isinstance(input_value, str): + return str + return type(input_value) + + +def check_allowed_values(allowed_values, input_variable_path, input_values): + """Raises an exception if the input_values are not allowed + + Args: + allowed_values (dict): the allowed_values dict + input_variable_path (tuple): the path to the input variable + input_values (list/str/int/float/date/datetime): the values that we + are checking to see if they are in allowed_values + """ + these_allowed_values = list(allowed_values[input_variable_path].values()) + if (isinstance(input_values, list) + and not set(input_values).issubset( + set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values) - set(these_allowed_values))), + raise ApiValueError( + "Invalid values for `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (isinstance(input_values, dict) + and not set( + input_values.keys()).issubset(set(these_allowed_values))): + invalid_values = ", ".join( + map(str, set(input_values.keys()) - set(these_allowed_values))) + raise ApiValueError( + "Invalid keys in `%s` [%s], must be a subset of [%s]" % + ( + input_variable_path[0], + invalid_values, + ", ".join(map(str, these_allowed_values)) + ) + ) + elif (not isinstance(input_values, (list, dict)) + and input_values not in these_allowed_values): + raise ApiValueError( + "Invalid value for `%s` (%s), must be one of %s" % + ( + input_variable_path[0], + input_values, + these_allowed_values + ) + ) + + +def is_json_validation_enabled(schema_keyword, configuration=None): + """Returns true if JSON schema validation is enabled for the specified + validation keyword. This can be used to skip JSON schema structural validation + as requested in the configuration. + + Args: + schema_keyword (string): the name of a JSON schema validation keyword. + configuration (Configuration): the configuration class. + """ + + return (configuration is None or + not hasattr(configuration, '_disabled_client_side_validations') or + schema_keyword not in configuration._disabled_client_side_validations) + + +def check_validations( + validations, input_variable_path, input_values, + configuration=None): + """Raises an exception if the input_values are invalid + + Args: + validations (dict): the validation dictionary. + input_variable_path (tuple): the path to the input variable. + input_values (list/str/int/float/date/datetime): the values that we + are checking. + configuration (Configuration): the configuration class. + """ + + if input_values is None: + return + + current_validations = validations[input_variable_path] + if (is_json_validation_enabled('multipleOf', configuration) and + 'multiple_of' in current_validations and + isinstance(input_values, (int, float)) and + not (float(input_values) / current_validations['multiple_of']).is_integer()): + # Note 'multipleOf' will be as good as the floating point arithmetic. + raise ApiValueError( + "Invalid value for `%s`, value must be a multiple of " + "`%s`" % ( + input_variable_path[0], + current_validations['multiple_of'] + ) + ) + + if (is_json_validation_enabled('maxLength', configuration) and + 'max_length' in current_validations and + len(input_values) > current_validations['max_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['max_length'] + ) + ) + + if (is_json_validation_enabled('minLength', configuration) and + 'min_length' in current_validations and + len(input_values) < current_validations['min_length']): + raise ApiValueError( + "Invalid value for `%s`, length must be greater than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['min_length'] + ) + ) + + if (is_json_validation_enabled('maxItems', configuration) and + 'max_items' in current_validations and + len(input_values) > current_validations['max_items']): + raise ApiValueError( + "Invalid value for `%s`, number of items must be less than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['max_items'] + ) + ) + + if (is_json_validation_enabled('minItems', configuration) and + 'min_items' in current_validations and + len(input_values) < current_validations['min_items']): + raise ValueError( + "Invalid value for `%s`, number of items must be greater than or " + "equal to `%s`" % ( + input_variable_path[0], + current_validations['min_items'] + ) + ) + + items = ('exclusive_maximum', 'inclusive_maximum', 'exclusive_minimum', + 'inclusive_minimum') + if (any(item in current_validations for item in items)): + if isinstance(input_values, list): + max_val = max(input_values) + min_val = min(input_values) + elif isinstance(input_values, dict): + max_val = max(input_values.values()) + min_val = min(input_values.values()) + else: + max_val = input_values + min_val = input_values + + if (is_json_validation_enabled('exclusiveMaximum', configuration) and + 'exclusive_maximum' in current_validations and + max_val >= current_validations['exclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than `%s`" % ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('maximum', configuration) and + 'inclusive_maximum' in current_validations and + max_val > current_validations['inclusive_maximum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value less than or equal to " + "`%s`" % ( + input_variable_path[0], + current_validations['inclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('exclusiveMinimum', configuration) and + 'exclusive_minimum' in current_validations and + min_val <= current_validations['exclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than `%s`" % + ( + input_variable_path[0], + current_validations['exclusive_maximum'] + ) + ) + + if (is_json_validation_enabled('minimum', configuration) and + 'inclusive_minimum' in current_validations and + min_val < current_validations['inclusive_minimum']): + raise ApiValueError( + "Invalid value for `%s`, must be a value greater than or equal " + "to `%s`" % ( + input_variable_path[0], + current_validations['inclusive_minimum'] + ) + ) + flags = current_validations.get('regex', {}).get('flags', 0) + if (is_json_validation_enabled('pattern', configuration) and + 'regex' in current_validations and + not re.search(current_validations['regex']['pattern'], + input_values, flags=flags)): + err_msg = r"Invalid value for `%s`, must match regular expression `%s`" % ( + input_variable_path[0], + current_validations['regex']['pattern'] + ) + if flags != 0: + # Don't print the regex flags if the flags are not + # specified in the OAS document. + err_msg = r"%s with flags=`%s`" % (err_msg, flags) + raise ApiValueError(err_msg) + + +def order_response_types(required_types): + """Returns the required types sorted in coercion order + + Args: + required_types (list/tuple): collection of classes or instance of + list or dict with class information inside it. + + Returns: + (list): coercion order sorted collection of classes or instance + of list or dict with class information inside it. + """ + + def index_getter(class_or_instance): + if isinstance(class_or_instance, list): + return COERCION_INDEX_BY_TYPE[list] + elif isinstance(class_or_instance, dict): + return COERCION_INDEX_BY_TYPE[dict] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelComposed)): + return COERCION_INDEX_BY_TYPE[ModelComposed] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelNormal)): + return COERCION_INDEX_BY_TYPE[ModelNormal] + elif (inspect.isclass(class_or_instance) + and issubclass(class_or_instance, ModelSimple)): + return COERCION_INDEX_BY_TYPE[ModelSimple] + elif class_or_instance in COERCION_INDEX_BY_TYPE: + return COERCION_INDEX_BY_TYPE[class_or_instance] + raise ApiValueError("Unsupported type: %s" % class_or_instance) + + sorted_types = sorted( + required_types, + key=lambda class_or_instance: index_getter(class_or_instance) + ) + return sorted_types + + +def remove_uncoercible(required_types_classes, current_item, spec_property_naming, + must_convert=True): + """Only keeps the type conversions that are possible + + Args: + required_types_classes (tuple): tuple of classes that are required + these should be ordered by COERCION_INDEX_BY_TYPE + 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 variables names in the input data are python + variable names in PEP-8 snake case. + current_item (any): the current item (input data) to be converted + + Keyword Args: + must_convert (bool): if True the item to convert is of the wrong + type and we want a big list of coercibles + if False, we want a limited list of coercibles + + Returns: + (list): the remaining coercible required types, classes only + """ + current_type_simple = get_simple_class(current_item) + + results_classes = [] + for required_type_class in required_types_classes: + # convert our models to OpenApiModel + required_type_class_simplified = required_type_class + if isinstance(required_type_class_simplified, type): + if issubclass(required_type_class_simplified, ModelComposed): + required_type_class_simplified = ModelComposed + elif issubclass(required_type_class_simplified, ModelNormal): + required_type_class_simplified = ModelNormal + elif issubclass(required_type_class_simplified, ModelSimple): + required_type_class_simplified = ModelSimple + + if required_type_class_simplified == current_type_simple: + # don't consider converting to one's own class + continue + + class_pair = (current_type_simple, required_type_class_simplified) + if must_convert and class_pair in COERCIBLE_TYPE_PAIRS[spec_property_naming]: + results_classes.append(required_type_class) + elif class_pair in UPCONVERSION_TYPE_PAIRS: + results_classes.append(required_type_class) + return results_classes + +def get_discriminated_classes(cls): + """ + Returns all the classes that a discriminator converts to + TODO: lru_cache this + """ + possible_classes = [] + key = list(cls.discriminator.keys())[0] + if is_type_nullable(cls): + possible_classes.append(cls) + for discr_cls in cls.discriminator[key].values(): + if hasattr(discr_cls, 'discriminator') and discr_cls.discriminator is not None: + possible_classes.extend(get_discriminated_classes(discr_cls)) + else: + possible_classes.append(discr_cls) + return possible_classes + + +def get_possible_classes(cls, from_server_context): + # TODO: lru_cache this + possible_classes = [cls] + if from_server_context: + return possible_classes + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + possible_classes = [] + possible_classes.extend(get_discriminated_classes(cls)) + elif issubclass(cls, ModelComposed): + possible_classes.extend(composed_model_input_classes(cls)) + return possible_classes + + +def get_required_type_classes(required_types_mixed, spec_property_naming): + """Converts the tuple required_types into a tuple and a dict described + below + + Args: + required_types_mixed (tuple/list): will contain either classes or + instance of list or dict + spec_property_naming (bool): if True these values came from the + server, and we use the data types in our endpoints. + If False, we are client side and we need to include + oneOf and discriminator classes inside the data types in our endpoints + + Returns: + (valid_classes, dict_valid_class_to_child_types_mixed): + valid_classes (tuple): the valid classes that the current item + should be + dict_valid_class_to_child_types_mixed (dict): + valid_class (class): this is the key + child_types_mixed (list/dict/tuple): describes the valid child + types + """ + valid_classes = [] + child_req_types_by_current_type = {} + for required_type in required_types_mixed: + if isinstance(required_type, list): + valid_classes.append(list) + child_req_types_by_current_type[list] = required_type + elif isinstance(required_type, tuple): + valid_classes.append(tuple) + child_req_types_by_current_type[tuple] = required_type + elif isinstance(required_type, dict): + valid_classes.append(dict) + child_req_types_by_current_type[dict] = required_type[str] + else: + valid_classes.extend(get_possible_classes(required_type, spec_property_naming)) + return tuple(valid_classes), child_req_types_by_current_type + + +def change_keys_js_to_python(input_dict, model_class): + """ + Converts from javascript_key keys in the input_dict to python_keys in + the output dict using the mapping in model_class. + If the input_dict contains a key which does not declared in the model_class, + the key is added to the output dict as is. The assumption is the model_class + may have undeclared properties (additionalProperties attribute in the OAS + document). + """ + + if getattr(model_class, 'attribute_map', None) is None: + return input_dict + output_dict = {} + reversed_attr_map = {value: key for key, value in + model_class.attribute_map.items()} + for javascript_key, value in input_dict.items(): + python_key = reversed_attr_map.get(javascript_key) + if python_key is None: + # if the key is unknown, it is in error or it is an + # additionalProperties variable + python_key = javascript_key + output_dict[python_key] = value + return output_dict + + +def get_type_error(var_value, path_to_item, valid_classes, key_type=False): + error_msg = type_error_message( + var_name=path_to_item[-1], + var_value=var_value, + valid_classes=valid_classes, + key_type=key_type + ) + return ApiTypeError( + error_msg, + path_to_item=path_to_item, + valid_classes=valid_classes, + key_type=key_type + ) + + +def deserialize_primitive(data, klass, path_to_item): + """Deserializes string to primitive type. + + :param data: str/int/float + :param klass: str/class the class to convert to + + :return: int, float, str, bool, date, datetime + """ + additional_message = "" + try: + if klass in {datetime, date}: + additional_message = ( + "If you need your parameter to have a fallback " + "string value, please set its type as `type: {}` in your " + "spec. That allows the value to be any type. " + ) + if klass == datetime: + if len(data) < 8: + raise ValueError("This is not a datetime") + # The string should be in iso8601 datetime format. + parsed_datetime = parse(data) + date_only = ( + parsed_datetime.hour == 0 and + parsed_datetime.minute == 0 and + parsed_datetime.second == 0 and + parsed_datetime.tzinfo is None and + 8 <= len(data) <= 10 + ) + if date_only: + raise ValueError("This is a date, not a datetime") + return parsed_datetime + elif klass == date: + if len(data) < 8: + raise ValueError("This is not a date") + return parse(data).date() + else: + converted_value = klass(data) + if isinstance(data, str) and klass == float: + if str(converted_value) != data: + # '7' -> 7.0 -> '7.0' != '7' + raise ValueError('This is not a float') + return converted_value + except (OverflowError, ValueError) as ex: + # parse can raise OverflowError + raise ApiValueError( + "{0}Failed to parse {1} as {2}".format( + additional_message, repr(data), klass.__name__ + ), + path_to_item=path_to_item + ) from ex + + +def get_discriminator_class(model_class, + discr_name, + discr_value, cls_visited): + """Returns the child class specified by the discriminator. + + Args: + model_class (OpenApiModel): the model class. + discr_name (string): the name of the discriminator property. + discr_value (any): the discriminator value. + cls_visited (list): list of model classes that have been visited. + Used to determine the discriminator class without + visiting circular references indefinitely. + + Returns: + used_model_class (class/None): the chosen child class that will be used + to deserialize the data, for example dog.Dog. + If a class is not found, None is returned. + """ + + if model_class in cls_visited: + # The class has already been visited and no suitable class was found. + return None + cls_visited.append(model_class) + used_model_class = None + if discr_name in model_class.discriminator: + class_name_to_discr_class = model_class.discriminator[discr_name] + used_model_class = class_name_to_discr_class.get(discr_value) + if used_model_class is None: + # We didn't find a discriminated class in class_name_to_discr_class. + # So look in the ancestor or descendant discriminators + # The discriminator mapping may exist in a descendant (anyOf, oneOf) + # or ancestor (allOf). + # Ancestor example: in the GrandparentAnimal -> ParentPet -> ChildCat + # hierarchy, the discriminator mappings may be defined at any level + # in the hierarchy. + # Descendant example: mammal -> whale/zebra/Pig -> BasquePig/DanishPig + # if we try to make BasquePig from mammal, we need to travel through + # the oneOf descendant discriminators to find BasquePig + descendant_classes = model_class._composed_schemas.get('oneOf', ()) + \ + model_class._composed_schemas.get('anyOf', ()) + ancestor_classes = model_class._composed_schemas.get('allOf', ()) + possible_classes = descendant_classes + ancestor_classes + for cls in possible_classes: + # Check if the schema has inherited discriminators. + if hasattr(cls, 'discriminator') and cls.discriminator is not None: + used_model_class = get_discriminator_class( + cls, discr_name, discr_value, cls_visited) + if used_model_class is not None: + return used_model_class + return used_model_class + + +def deserialize_model(model_data, model_class, path_to_item, check_type, + configuration, spec_property_naming): + """Deserializes model_data to model instance. + + Args: + model_data (int/str/float/bool/none_type/list/dict): data to instantiate the model + model_class (OpenApiModel): the model class + path_to_item (list): path to the model in the received data + check_type (bool): whether to check the data tupe for the values in + the model + configuration (Configuration): the instance to use to convert files + 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 variables names in the input data are python + variable names in PEP-8 snake case. + + Returns: + model instance + + Raise: + ApiTypeError + ApiValueError + ApiKeyError + """ + + kw_args = dict(_check_type=check_type, + _path_to_item=path_to_item, + _configuration=configuration, + _spec_property_naming=spec_property_naming) + + if issubclass(model_class, ModelSimple): + return model_class._new_from_openapi_data(model_data, **kw_args) + elif isinstance(model_data, list): + return model_class._new_from_openapi_data(*model_data, **kw_args) + if isinstance(model_data, dict): + kw_args.update(model_data) + return model_class._new_from_openapi_data(**kw_args) + elif isinstance(model_data, PRIMITIVE_TYPES): + return model_class._new_from_openapi_data(model_data, **kw_args) + + +def deserialize_file(response_data, configuration, content_disposition=None): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + Args: + param response_data (str): the file data to write + configuration (Configuration): the instance to use to convert files + + Keyword Args: + content_disposition (str): the value of the Content-Disposition + header + + Returns: + (file_type): the deserialized file which is open + The user is responsible for closing and reading the file + """ + fd, path = tempfile.mkstemp(dir=configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + if isinstance(response_data, str): + # change str to bytes so we can write it + response_data = response_data.encode('utf-8') + f.write(response_data) + + f = open(path, "rb") + return f + + +def attempt_convert_item(input_value, valid_classes, path_to_item, + configuration, spec_property_naming, key_type=False, + must_convert=False, check_type=True): + """ + Args: + input_value (any): the data to convert + valid_classes (any): the classes that are valid + path_to_item (list): the path to the item to convert + configuration (Configuration): the instance to use to convert files + 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 variables names in the input data are python + variable names in PEP-8 snake case. + key_type (bool): if True we need to convert a key type (not supported) + must_convert (bool): if True we must convert + check_type (bool): if True we check the type or the returned data in + ModelComposed/ModelNormal/ModelSimple instances + + Returns: + instance (any) the fixed item + + Raises: + ApiTypeError + ApiValueError + ApiKeyError + """ + valid_classes_ordered = order_response_types(valid_classes) + valid_classes_coercible = remove_uncoercible( + valid_classes_ordered, input_value, spec_property_naming) + if not valid_classes_coercible or key_type: + # we do not handle keytype errors, json will take care + # of this for us + if configuration is None or not configuration.discard_unknown_keys: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=key_type) + for valid_class in valid_classes_coercible: + try: + if issubclass(valid_class, OpenApiModel): + return deserialize_model(input_value, valid_class, + path_to_item, check_type, + configuration, spec_property_naming) + elif valid_class == file_type: + return deserialize_file(input_value, configuration) + return deserialize_primitive(input_value, valid_class, + path_to_item) + except (ApiTypeError, ApiValueError, ApiKeyError) as conversion_exc: + if must_convert: + raise conversion_exc + # if we have conversion errors when must_convert == False + # we ignore the exception and move on to the next class + continue + # we were unable to convert, must_convert == False + return input_value + + +def is_type_nullable(input_type): + """ + Returns true if None is an allowed value for the specified input_type. + + A type is nullable if at least one of the following conditions is true: + 1. The OAS 'nullable' attribute has been specified, + 1. The type is the 'null' type, + 1. The type is a anyOf/oneOf composed schema, and a child schema is + the 'null' type. + Args: + input_type (type): the class of the input_value that we are + checking + Returns: + bool + """ + if input_type is none_type: + return True + if issubclass(input_type, OpenApiModel) and input_type._nullable: + return True + if issubclass(input_type, ModelComposed): + # If oneOf/anyOf, check if the 'null' type is one of the allowed types. + for t in input_type._composed_schemas.get('oneOf', ()): + if is_type_nullable(t): return True + for t in input_type._composed_schemas.get('anyOf', ()): + if is_type_nullable(t): return True + return False + + +def is_valid_type(input_class_simple, valid_classes): + """ + Args: + input_class_simple (class): the class of the input_value that we are + checking + valid_classes (tuple): the valid classes that the current item + should be + Returns: + bool + """ + valid_type = input_class_simple in valid_classes + if not valid_type and ( + issubclass(input_class_simple, OpenApiModel) or + input_class_simple is none_type): + for valid_class in valid_classes: + if input_class_simple is none_type and is_type_nullable(valid_class): + # Schema is oneOf/anyOf and the 'null' type is one of the allowed types. + return True + if not (issubclass(valid_class, OpenApiModel) and valid_class.discriminator): + continue + discr_propertyname_py = list(valid_class.discriminator.keys())[0] + discriminator_classes = ( + valid_class.discriminator[discr_propertyname_py].values() + ) + valid_type = is_valid_type(input_class_simple, discriminator_classes) + if valid_type: + return True + return valid_type + + +def validate_and_convert_types(input_value, required_types_mixed, path_to_item, + spec_property_naming, _check_type, configuration=None): + """Raises a TypeError is there is a problem, otherwise returns value + + Args: + input_value (any): the data to validate/convert + required_types_mixed (list/dict/tuple): A list of + valid classes, or a list tuples of valid classes, or a dict where + the value is a tuple of value classes + path_to_item: (list) the path to the data being validated + this stores a list of keys or indices to get to the data being + validated + 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 variables names in the input data are python + variable names in PEP-8 snake case. + _check_type: (boolean) if true, type will be checked and conversion + will be attempted. + configuration: (Configuration): the configuration class to use + when converting file_type items. + If passed, conversion will be attempted when possible + If not passed, no conversions will be attempted and + exceptions will be raised + + Returns: + the correctly typed value + + Raises: + ApiTypeError + """ + results = get_required_type_classes(required_types_mixed, spec_property_naming) + valid_classes, child_req_types_by_current_type = results + + input_class_simple = get_simple_class(input_value) + valid_type = is_valid_type(input_class_simple, valid_classes) + if not valid_type: + if configuration: + # if input_value is not valid_type try to convert it + converted_instance = attempt_convert_item( + input_value, + valid_classes, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=True, + check_type=_check_type + ) + return converted_instance + else: + raise get_type_error(input_value, path_to_item, valid_classes, + key_type=False) + + # input_value's type is in valid_classes + if len(valid_classes) > 1 and configuration: + # there are valid classes which are not the current class + valid_classes_coercible = remove_uncoercible( + valid_classes, input_value, spec_property_naming, must_convert=False) + if valid_classes_coercible: + converted_instance = attempt_convert_item( + input_value, + valid_classes_coercible, + path_to_item, + configuration, + spec_property_naming, + key_type=False, + must_convert=False, + check_type=_check_type + ) + return converted_instance + + if child_req_types_by_current_type == {}: + # all types are of the required types and there are no more inner + # variables left to look at + return input_value + inner_required_types = child_req_types_by_current_type.get( + type(input_value) + ) + if inner_required_types is None: + # for this type, there are not more inner variables left to look at + return input_value + if isinstance(input_value, list): + if input_value == []: + # allow an empty list + return input_value + for index, inner_value in enumerate(input_value): + inner_path = list(path_to_item) + inner_path.append(index) + input_value[index] = validate_and_convert_types( + inner_value, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + elif isinstance(input_value, dict): + if input_value == {}: + # allow an empty dict + return input_value + for inner_key, inner_val in input_value.items(): + inner_path = list(path_to_item) + inner_path.append(inner_key) + if get_simple_class(inner_key) != str: + raise get_type_error(inner_key, inner_path, valid_classes, + key_type=True) + input_value[inner_key] = validate_and_convert_types( + inner_val, + inner_required_types, + inner_path, + spec_property_naming, + _check_type, + configuration=configuration + ) + return input_value + + +def model_to_dict(model_instance, serialize=True): + """Returns the model properties as a dict + + Args: + model_instance (one of your model instances): the model instance that + will be converted to a dict. + + Keyword Args: + serialize (bool): if True, the keys in the dict will be values from + attribute_map + """ + result = {} + + model_instances = [model_instance] + if model_instance._composed_schemas: + model_instances.extend(model_instance._composed_instances) + seen_json_attribute_names = set() + used_fallback_python_attribute_names = set() + py_to_json_map = {} + for model_instance in model_instances: + for attr, value in model_instance._data_store.items(): + if serialize: + # we use get here because additional property key names do not + # exist in attribute_map + try: + attr = model_instance.attribute_map[attr] + py_to_json_map.update(model_instance.attribute_map) + seen_json_attribute_names.add(attr) + except KeyError: + used_fallback_python_attribute_names.add(attr) + if isinstance(value, list): + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], + model_to_dict(item[1], serialize=serialize)) + if hasattr(item[1], '_data_store') else item, + value.items() + )) + elif isinstance(value, ModelSimple): + result[attr] = value.value + elif hasattr(value, '_data_store'): + result[attr] = model_to_dict(value, serialize=serialize) + else: + result[attr] = value + if serialize: + for python_key in used_fallback_python_attribute_names: + json_key = py_to_json_map.get(python_key) + if json_key is None: + continue + if python_key == json_key: + continue + json_key_assigned_no_need_for_python_key = json_key in seen_json_attribute_names + if json_key_assigned_no_need_for_python_key: + del result[python_key] + + return result + + +def type_error_message(var_value=None, var_name=None, valid_classes=None, + key_type=None): + """ + Keyword Args: + var_value (any): the variable which has the type_error + var_name (str): the name of the variable which has the typ error + valid_classes (tuple): the accepted classes for current_item's + value + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + """ + key_or_value = 'value' + if key_type: + key_or_value = 'key' + valid_classes_phrase = get_valid_classes_phrase(valid_classes) + msg = ( + "Invalid type for variable '{0}'. Required {1} type {2} and " + "passed type was {3}".format( + var_name, + key_or_value, + valid_classes_phrase, + type(var_value).__name__, + ) + ) + return msg + + +def get_valid_classes_phrase(input_classes): + """Returns a string phrase describing what types are allowed + """ + all_classes = list(input_classes) + all_classes = sorted(all_classes, key=lambda cls: cls.__name__) + all_class_names = [cls.__name__ for cls in all_classes] + if len(all_class_names) == 1: + return 'is {0}'.format(all_class_names[0]) + return "is one of [{0}]".format(", ".join(all_class_names)) + + +def get_allof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + used to make instances + constant_args (dict): + metadata arguments: + _check_type + _path_to_item + _spec_property_naming + _configuration + _visited_composed_classes + + Returns + composed_instances (list) + """ + composed_instances = [] + for allof_class in self._composed_schemas['allOf']: + + try: + allof_instance = allof_class(**model_args, **constant_args) + composed_instances.append(allof_instance) + except Exception as ex: + raise ApiValueError( + "Invalid inputs given to generate an instance of '%s'. The " + "input data was invalid for the allOf schema '%s' in the composed " + "schema '%s'. Error=%s" % ( + allof_class.__name__, + allof_class.__name__, + self.__class__.__name__, + str(ex) + ) + ) from ex + return composed_instances + + +def get_oneof_instance(cls, model_kwargs, constant_kwargs, model_arg=None): + """ + Find the oneOf schema that matches the input data (e.g. payload). + If exactly one schema matches the input data, an instance of that schema + is returned. + If zero or more than one schema match the input data, an exception is raised. + In OAS 3.x, the payload MUST, by validation, match exactly one of the + schemas described by oneOf. + + Args: + cls: the class we are handling + model_kwargs (dict): var_name to var_value + The input data, e.g. the payload that must match a oneOf schema + in the OpenAPI document. + constant_kwargs (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Kwargs: + model_arg: (int, float, bool, str, date, datetime, ModelSimple, None): + the value to assign to a primitive class or ModelSimple class + Notes: + - this is only passed in when oneOf includes types which are not object + - None is used to suppress handling of model_arg, nullable models are handled in __new__ + + Returns + oneof_instance (instance) + """ + if len(cls._composed_schemas['oneOf']) == 0: + return None + + oneof_instances = [] + # Iterate over each oneOf schema and determine if the input data + # matches the oneOf schemas. + for oneof_class in cls._composed_schemas['oneOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if oneof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + single_value_input = allows_single_value_input(oneof_class) + + try: + if not single_value_input: + oneof_instance = oneof_class(**model_kwargs, **constant_kwargs) + else: + if issubclass(oneof_class, ModelSimple): + oneof_instance = oneof_class(model_arg, **constant_kwargs) + elif oneof_class in PRIMITIVE_TYPES: + oneof_instance = validate_and_convert_types( + model_arg, + (oneof_class,), + constant_kwargs['_path_to_item'], + constant_kwargs['_spec_property_naming'], + constant_kwargs['_check_type'], + configuration=constant_kwargs['_configuration'] + ) + oneof_instances.append(oneof_instance) + except Exception: + pass + if len(oneof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None " + "of the oneOf schemas matched the input data." % + cls.__name__ + ) + elif len(oneof_instances) > 1: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. Multiple " + "oneOf schemas matched the inputs, but a max of one is allowed." % + cls.__name__ + ) + return oneof_instances[0] + + +def get_anyof_instances(self, model_args, constant_args): + """ + Args: + self: the class we are handling + model_args (dict): var_name to var_value + The input data, e.g. the payload that must match at least one + anyOf child schema in the OpenAPI document. + constant_args (dict): var_name to var_value + args that every model requires, including configuration, server + and path to item. + + Returns + anyof_instances (list) + """ + anyof_instances = [] + if len(self._composed_schemas['anyOf']) == 0: + return anyof_instances + + for anyof_class in self._composed_schemas['anyOf']: + # The composed oneOf schema allows the 'null' type and the input data + # is the null value. This is a OAS >= 3.1 feature. + if anyof_class is none_type: + # skip none_types because we are deserializing dict data. + # none_type deserialization is handled in the __new__ method + continue + + try: + anyof_instance = anyof_class(**model_args, **constant_args) + anyof_instances.append(anyof_instance) + except Exception: + pass + if len(anyof_instances) == 0: + raise ApiValueError( + "Invalid inputs given to generate an instance of %s. None of the " + "anyOf schemas matched the inputs." % + self.__class__.__name__ + ) + return anyof_instances + + +def get_discarded_args(self, composed_instances, model_args): + """ + Gathers the args that were discarded by configuration.discard_unknown_keys + """ + model_arg_keys = model_args.keys() + discarded_args = set() + # arguments passed to self were already converted to python names + # before __init__ was called + for instance in composed_instances: + if instance.__class__ in self._composed_schemas['allOf']: + try: + keys = instance.to_dict().keys() + discarded_keys = model_args - keys + discarded_args.update(discarded_keys) + except Exception: + # allOf integer schema will throw exception + pass + else: + try: + all_keys = set(model_to_dict(instance, serialize=False).keys()) + js_keys = model_to_dict(instance, serialize=True).keys() + all_keys.update(js_keys) + discarded_keys = model_arg_keys - all_keys + discarded_args.update(discarded_keys) + except Exception: + # allOf integer schema will throw exception + pass + return discarded_args + + +def validate_get_composed_info(constant_args, model_args, self): + """ + For composed schemas, generate schema instances for + all schemas in the oneOf/anyOf/allOf definition. If additional + properties are allowed, also assign those properties on + all matched schemas that contain additionalProperties. + Openapi schemas are python classes. + + Exceptions are raised if: + - 0 or > 1 oneOf schema matches the model_args input data + - no anyOf schema matches the model_args input data + - any of the allOf schemas do not match the model_args input data + + Args: + constant_args (dict): these are the args that every model requires + model_args (dict): these are the required and optional spec args that + were passed in to make this model + self (class): the class that we are instantiating + This class contains self._composed_schemas + + Returns: + composed_info (list): length three + composed_instances (list): the composed instances which are not + self + var_name_to_model_instances (dict): a dict going from var_name + to the model_instance which holds that var_name + the model_instance may be self or an instance of one of the + classes in self.composed_instances() + additional_properties_model_instances (list): a list of the + model instances which have the property + additional_properties_type. This list can include self + """ + # create composed_instances + composed_instances = [] + allof_instances = get_allof_instances(self, model_args, constant_args) + composed_instances.extend(allof_instances) + oneof_instance = get_oneof_instance(self.__class__, model_args, constant_args) + if oneof_instance is not None: + composed_instances.append(oneof_instance) + anyof_instances = get_anyof_instances(self, model_args, constant_args) + composed_instances.extend(anyof_instances) + """ + set additional_properties_model_instances + additional properties must be evaluated at the schema level + so self's additional properties are most important + If self is a composed schema with: + - no properties defined in self + - additionalProperties: False + Then for object payloads every property is an additional property + and they are not allowed, so only empty dict is allowed + + Properties must be set on all matching schemas + so when a property is assigned toa composed instance, it must be set on all + composed instances regardless of additionalProperties presence + keeping it to prevent breaking changes in v5.0.1 + TODO remove cls._additional_properties_model_instances in 6.0.0 + """ + additional_properties_model_instances = [] + if self.additional_properties_type is not None: + additional_properties_model_instances = [self] + + """ + no need to set properties on self in here, they will be set in __init__ + By here all composed schema oneOf/anyOf/allOf instances have their properties set using + model_args + """ + discarded_args = get_discarded_args(self, composed_instances, model_args) + + # map variable names to composed_instances + var_name_to_model_instances = {} + for prop_name in model_args: + if prop_name not in discarded_args: + var_name_to_model_instances[prop_name] = [self] + composed_instances + + return [ + composed_instances, + var_name_to_model_instances, + additional_properties_model_instances, + discarded_args + ] diff --git a/pinecone/core/client/models/__init__.py b/pinecone/core/client/models/__init__.py index 85b94981..5c207910 100644 --- a/pinecone/core/client/models/__init__.py +++ b/pinecone/core/client/models/__init__.py @@ -1,47 +1,38 @@ -# coding: utf-8 - # flake8: noqa -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 +# import all models into this package +# if you have many models here with many references from one model to another this may +# raise a RecursionError +# to avoid this, import only the models that you directly need like: +# from from pinecone.core.client.model.pet import Pet +# or import this package, but before doing it, use: +# import sys +# sys.setrecursionlimit(n) -# import models into model package -from pinecone.core.client.models.approximated_config import ApproximatedConfig -from pinecone.core.client.models.collection_meta import CollectionMeta -from pinecone.core.client.models.create_collection_request import CreateCollectionRequest -from pinecone.core.client.models.create_request import CreateRequest -from pinecone.core.client.models.create_request_index_config import CreateRequestIndexConfig -from pinecone.core.client.models.delete_request import DeleteRequest -from pinecone.core.client.models.describe_index_stats_request import DescribeIndexStatsRequest -from pinecone.core.client.models.describe_index_stats_response import DescribeIndexStatsResponse -from pinecone.core.client.models.fetch_response import FetchResponse -from pinecone.core.client.models.hnsw_config import HnswConfig -from pinecone.core.client.models.index_meta import IndexMeta -from pinecone.core.client.models.index_meta_database import IndexMetaDatabase -from pinecone.core.client.models.index_meta_database_index_config import IndexMetaDatabaseIndexConfig -from pinecone.core.client.models.index_meta_status import IndexMetaStatus -from pinecone.core.client.models.list_indexes200_response import ListIndexes200Response -from pinecone.core.client.models.namespace_summary import NamespaceSummary -from pinecone.core.client.models.patch_request import PatchRequest -from pinecone.core.client.models.protobuf_any import ProtobufAny -from pinecone.core.client.models.protobuf_null_value import ProtobufNullValue -from pinecone.core.client.models.query_request import QueryRequest -from pinecone.core.client.models.query_response import QueryResponse -from pinecone.core.client.models.query_vector import QueryVector -from pinecone.core.client.models.rpc_status import RpcStatus -from pinecone.core.client.models.scored_vector import ScoredVector -from pinecone.core.client.models.single_query_results import SingleQueryResults -from pinecone.core.client.models.sparse_values import SparseValues -from pinecone.core.client.models.update_request import UpdateRequest -from pinecone.core.client.models.upsert_request import UpsertRequest -from pinecone.core.client.models.upsert_response import UpsertResponse -from pinecone.core.client.models.vector import Vector +from pinecone.core.client.model.approximated_config import ApproximatedConfig +from pinecone.core.client.model.collection_meta import CollectionMeta +from pinecone.core.client.model.create_collection_request import CreateCollectionRequest +from pinecone.core.client.model.create_request import CreateRequest +from pinecone.core.client.model.delete_request import DeleteRequest +from pinecone.core.client.model.describe_index_stats_request import DescribeIndexStatsRequest +from pinecone.core.client.model.describe_index_stats_response import DescribeIndexStatsResponse +from pinecone.core.client.model.fetch_response import FetchResponse +from pinecone.core.client.model.hnsw_config import HnswConfig +from pinecone.core.client.model.index_meta import IndexMeta +from pinecone.core.client.model.index_meta_database import IndexMetaDatabase +from pinecone.core.client.model.index_meta_status import IndexMetaStatus +from pinecone.core.client.model.namespace_summary import NamespaceSummary +from pinecone.core.client.model.patch_request import PatchRequest +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 +from pinecone.core.client.model.query_response import QueryResponse +from pinecone.core.client.model.query_vector import QueryVector +from pinecone.core.client.model.rpc_status import RpcStatus +from pinecone.core.client.model.scored_vector import ScoredVector +from pinecone.core.client.model.single_query_results import SingleQueryResults +from pinecone.core.client.model.sparse_values import SparseValues +from pinecone.core.client.model.update_request import UpdateRequest +from pinecone.core.client.model.upsert_request import UpsertRequest +from pinecone.core.client.model.upsert_response import UpsertResponse +from pinecone.core.client.model.vector import Vector diff --git a/pinecone/core/client/models/approximated_config.py b/pinecone/core/client/models/approximated_config.py deleted file mode 100644 index 3a478f77..00000000 --- a/pinecone/core/client/models/approximated_config.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictBool, StrictInt - - -class ApproximatedConfig(BaseModel): - """ - ApproximatedConfig - """ - - k_bits: Optional[StrictInt] = 512 - hybrid: Optional[StrictBool] = False - __properties = ["k_bits", "hybrid"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ApproximatedConfig: - """Create an instance of ApproximatedConfig from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ApproximatedConfig: - """Create an instance of ApproximatedConfig from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ApproximatedConfig.parse_obj(obj) - - _obj = ApproximatedConfig.parse_obj( - { - "k_bits": obj.get("k_bits") if obj.get("k_bits") is not None else 512, - "hybrid": obj.get("hybrid") if obj.get("hybrid") is not None else False, - } - ) - return _obj diff --git a/pinecone/core/client/models/collection_meta.py b/pinecone/core/client/models/collection_meta.py deleted file mode 100644 index 98ef3b0b..00000000 --- a/pinecone/core/client/models/collection_meta.py +++ /dev/null @@ -1,79 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictInt, StrictStr - - -class CollectionMeta(BaseModel): - """ - CollectionMeta - """ - - name: StrictStr = Field(...) - size: StrictInt = Field(..., description="The size of the collection in bytes.") - status: StrictStr = Field(..., description="The status of the collection.") - dimension: StrictInt = Field(..., description="The dimension of the records stored in the collection") - vector_count: StrictInt = Field(..., description="The number of records stored in the collection") - __properties = ["name", "size", "status", "dimension", "vector_count"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> CollectionMeta: - """Create an instance of CollectionMeta from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> CollectionMeta: - """Create an instance of CollectionMeta from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return CollectionMeta.parse_obj(obj) - - _obj = CollectionMeta.parse_obj( - { - "name": obj.get("name"), - "size": obj.get("size"), - "status": obj.get("status"), - "dimension": obj.get("dimension"), - "vector_count": obj.get("vector_count"), - } - ) - return _obj diff --git a/pinecone/core/client/models/create_collection_request.py b/pinecone/core/client/models/create_collection_request.py deleted file mode 100644 index 4ca48229..00000000 --- a/pinecone/core/client/models/create_collection_request.py +++ /dev/null @@ -1,68 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictStr - - -class CreateCollectionRequest(BaseModel): - """ - CreateCollectionRequest - """ - - name: StrictStr = Field(..., description="The name of the collection to be created.") - source: StrictStr = Field(..., description="The name of the index to be used as the source for the collection.") - __properties = ["name", "source"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> CreateCollectionRequest: - """Create an instance of CreateCollectionRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> CreateCollectionRequest: - """Create an instance of CreateCollectionRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return CreateCollectionRequest.parse_obj(obj) - - _obj = CreateCollectionRequest.parse_obj({"name": obj.get("name"), "source": obj.get("source")}) - return _obj diff --git a/pinecone/core/client/models/create_request.py b/pinecone/core/client/models/create_request.py deleted file mode 100644 index 87bedfd3..00000000 --- a/pinecone/core/client/models/create_request.py +++ /dev/null @@ -1,149 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator -from pinecone.core.client.models.create_request_index_config import CreateRequestIndexConfig - - -class CreateRequest(BaseModel): - """ - CreateRequest - """ - - name: StrictStr = Field( - ..., description="The name of the index to be created. The maximum length is 45 characters." - ) - dimension: StrictInt = Field(..., description="The dimensions of the vectors to be inserted in the index") - region: StrictStr = Field(..., description="The region where you would like your index to be created") - cloud: StrictStr = Field(..., description="The public cloud where you would like your index hosted") - capacity_mode: StrictStr = Field(..., description="The capacity mode for the index.") - index_type: Optional[StrictStr] = Field( - "approximated", description="The type of vector index. Pinecone supports 'approximated'." - ) - metric: Optional[StrictStr] = Field( - "cosine", - description="The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'.", - ) - pods: Optional[StrictInt] = Field(1, description="The number of pods for the index to use,including replicas.") - replicas: Optional[StrictInt] = Field( - 1, - description="The number of replicas. Replicas duplicate your index. They provide higher availability and throughput.", - ) - shards: Optional[StrictInt] = Field(1, description="The number of shards to be used in the index.") - pod_type: Optional[StrictStr] = Field( - "p1.x1", - description="The type of pod to use. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.", - ) - index_config: Optional[CreateRequestIndexConfig] = None - metadata_config: Optional[Dict[str, Any]] = Field( - None, - description='Configuration for the behavior of Pinecone\'s internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. To specify metadata fields to index, provide a JSON object of the following form: ``` {"indexed": ["example_metadata_field"]} ``` ', - ) - source_collection: Optional[StrictStr] = Field( - None, description="The name of the collection to create an index from" - ) - __properties = [ - "name", - "dimension", - "region", - "cloud", - "capacity_mode", - "index_type", - "metric", - "pods", - "replicas", - "shards", - "pod_type", - "index_config", - "metadata_config", - "source_collection", - ] - - @validator("cloud") - def cloud_validate_enum(cls, value): - """Validates the enum""" - if value not in ("gcp", "aws", "azure"): - raise ValueError("must be one of enum values ('gcp', 'aws', 'azure')") - return value - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> CreateRequest: - """Create an instance of CreateRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of index_config - if self.index_config: - _dict["index_config"] = self.index_config.to_dict() - # set to None if metadata_config (nullable) is None - # and __fields_set__ contains the field - if self.metadata_config is None and "metadata_config" in self.__fields_set__: - _dict["metadata_config"] = None - - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> CreateRequest: - """Create an instance of CreateRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return CreateRequest.parse_obj(obj) - - _obj = CreateRequest.parse_obj( - { - "name": obj.get("name"), - "dimension": obj.get("dimension"), - "region": obj.get("region"), - "cloud": obj.get("cloud"), - "capacity_mode": obj.get("capacity_mode"), - "index_type": obj.get("index_type") if obj.get("index_type") is not None else "approximated", - "metric": obj.get("metric") if obj.get("metric") is not None else "cosine", - "pods": obj.get("pods") if obj.get("pods") is not None else 1, - "replicas": obj.get("replicas") if obj.get("replicas") is not None else 1, - "shards": obj.get("shards") if obj.get("shards") is not None else 1, - "pod_type": obj.get("pod_type") if obj.get("pod_type") is not None else "p1.x1", - "index_config": CreateRequestIndexConfig.from_dict(obj.get("index_config")) - if obj.get("index_config") is not None - else None, - "metadata_config": obj.get("metadata_config"), - "source_collection": obj.get("source_collection"), - } - ) - return _obj diff --git a/pinecone/core/client/models/create_request_index_config.py b/pinecone/core/client/models/create_request_index_config.py deleted file mode 100644 index 091fd207..00000000 --- a/pinecone/core/client/models/create_request_index_config.py +++ /dev/null @@ -1,140 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from pinecone.core.client.models.approximated_config import ApproximatedConfig -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -CREATEREQUESTINDEXCONFIG_ONE_OF_SCHEMAS = ["ApproximatedConfig"] - - -class CreateRequestIndexConfig(BaseModel): - """ - CreateRequestIndexConfig - """ - - # data type: ApproximatedConfig - oneof_schema_1_validator: Optional[ApproximatedConfig] = None - if TYPE_CHECKING: - actual_instance: Union[ApproximatedConfig] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(CREATEREQUESTINDEXCONFIG_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator("actual_instance") - def actual_instance_must_validate_oneof(cls, v): - instance = CreateRequestIndexConfig.construct() - error_messages = [] - match = 0 - # validate data type: ApproximatedConfig - if not isinstance(v, ApproximatedConfig): - error_messages.append(f"Error! Input type `{type(v)}` is not `ApproximatedConfig`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in CreateRequestIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - elif match == 0: - # no match - raise ValueError( - "No match found when setting `actual_instance` in CreateRequestIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> CreateRequestIndexConfig: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> CreateRequestIndexConfig: - """Returns the object represented by the json string""" - instance = CreateRequestIndexConfig.construct() - error_messages = [] - match = 0 - - # deserialize data into ApproximatedConfig - try: - instance.actual_instance = ApproximatedConfig.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into CreateRequestIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - elif match == 0: - # no match - raise ValueError( - "No match found when deserializing the JSON string into CreateRequestIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) diff --git a/pinecone/core/client/models/delete_request.py b/pinecone/core/client/models/delete_request.py deleted file mode 100644 index 9e189c8b..00000000 --- a/pinecone/core/client/models/delete_request.py +++ /dev/null @@ -1,85 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist - - -class DeleteRequest(BaseModel): - """ - The request for the `Delete` operation. # noqa: E501 - """ - - ids: Optional[conlist(StrictStr)] = Field(None, description="Vectors to delete.") - delete_all: Optional[StrictBool] = Field( - False, - alias="deleteAll", - description="This indicates that all vectors in the index namespace should be deleted.", - ) - namespace: Optional[StrictStr] = Field(None, description="The namespace to delete vectors from, if applicable.") - filter: Optional[Dict[str, Any]] = Field( - None, - description="If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See https://www.pinecone.io/docs/metadata-filtering/.", - ) - __properties = ["ids", "deleteAll", "namespace", "filter"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DeleteRequest: - """Create an instance of DeleteRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DeleteRequest: - """Create an instance of DeleteRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DeleteRequest.parse_obj(obj) - - _obj = DeleteRequest.parse_obj( - { - "ids": obj.get("ids"), - "delete_all": obj.get("deleteAll") if obj.get("deleteAll") is not None else False, - "namespace": obj.get("namespace"), - "filter": obj.get("filter"), - } - ) - return _obj diff --git a/pinecone/core/client/models/describe_index_stats_request.py b/pinecone/core/client/models/describe_index_stats_request.py deleted file mode 100644 index 63a7e9b7..00000000 --- a/pinecone/core/client/models/describe_index_stats_request.py +++ /dev/null @@ -1,71 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field - - -class DescribeIndexStatsRequest(BaseModel): - """ - The request for the `DescribeIndexStats` operation. # noqa: E501 - """ - - filter: Optional[Dict[str, Any]] = Field( - None, - description="If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See https://www.pinecone.io/docs/metadata-filtering/.", - ) - __properties = ["filter"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DescribeIndexStatsRequest: - """Create an instance of DescribeIndexStatsRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DescribeIndexStatsRequest: - """Create an instance of DescribeIndexStatsRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DescribeIndexStatsRequest.parse_obj(obj) - - _obj = DescribeIndexStatsRequest.parse_obj({"filter": obj.get("filter")}) - return _obj diff --git a/pinecone/core/client/models/describe_index_stats_response.py b/pinecone/core/client/models/describe_index_stats_response.py deleted file mode 100644 index 7a35ae47..00000000 --- a/pinecone/core/client/models/describe_index_stats_response.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt -from pinecone.core.client.models.namespace_summary import NamespaceSummary - - -class DescribeIndexStatsResponse(BaseModel): - """ - The response for the `DescribeIndexStats` operation. # noqa: E501 - """ - - namespaces: Optional[Dict[str, NamespaceSummary]] = Field( - None, - description="A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.", - ) - dimension: Optional[StrictInt] = Field(None, description="The dimension of the indexed vectors.") - index_fullness: Optional[Union[StrictFloat, StrictInt]] = Field( - None, - alias="indexFullness", - description="The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%.", - ) - total_vector_count: Optional[StrictInt] = Field(None, alias="totalVectorCount") - __properties = ["namespaces", "dimension", "indexFullness", "totalVectorCount"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> DescribeIndexStatsResponse: - """Create an instance of DescribeIndexStatsResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in namespaces (dict) - _field_dict = {} - if self.namespaces: - for _key in self.namespaces: - if self.namespaces[_key]: - _field_dict[_key] = self.namespaces[_key].to_dict() - _dict["namespaces"] = _field_dict - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> DescribeIndexStatsResponse: - """Create an instance of DescribeIndexStatsResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return DescribeIndexStatsResponse.parse_obj(obj) - - _obj = DescribeIndexStatsResponse.parse_obj( - { - "namespaces": dict((_k, NamespaceSummary.from_dict(_v)) for _k, _v in obj.get("namespaces").items()) - if obj.get("namespaces") is not None - else None, - "dimension": obj.get("dimension"), - "index_fullness": obj.get("indexFullness"), - "total_vector_count": obj.get("totalVectorCount"), - } - ) - return _obj diff --git a/pinecone/core/client/models/fetch_response.py b/pinecone/core/client/models/fetch_response.py deleted file mode 100644 index 3763b572..00000000 --- a/pinecone/core/client/models/fetch_response.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Dict, Optional -from pydantic import BaseModel, Field, StrictStr -from pinecone.core.client.models.vector import Vector - - -class FetchResponse(BaseModel): - """ - The response for the `Fetch` operation. # noqa: E501 - """ - - vectors: Optional[Dict[str, Vector]] = None - namespace: Optional[StrictStr] = Field(None, description="The namespace of the vectors.") - __properties = ["vectors", "namespace"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> FetchResponse: - """Create an instance of FetchResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each value in vectors (dict) - _field_dict = {} - if self.vectors: - for _key in self.vectors: - if self.vectors[_key]: - _field_dict[_key] = self.vectors[_key].to_dict() - _dict["vectors"] = _field_dict - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> FetchResponse: - """Create an instance of FetchResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return FetchResponse.parse_obj(obj) - - _obj = FetchResponse.parse_obj( - { - "vectors": dict((_k, Vector.from_dict(_v)) for _k, _v in obj.get("vectors").items()) - if obj.get("vectors") is not None - else None, - "namespace": obj.get("namespace"), - } - ) - return _obj diff --git a/pinecone/core/client/models/hnsw_config.py b/pinecone/core/client/models/hnsw_config.py deleted file mode 100644 index 75b7d6ce..00000000 --- a/pinecone/core/client/models/hnsw_config.py +++ /dev/null @@ -1,78 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt - - -class HnswConfig(BaseModel): - """ - HnswConfig - """ - - ef_construction: Optional[StrictInt] = 500 - ef: Optional[StrictInt] = 250 - m: Optional[StrictInt] = Field(12, alias="M") - max_elements: Optional[StrictInt] = 50000000 - __properties = ["ef_construction", "ef", "M", "max_elements"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> HnswConfig: - """Create an instance of HnswConfig from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> HnswConfig: - """Create an instance of HnswConfig from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return HnswConfig.parse_obj(obj) - - _obj = HnswConfig.parse_obj( - { - "ef_construction": obj.get("ef_construction") if obj.get("ef_construction") is not None else 500, - "ef": obj.get("ef") if obj.get("ef") is not None else 250, - "m": obj.get("M") if obj.get("M") is not None else 12, - "max_elements": obj.get("max_elements") if obj.get("max_elements") is not None else 50000000, - } - ) - return _obj diff --git a/pinecone/core/client/models/index_meta.py b/pinecone/core/client/models/index_meta.py deleted file mode 100644 index 348cf509..00000000 --- a/pinecone/core/client/models/index_meta.py +++ /dev/null @@ -1,83 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field -from pinecone.core.client.models.index_meta_database import IndexMetaDatabase -from pinecone.core.client.models.index_meta_status import IndexMetaStatus - - -class IndexMeta(BaseModel): - """ - IndexMeta - """ - - database: IndexMetaDatabase = Field(...) - status: IndexMetaStatus = Field(...) - __properties = ["database", "status"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> IndexMeta: - """Create an instance of IndexMeta from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of database - if self.database: - _dict["database"] = self.database.to_dict() - # override the default output from pydantic by calling `to_dict()` of status - if self.status: - _dict["status"] = self.status.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> IndexMeta: - """Create an instance of IndexMeta from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return IndexMeta.parse_obj(obj) - - _obj = IndexMeta.parse_obj( - { - "database": IndexMetaDatabase.from_dict(obj.get("database")) - if obj.get("database") is not None - else None, - "status": IndexMetaStatus.from_dict(obj.get("status")) if obj.get("status") is not None else None, - } - ) - return _obj diff --git a/pinecone/core/client/models/index_meta_database.py b/pinecone/core/client/models/index_meta_database.py deleted file mode 100644 index 7d0970e1..00000000 --- a/pinecone/core/client/models/index_meta_database.py +++ /dev/null @@ -1,110 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr -from pinecone.core.client.models.index_meta_database_index_config import IndexMetaDatabaseIndexConfig - - -class IndexMetaDatabase(BaseModel): - """ - IndexMetaDatabase - """ - - name: StrictStr = Field(...) - dimension: StrictInt = Field(...) - capacity_mode: StrictStr = Field(...) - index_type: Optional[StrictStr] = None - metric: StrictStr = Field(...) - pods: Optional[StrictInt] = None - replicas: Optional[StrictInt] = None - shards: Optional[StrictInt] = None - pod_type: Optional[StrictStr] = None - index_config: Optional[IndexMetaDatabaseIndexConfig] = None - metadata_config: Optional[Dict[str, Any]] = None - __properties = [ - "name", - "dimension", - "capacity_mode", - "index_type", - "metric", - "pods", - "replicas", - "shards", - "pod_type", - "index_config", - "metadata_config", - ] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> IndexMetaDatabase: - """Create an instance of IndexMetaDatabase from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of index_config - if self.index_config: - _dict["index_config"] = self.index_config.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> IndexMetaDatabase: - """Create an instance of IndexMetaDatabase from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return IndexMetaDatabase.parse_obj(obj) - - _obj = IndexMetaDatabase.parse_obj( - { - "name": obj.get("name"), - "dimension": obj.get("dimension"), - "capacity_mode": obj.get("capacity_mode"), - "index_type": obj.get("index_type"), - "metric": obj.get("metric") if obj.get("metric") is not None else "cosine", - "pods": obj.get("pods"), - "replicas": obj.get("replicas"), - "shards": obj.get("shards"), - "pod_type": obj.get("pod_type"), - "index_config": IndexMetaDatabaseIndexConfig.from_dict(obj.get("index_config")) - if obj.get("index_config") is not None - else None, - "metadata_config": obj.get("metadata_config"), - } - ) - return _obj diff --git a/pinecone/core/client/models/index_meta_database_index_config.py b/pinecone/core/client/models/index_meta_database_index_config.py deleted file mode 100644 index d58d078e..00000000 --- a/pinecone/core/client/models/index_meta_database_index_config.py +++ /dev/null @@ -1,140 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -from inspect import getfullargspec -import json -import pprint -import re # noqa: F401 - -from typing import Any, List, Optional -from pydantic import BaseModel, Field, StrictStr, ValidationError, validator -from pinecone.core.client.models.approximated_config import ApproximatedConfig -from typing import Union, Any, List, TYPE_CHECKING -from pydantic import StrictStr, Field - -INDEXMETADATABASEINDEXCONFIG_ONE_OF_SCHEMAS = ["ApproximatedConfig"] - - -class IndexMetaDatabaseIndexConfig(BaseModel): - """ - IndexMetaDatabaseIndexConfig - """ - - # data type: ApproximatedConfig - oneof_schema_1_validator: Optional[ApproximatedConfig] = None - if TYPE_CHECKING: - actual_instance: Union[ApproximatedConfig] - else: - actual_instance: Any - one_of_schemas: List[str] = Field(INDEXMETADATABASEINDEXCONFIG_ONE_OF_SCHEMAS, const=True) - - class Config: - validate_assignment = True - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @validator("actual_instance") - def actual_instance_must_validate_oneof(cls, v): - instance = IndexMetaDatabaseIndexConfig.construct() - error_messages = [] - match = 0 - # validate data type: ApproximatedConfig - if not isinstance(v, ApproximatedConfig): - error_messages.append(f"Error! Input type `{type(v)}` is not `ApproximatedConfig`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError( - "Multiple matches found when setting `actual_instance` in IndexMetaDatabaseIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - elif match == 0: - # no match - raise ValueError( - "No match found when setting `actual_instance` in IndexMetaDatabaseIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - else: - return v - - @classmethod - def from_dict(cls, obj: dict) -> IndexMetaDatabaseIndexConfig: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> IndexMetaDatabaseIndexConfig: - """Returns the object represented by the json string""" - instance = IndexMetaDatabaseIndexConfig.construct() - error_messages = [] - match = 0 - - # deserialize data into ApproximatedConfig - try: - instance.actual_instance = ApproximatedConfig.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError( - "Multiple matches found when deserializing the JSON string into IndexMetaDatabaseIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - elif match == 0: - # no match - raise ValueError( - "No match found when deserializing the JSON string into IndexMetaDatabaseIndexConfig with oneOf schemas: ApproximatedConfig. Details: " - + ", ".join(error_messages) - ) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> dict: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.dict()) diff --git a/pinecone/core/client/models/index_meta_status.py b/pinecone/core/client/models/index_meta_status.py deleted file mode 100644 index fc76025c..00000000 --- a/pinecone/core/client/models/index_meta_status.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, validator - - -class IndexMetaStatus(BaseModel): - """ - IndexMetaStatus - """ - - ready: StrictBool = Field(...) - state: StrictStr = Field(...) - host: StrictStr = Field(...) - port: StrictInt = Field(...) - __properties = ["ready", "state", "host", "port"] - - @validator("state") - def state_validate_enum(cls, value): - """Validates the enum""" - if value not in ( - "Initializing", - "InitializationFailed", - "ScalingUp", - "ScalingDown", - "ScalingUpPodSize", - "ScalingDownPodSize", - "Terminating", - "Ready", - ): - raise ValueError( - "must be one of enum values ('Initializing', 'InitializationFailed', 'ScalingUp', 'ScalingDown', 'ScalingUpPodSize', 'ScalingDownPodSize', 'Terminating', 'Ready')" - ) - return value - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> IndexMetaStatus: - """Create an instance of IndexMetaStatus from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> IndexMetaStatus: - """Create an instance of IndexMetaStatus from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return IndexMetaStatus.parse_obj(obj) - - _obj = IndexMetaStatus.parse_obj( - {"ready": obj.get("ready"), "state": obj.get("state"), "host": obj.get("host"), "port": obj.get("port")} - ) - return _obj diff --git a/pinecone/core/client/models/list_indexes200_response.py b/pinecone/core/client/models/list_indexes200_response.py deleted file mode 100644 index 9a94ef22..00000000 --- a/pinecone/core/client/models/list_indexes200_response.py +++ /dev/null @@ -1,82 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, conlist -from pinecone.core.client.models.index_meta import IndexMeta - - -class ListIndexes200Response(BaseModel): - """ - ListIndexes200Response - """ - - databases: Optional[conlist(IndexMeta)] = None - __properties = ["databases"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ListIndexes200Response: - """Create an instance of ListIndexes200Response from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in databases (list) - _items = [] - if self.databases: - for _item in self.databases: - if _item: - _items.append(_item.to_dict()) - _dict["databases"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ListIndexes200Response: - """Create an instance of ListIndexes200Response from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ListIndexes200Response.parse_obj(obj) - - _obj = ListIndexes200Response.parse_obj( - { - "databases": [IndexMeta.from_dict(_item) for _item in obj.get("databases")] - if obj.get("databases") is not None - else None - } - ) - return _obj diff --git a/pinecone/core/client/models/namespace_summary.py b/pinecone/core/client/models/namespace_summary.py deleted file mode 100644 index 8d5fb118..00000000 --- a/pinecone/core/client/models/namespace_summary.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt - - -class NamespaceSummary(BaseModel): - """ - A summary of the contents of a namespace. # noqa: E501 - """ - - vector_count: Optional[StrictInt] = Field( - None, - alias="vectorCount", - description="The number of vectors stored in this namespace. Note that updates to this field may lag behind updates to the underlying index and corresponding query results, etc.", - ) - __properties = ["vectorCount"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NamespaceSummary: - """Create an instance of NamespaceSummary from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NamespaceSummary: - """Create an instance of NamespaceSummary from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NamespaceSummary.parse_obj(obj) - - _obj = NamespaceSummary.parse_obj({"vector_count": obj.get("vectorCount")}) - return _obj diff --git a/pinecone/core/client/models/patch_request.py b/pinecone/core/client/models/patch_request.py deleted file mode 100644 index 79ab8f29..00000000 --- a/pinecone/core/client/models/patch_request.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr - - -class PatchRequest(BaseModel): - """ - PatchRequest - """ - - replicas: Optional[StrictInt] = Field(None, description="The desired number of replicas for the index.") - pod_type: Optional[StrictStr] = Field( - None, - description="The new pod type for the index. One of `s1`, `p1`, or `p2` appended with `.` and one of `x1`, `x2`, `x4`, or `x8`.", - ) - __properties = ["replicas", "pod_type"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> PatchRequest: - """Create an instance of PatchRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> PatchRequest: - """Create an instance of PatchRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return PatchRequest.parse_obj(obj) - - _obj = PatchRequest.parse_obj({"replicas": obj.get("replicas"), "pod_type": obj.get("pod_type")}) - return _obj diff --git a/pinecone/core/client/models/protobuf_any.py b/pinecone/core/client/models/protobuf_any.py deleted file mode 100644 index d1114da9..00000000 --- a/pinecone/core/client/models/protobuf_any.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional, Union -from pydantic import BaseModel, Field, StrictBytes, StrictStr - - -class ProtobufAny(BaseModel): - """ - ProtobufAny - """ - - type_url: Optional[StrictStr] = Field(None, alias="typeUrl") - value: Optional[Union[StrictBytes, StrictStr]] = None - __properties = ["typeUrl", "value"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ProtobufAny: - """Create an instance of ProtobufAny from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ProtobufAny: - """Create an instance of ProtobufAny from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ProtobufAny.parse_obj(obj) - - _obj = ProtobufAny.parse_obj({"type_url": obj.get("typeUrl"), "value": obj.get("value")}) - return _obj diff --git a/pinecone/core/client/models/protobuf_null_value.py b/pinecone/core/client/models/protobuf_null_value.py deleted file mode 100644 index e90b5bd4..00000000 --- a/pinecone/core/client/models/protobuf_null_value.py +++ /dev/null @@ -1,35 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - -class ProtobufNullValue(str, Enum): - """ - `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. - NULL_VALUE: Null value. - """ - - """ - allowed enum values - """ - NULL_VALUE = "NULL_VALUE" - - @classmethod - def from_json(cls, json_str: str) -> ProtobufNullValue: - """Create an instance of ProtobufNullValue from a JSON string""" - return ProtobufNullValue(json.loads(json_str)) diff --git a/pinecone/core/client/models/query_request.py b/pinecone/core/client/models/query_request.py deleted file mode 100644 index 19787a26..00000000 --- a/pinecone/core/client/models/query_request.py +++ /dev/null @@ -1,134 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist, constr -from pinecone.core.client.models.query_vector import QueryVector -from pinecone.core.client.models.sparse_values import SparseValues - - -class QueryRequest(BaseModel): - """ - The request for the `Query` operation. # noqa: E501 - """ - - namespace: Optional[StrictStr] = Field(None, description="The namespace to query.") - top_k: conint(strict=True, le=10000, ge=1) = Field( - ..., alias="topK", description="The number of results to return for each query." - ) - filter: Optional[Dict[str, Any]] = Field( - None, - description="The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.", - ) - include_values: Optional[StrictBool] = Field( - False, alias="includeValues", description="Indicates whether vector values are included in the response." - ) - include_metadata: Optional[StrictBool] = Field( - False, - alias="includeMetadata", - description="Indicates whether metadata is included in the response as well as the ids.", - ) - queries: Optional[conlist(QueryVector)] = Field( - None, - description="DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.", - ) - vector: Optional[conlist(Union[StrictFloat, StrictInt])] = Field( - None, - description="The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.", - ) - sparse_vector: Optional[SparseValues] = Field(None, alias="sparseVector") - id: Optional[constr(strict=True, max_length=512)] = Field( - None, - description="The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.", - ) - __properties = [ - "namespace", - "topK", - "filter", - "includeValues", - "includeMetadata", - "queries", - "vector", - "sparseVector", - "id", - ] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> QueryRequest: - """Create an instance of QueryRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in queries (list) - _items = [] - if self.queries: - for _item in self.queries: - if _item: - _items.append(_item.to_dict()) - _dict["queries"] = _items - # override the default output from pydantic by calling `to_dict()` of sparse_vector - if self.sparse_vector: - _dict["sparseVector"] = self.sparse_vector.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> QueryRequest: - """Create an instance of QueryRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return QueryRequest.parse_obj(obj) - - _obj = QueryRequest.parse_obj( - { - "namespace": obj.get("namespace"), - "top_k": obj.get("topK"), - "filter": obj.get("filter"), - "include_values": obj.get("includeValues") if obj.get("includeValues") is not None else False, - "include_metadata": obj.get("includeMetadata") if obj.get("includeMetadata") is not None else False, - "queries": [QueryVector.from_dict(_item) for _item in obj.get("queries")] - if obj.get("queries") is not None - else None, - "vector": obj.get("vector"), - "sparse_vector": SparseValues.from_dict(obj.get("sparseVector")) - if obj.get("sparseVector") is not None - else None, - "id": obj.get("id"), - } - ) - return _obj diff --git a/pinecone/core/client/models/query_response.py b/pinecone/core/client/models/query_response.py deleted file mode 100644 index 5c4f6bf2..00000000 --- a/pinecone/core/client/models/query_response.py +++ /dev/null @@ -1,98 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist -from pinecone.core.client.models.scored_vector import ScoredVector -from pinecone.core.client.models.single_query_results import SingleQueryResults - - -class QueryResponse(BaseModel): - """ - The response for the `Query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar. # noqa: E501 - """ - - results: Optional[conlist(SingleQueryResults)] = Field( - None, description="DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`." - ) - matches: Optional[conlist(ScoredVector)] = Field(None, description="The matches for the vectors.") - namespace: Optional[StrictStr] = Field(None, description="The namespace for the vectors.") - __properties = ["results", "matches", "namespace"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> QueryResponse: - """Create an instance of QueryResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in results (list) - _items = [] - if self.results: - for _item in self.results: - if _item: - _items.append(_item.to_dict()) - _dict["results"] = _items - # override the default output from pydantic by calling `to_dict()` of each item in matches (list) - _items = [] - if self.matches: - for _item in self.matches: - if _item: - _items.append(_item.to_dict()) - _dict["matches"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> QueryResponse: - """Create an instance of QueryResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return QueryResponse.parse_obj(obj) - - _obj = QueryResponse.parse_obj( - { - "results": [SingleQueryResults.from_dict(_item) for _item in obj.get("results")] - if obj.get("results") is not None - else None, - "matches": [ScoredVector.from_dict(_item) for _item in obj.get("matches")] - if obj.get("matches") is not None - else None, - "namespace": obj.get("namespace"), - } - ) - return _obj diff --git a/pinecone/core/client/models/query_vector.py b/pinecone/core/client/models/query_vector.py deleted file mode 100644 index 544bc6fd..00000000 --- a/pinecone/core/client/models/query_vector.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conint, conlist -from pinecone.core.client.models.sparse_values import SparseValues - - -class QueryVector(BaseModel): - """ - A single query vector within a `QueryRequest`. # noqa: E501 - """ - - values: conlist(Union[StrictFloat, StrictInt]) = Field( - ..., - description="The query vector values. This should be the same length as the dimension of the index being queried.", - ) - sparse_values: Optional[SparseValues] = Field(None, alias="sparseValues") - top_k: Optional[conint(strict=True, le=10000, ge=1)] = Field( - None, alias="topK", description="An override for the number of results to return for this query vector." - ) - namespace: Optional[StrictStr] = Field(None, description="An override the namespace to search.") - filter: Optional[Dict[str, Any]] = Field( - None, description="An override for the metadata filter to apply. This replaces the request-level filter." - ) - __properties = ["values", "sparseValues", "topK", "namespace", "filter"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> QueryVector: - """Create an instance of QueryVector from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of sparse_values - if self.sparse_values: - _dict["sparseValues"] = self.sparse_values.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> QueryVector: - """Create an instance of QueryVector from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return QueryVector.parse_obj(obj) - - _obj = QueryVector.parse_obj( - { - "values": obj.get("values"), - "sparse_values": SparseValues.from_dict(obj.get("sparseValues")) - if obj.get("sparseValues") is not None - else None, - "top_k": obj.get("topK"), - "namespace": obj.get("namespace"), - "filter": obj.get("filter"), - } - ) - return _obj diff --git a/pinecone/core/client/models/rpc_status.py b/pinecone/core/client/models/rpc_status.py deleted file mode 100644 index e02eadb6..00000000 --- a/pinecone/core/client/models/rpc_status.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, conlist -from pinecone.core.client.models.protobuf_any import ProtobufAny - - -class RpcStatus(BaseModel): - """ - RpcStatus - """ - - code: Optional[StrictInt] = None - message: Optional[StrictStr] = None - details: Optional[conlist(ProtobufAny)] = None - __properties = ["code", "message", "details"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> RpcStatus: - """Create an instance of RpcStatus from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in details (list) - _items = [] - if self.details: - for _item in self.details: - if _item: - _items.append(_item.to_dict()) - _dict["details"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> RpcStatus: - """Create an instance of RpcStatus from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return RpcStatus.parse_obj(obj) - - _obj = RpcStatus.parse_obj( - { - "code": obj.get("code"), - "message": obj.get("message"), - "details": [ProtobufAny.from_dict(_item) for _item in obj.get("details")] - if obj.get("details") is not None - else None, - } - ) - return _obj diff --git a/pinecone/core/client/models/scored_vector.py b/pinecone/core/client/models/scored_vector.py deleted file mode 100644 index bf983eae..00000000 --- a/pinecone/core/client/models/scored_vector.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist, constr -from pinecone.core.client.models.sparse_values import SparseValues - - -class ScoredVector(BaseModel): - """ - ScoredVector - """ - - id: constr(strict=True, max_length=512, min_length=1) = Field(..., description="This is the vector's unique id.") - score: Optional[Union[StrictFloat, StrictInt]] = Field( - None, - description="This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.", - ) - values: Optional[conlist(Union[StrictFloat, StrictInt])] = Field( - None, description="This is the vector data, if it is requested." - ) - sparse_values: Optional[SparseValues] = Field(None, alias="sparseValues") - metadata: Optional[Dict[str, Any]] = Field(None, description="This is the metadata, if it is requested.") - __properties = ["id", "score", "values", "sparseValues", "metadata"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> ScoredVector: - """Create an instance of ScoredVector from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of sparse_values - if self.sparse_values: - _dict["sparseValues"] = self.sparse_values.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> ScoredVector: - """Create an instance of ScoredVector from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return ScoredVector.parse_obj(obj) - - _obj = ScoredVector.parse_obj( - { - "id": obj.get("id"), - "score": obj.get("score"), - "values": obj.get("values"), - "sparse_values": SparseValues.from_dict(obj.get("sparseValues")) - if obj.get("sparseValues") is not None - else None, - "metadata": obj.get("metadata"), - } - ) - return _obj diff --git a/pinecone/core/client/models/single_query_results.py b/pinecone/core/client/models/single_query_results.py deleted file mode 100644 index 91ef3c00..00000000 --- a/pinecone/core/client/models/single_query_results.py +++ /dev/null @@ -1,84 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist -from pinecone.core.client.models.scored_vector import ScoredVector - - -class SingleQueryResults(BaseModel): - """ - SingleQueryResults - """ - - matches: Optional[conlist(ScoredVector)] = Field(None, description="The matches for the vectors.") - namespace: Optional[StrictStr] = Field(None, description="The namespace for the vectors.") - __properties = ["matches", "namespace"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SingleQueryResults: - """Create an instance of SingleQueryResults from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in matches (list) - _items = [] - if self.matches: - for _item in self.matches: - if _item: - _items.append(_item.to_dict()) - _dict["matches"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SingleQueryResults: - """Create an instance of SingleQueryResults from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SingleQueryResults.parse_obj(obj) - - _obj = SingleQueryResults.parse_obj( - { - "matches": [ScoredVector.from_dict(_item) for _item in obj.get("matches")] - if obj.get("matches") is not None - else None, - "namespace": obj.get("namespace"), - } - ) - return _obj diff --git a/pinecone/core/client/models/sparse_values.py b/pinecone/core/client/models/sparse_values.py deleted file mode 100644 index c72173d3..00000000 --- a/pinecone/core/client/models/sparse_values.py +++ /dev/null @@ -1,72 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist - - -class SparseValues(BaseModel): - """ - Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. # noqa: E501 - """ - - indices: conlist(StrictInt) = Field(..., description="The indices of the sparse data.") - values: conlist(Union[StrictFloat, StrictInt]) = Field( - ..., - description="The corresponding values of the sparse data, which must be with the same length as the indices.", - ) - __properties = ["indices", "values"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SparseValues: - """Create an instance of SparseValues from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SparseValues: - """Create an instance of SparseValues from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SparseValues.parse_obj(obj) - - _obj = SparseValues.parse_obj({"indices": obj.get("indices"), "values": obj.get("values")}) - return _obj diff --git a/pinecone/core/client/models/update_request.py b/pinecone/core/client/models/update_request.py deleted file mode 100644 index a04a3920..00000000 --- a/pinecone/core/client/models/update_request.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, constr -from pinecone.core.client.models.sparse_values import SparseValues - - -class UpdateRequest(BaseModel): - """ - The request for the `Upsert` operation. # noqa: E501 - """ - - id: constr(strict=True, max_length=512, min_length=1) = Field(..., description="Vector's unique id.") - values: Optional[conlist(Union[StrictFloat, StrictInt])] = Field(None, description="Vector data.") - sparse_values: Optional[SparseValues] = Field(None, alias="sparseValues") - set_metadata: Optional[Dict[str, Any]] = Field( - None, alias="setMetadata", description="Metadata to *set* for the vector." - ) - namespace: Optional[StrictStr] = Field(None, description="Namespace name where to update the vector.") - __properties = ["id", "values", "sparseValues", "setMetadata", "namespace"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> UpdateRequest: - """Create an instance of UpdateRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of sparse_values - if self.sparse_values: - _dict["sparseValues"] = self.sparse_values.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> UpdateRequest: - """Create an instance of UpdateRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return UpdateRequest.parse_obj(obj) - - _obj = UpdateRequest.parse_obj( - { - "id": obj.get("id"), - "values": obj.get("values"), - "sparse_values": SparseValues.from_dict(obj.get("sparseValues")) - if obj.get("sparseValues") is not None - else None, - "set_metadata": obj.get("setMetadata"), - "namespace": obj.get("namespace"), - } - ) - return _obj diff --git a/pinecone/core/client/models/upsert_request.py b/pinecone/core/client/models/upsert_request.py deleted file mode 100644 index 11518db5..00000000 --- a/pinecone/core/client/models/upsert_request.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr, conlist -from pinecone.core.client.models.vector import Vector - - -class UpsertRequest(BaseModel): - """ - The request for the `Upsert` operation. # noqa: E501 - """ - - vectors: conlist(Vector) = Field( - ..., description="An array containing the vectors to upsert. Recommended batch limit is 100 vectors." - ) - namespace: Optional[StrictStr] = Field(None, description="This is the namespace name where you upsert vectors.") - __properties = ["vectors", "namespace"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> UpsertRequest: - """Create an instance of UpsertRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of each item in vectors (list) - _items = [] - if self.vectors: - for _item in self.vectors: - if _item: - _items.append(_item.to_dict()) - _dict["vectors"] = _items - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> UpsertRequest: - """Create an instance of UpsertRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return UpsertRequest.parse_obj(obj) - - _obj = UpsertRequest.parse_obj( - { - "vectors": [Vector.from_dict(_item) for _item in obj.get("vectors")] - if obj.get("vectors") is not None - else None, - "namespace": obj.get("namespace"), - } - ) - return _obj diff --git a/pinecone/core/client/models/upsert_response.py b/pinecone/core/client/models/upsert_response.py deleted file mode 100644 index cd17799e..00000000 --- a/pinecone/core/client/models/upsert_response.py +++ /dev/null @@ -1,70 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictInt - - -class UpsertResponse(BaseModel): - """ - The response for the `Upsert` operation. # noqa: E501 - """ - - upserted_count: Optional[StrictInt] = Field( - None, alias="upsertedCount", description="The number of vectors upserted." - ) - __properties = ["upsertedCount"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> UpsertResponse: - """Create an instance of UpsertResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> UpsertResponse: - """Create an instance of UpsertResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return UpsertResponse.parse_obj(obj) - - _obj = UpsertResponse.parse_obj({"upserted_count": obj.get("upsertedCount")}) - return _obj diff --git a/pinecone/core/client/models/vector.py b/pinecone/core/client/models/vector.py deleted file mode 100644 index 96375181..00000000 --- a/pinecone/core/client/models/vector.py +++ /dev/null @@ -1,86 +0,0 @@ -# coding: utf-8 - -""" - Pinecone API - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: version not set - Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Any, Dict, List, Optional, Union -from pydantic import BaseModel, Field, StrictFloat, StrictInt, conlist, constr -from pinecone.core.client.models.sparse_values import SparseValues - - -class Vector(BaseModel): - """ - Vector - """ - - id: constr(strict=True, max_length=512, min_length=1) = Field(..., description="This is the vector's unique id.") - values: conlist(Union[StrictFloat, StrictInt]) = Field( - ..., description="This is the vector data included in the request." - ) - sparse_values: Optional[SparseValues] = Field(None, alias="sparseValues") - metadata: Optional[Dict[str, Any]] = Field(None, description="This is the metadata included in the request.") - __properties = ["id", "values", "sparseValues", "metadata"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Vector: - """Create an instance of Vector from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - # override the default output from pydantic by calling `to_dict()` of sparse_values - if self.sparse_values: - _dict["sparseValues"] = self.sparse_values.to_dict() - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Vector: - """Create an instance of Vector from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Vector.parse_obj(obj) - - _obj = Vector.parse_obj( - { - "id": obj.get("id"), - "values": obj.get("values"), - "sparse_values": SparseValues.from_dict(obj.get("sparseValues")) - if obj.get("sparseValues") is not None - else None, - "metadata": obj.get("metadata"), - } - ) - return _obj diff --git a/pinecone/core/client/py.typed b/pinecone/core/client/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/pinecone/core/client/rest.py b/pinecone/core/client/rest.py index 4cbc0c0d..8a9aafcb 100644 --- a/pinecone/core/client/rest.py +++ b/pinecone/core/client/rest.py @@ -1,16 +1,12 @@ -# coding: utf-8 - """ Pinecone API - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: version not set Contact: support@pinecone.io - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 + Generated by: https://openapi-generator.tech +""" import io @@ -18,26 +14,19 @@ import logging import re import ssl +from urllib.parse import urlencode -from urllib.parse import urlencode, quote_plus import urllib3 -from pinecone.core.client.exceptions import ( - ApiException, - UnauthorizedException, - ForbiddenException, - NotFoundException, - ServiceException, - ApiValueError, - BadRequestException, -) +from pinecone.core.client.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError logger = logging.getLogger(__name__) class RESTResponse(io.IOBase): - def __init__(self, resp) -> None: + + def __init__(self, resp): self.urllib3_response = resp self.status = resp.status self.reason = resp.reason @@ -45,15 +34,16 @@ def __init__(self, resp) -> None: def getheaders(self): """Returns a dictionary of the response headers.""" - return self.urllib3_response.headers + return self.urllib3_response.getheaders() def getheader(self, name, default=None): """Returns a given response header.""" return self.urllib3_response.headers.get(name, default) -class RESTClientObject: - def __init__(self, configuration, pools_size=4, maxsize=None) -> None: +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 @@ -68,16 +58,13 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args["assert_hostname"] = configuration.assert_hostname # noqa: E501 + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 if configuration.retries is not None: - addition_pool_args["retries"] = configuration.retries - - if configuration.tls_server_name: - addition_pool_args["server_hostname"] = configuration.tls_server_name + addition_pool_args['retries'] = configuration.retries if configuration.socket_options is not None: - addition_pool_args["socket_options"] = configuration.socket_options + addition_pool_args['socket_options'] = configuration.socket_options if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -96,7 +83,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: key_file=configuration.key_file, proxy_url=configuration.proxy, proxy_headers=configuration.proxy_headers, - **addition_pool_args, + **addition_pool_args ) else: self.pool_manager = urllib3.PoolManager( @@ -106,20 +93,12 @@ def __init__(self, configuration, pools_size=4, maxsize=None) -> None: ca_certs=configuration.ssl_ca_cert, cert_file=configuration.cert_file, key_file=configuration.key_file, - **addition_pool_args, + **addition_pool_args ) - def request( - self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, - _request_timeout=None, - ): + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): """Perform requests. :param method: http request method @@ -139,77 +118,75 @@ def request( (connection, read) timeouts. """ method = method.upper() - assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"] + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] if post_params and body: - raise ApiValueError("body parameter cannot be used with post_params parameter.") + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) post_params = post_params or {} headers = headers or {} - # url already contains the URL query string - # so reset query_params to empty dict - query_params = {} timeout = None if _request_timeout: if isinstance(_request_timeout, (int, float)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: - timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1]) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) try: # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` - if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]: - # no content type provided or payload is json - if not headers.get("Content-Type") or re.search("json", headers["Content-Type"], re.IGNORECASE): + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + # Only set a default Content-Type for POST, PUT, PATCH and OPTIONS requests + if (method != 'DELETE') and ('Content-Type' not in headers): + headers['Content-Type'] = 'application/json' + if query_params: + url += '?' + urlencode(query_params) + if ('Content-Type' not in headers) or (re.search('json', headers['Content-Type'], re.IGNORECASE)): request_body = None if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif headers["Content-Type"] == "application/x-www-form-urlencoded": # noqa: E501 + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=False, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) - elif headers["Content-Type"] == "multipart/form-data": + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': # must del headers['Content-Type'], or the correct # Content-Type which generated by urllib3 will be # overwritten. - del headers["Content-Type"] + del headers['Content-Type'] r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=True, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) # Pass a `string` parameter directly in the body to support # other content types than Json when `body` argument is # provided in serialized form elif isinstance(body, str) or isinstance(body, bytes): request_body = body r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, - headers=headers, - ) + headers=headers) else: # Cannot generate the request from given parameters msg = """Cannot prepare a request message for provided @@ -218,9 +195,11 @@ def request( raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( - method, url, fields={}, preload_content=_preload_content, timeout=timeout, headers=headers - ) + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -232,9 +211,6 @@ def request( logger.debug("response body: %s", r.data) if not 200 <= r.status <= 299: - if r.status == 400: - raise BadRequestException(http_resp=r) - if r.status == 401: raise UnauthorizedException(http_resp=r) @@ -251,119 +227,67 @@ def request( return r - def get_request(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def head_request(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params, - ) - - def options_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def delete_request( - self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None - ): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def post_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def put_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) - - def patch_request( - self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None, - ): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body, - ) + def GET(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/pinecone/core/grpc/protos/vector_service_pb2.py b/pinecone/core/grpc/protos/vector_service_pb2.py index 276c606d..665ead6c 100644 --- a/pinecone/core/grpc/protos/vector_service_pb2.py +++ b/pinecone/core/grpc/protos/vector_service_pb2.py @@ -6,7 +6,6 @@ from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database - # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -19,1905 +18,1211 @@ DESCRIPTOR = _descriptor.FileDescriptor( - name="vector_service.proto", - package="", - syntax="proto3", - serialized_options=b'\n\021io.pinecone.protoP\001Z/github.com/pinecone-io/new-go-pinecone/pinecone\222A\366\002\022K\n\014Pinecone API";\n\017Pinecone.io Ops\022\023https://pinecone.io\032\023support@pinecone.io\0329{index_name}-{project_name}.svc.{environment}.pinecone.io*\001\0022\020application/json:\020application/jsonZx\nv\n\nApiKeyAuth\022h\010\002\022YAn API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/\032\007Api-Key \002b\020\n\016\n\nApiKeyAuth\022\000r9\n\031More Pinecone.io API docs\022\034https://www.pinecone.io/docs', - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x14vector_service.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a.protoc-gen-openapiv2/options/annotations.proto"~\n\x0cSparseValues\x12\x35\n\x07indices\x18\x01 \x03(\rB$\x92\x41\x1eJ\x16[1, 312, 822, 14, 980]x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12\x37\n\x06values\x18\x02 \x03(\x02\x42\'\x92\x41!J\x19[0.1, 0.2, 0.3, 0.4, 0.5]x\xe8\x07\x80\x01\x01\xe0\x41\x02"\xfd\x01\n\x06Vector\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12"example-vector-1"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12G\n\x06values\x18\x02 \x03(\x02\x42\x37\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\xe0\x41\x02\x12$\n\rsparse_values\x18\x04 \x01(\x0b\x32\r.SparseValues\x12V\n\x08metadata\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{"genre": "documentary", "year": 2019}"\x93\x02\n\x0cScoredVector\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12"example-vector-1"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12\x18\n\x05score\x18\x02 \x01(\x02\x42\t\x92\x41\x06J\x04\x30.08\x12=\n\x06values\x18\x03 \x03(\x02\x42-\x92\x41*J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12V\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{"genre": "documentary", "year": 2019}"d\n\rUpsertRequest\x12&\n\x07vectors\x18\x01 \x03(\x0b\x32\x07.VectorB\x0c\x92\x41\x06x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace""1\n\x0eUpsertResponse\x12\x1f\n\x0eupserted_count\x18\x01 \x01(\rB\x07\x92\x41\x04J\x02\x31\x30"\xb6\x01\n\rDeleteRequest\x12(\n\x03ids\x18\x01 \x03(\tB\x1b\x92\x41\x18J\x10["id-0", "id-1"]x\xe8\x07\x80\x01\x01\x12%\n\ndelete_all\x18\x02 \x01(\x08\x42\x11\x92\x41\x0e:\x05\x66\x61lseJ\x05\x66\x61lse\x12+\n\tnamespace\x18\x03 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace"\x12\'\n\x06\x66ilter\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct"\x10\n\x0e\x44\x65leteResponse"h\n\x0c\x46\x65tchRequest\x12+\n\x03ids\x18\x01 \x03(\tB\x1e\x92\x41\x18J\x10["id-0", "id-1"]x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace""\xa3\x01\n\rFetchResponse\x12,\n\x07vectors\x18\x01 \x03(\x0b\x32\x1b.FetchResponse.VectorsEntry\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace"\x1a\x37\n\x0cVectorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x16\n\x05value\x18\x02 \x01(\x0b\x32\x07.Vector:\x02\x38\x01"\xd0\x02\n\x0bQueryVector\x12G\n\x06values\x18\x01 \x03(\x02\x42\x37\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\xe0\x41\x02\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12(\n\x05top_k\x18\x02 \x01(\rB\x19\x92\x41\x16J\x02\x31\x30Y\x00\x00\x00\x00\x00\x88\xc3@i\x00\x00\x00\x00\x00\x00\xf0?\x12+\n\tnamespace\x18\x03 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace"\x12{\n\x06\x66ilter\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructBR\x92\x41OJM{"genre": {"$in": ["comedy", "documentary", "drama"]}, "year": {"$eq": 2019}}"\xfa\x03\n\x0cQueryRequest\x12+\n\tnamespace\x18\x01 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace"\x12+\n\x05top_k\x18\x02 \x01(\rB\x1c\x92\x41\x16J\x02\x31\x30Y\x00\x00\x00\x00\x00\x88\xc3@i\x00\x00\x00\x00\x00\x00\xf0?\xe0\x41\x02\x12{\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructBR\x92\x41OJM{"genre": {"$in": ["comedy", "documentary", "drama"]}, "year": {"$eq": 2019}}\x12(\n\x0einclude_values\x18\x04 \x01(\x08\x42\x10\x92\x41\r:\x05\x66\x61lseJ\x04true\x12*\n\x10include_metadata\x18\x05 \x01(\x08\x42\x10\x92\x41\r:\x05\x66\x61lseJ\x04true\x12)\n\x07queries\x18\x06 \x03(\x0b\x32\x0c.QueryVectorB\n\x18\x01\x92\x41\x05x\n\x80\x01\x01\x12\x44\n\x06vector\x18\x07 \x03(\x02\x42\x34\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\x12$\n\rsparse_vector\x18\t \x01(\x0b\x32\r.SparseValues\x12&\n\x02id\x18\x08 \x01(\tB\x1a\x92\x41\x17J\x12"example-vector-1"x\x80\x04"a\n\x12SingleQueryResults\x12\x1e\n\x07matches\x18\x01 \x03(\x0b\x32\r.ScoredVector\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace""l\n\rQueryResponse\x12(\n\x07results\x18\x01 \x03(\x0b\x32\x13.SingleQueryResultsB\x02\x18\x01\x12\x1e\n\x07matches\x18\x02 \x03(\x0b\x32\r.ScoredVector\x12\x11\n\tnamespace\x18\x03 \x01(\t"\xb2\x02\n\rUpdateRequest\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12"example-vector-1"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12\x44\n\x06values\x18\x02 \x03(\x02\x42\x34\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12Z\n\x0cset_metadata\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{"genre": "documentary", "year": 2019}\x12+\n\tnamespace\x18\x04 \x01(\tB\x18\x92\x41\x15J\x13"example-namespace""\x10\n\x0eUpdateResponse"D\n\x19\x44\x65scribeIndexStatsRequest\x12\'\n\x06\x66ilter\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct"4\n\x10NamespaceSummary\x12 \n\x0cvector_count\x18\x01 \x01(\rB\n\x92\x41\x07J\x05\x35\x30\x30\x30\x30"\x9a\x03\n\x1a\x44\x65scribeIndexStatsResponse\x12?\n\nnamespaces\x18\x01 \x03(\x0b\x32+.DescribeIndexStatsResponse.NamespacesEntry\x12\x1c\n\tdimension\x18\x02 \x01(\rB\t\x92\x41\x06J\x04\x31\x30\x32\x34\x12 \n\x0eindex_fullness\x18\x03 \x01(\x02\x42\x08\x92\x41\x05J\x03\x30.4\x12&\n\x12total_vector_count\x18\x04 \x01(\rB\n\x92\x41\x07J\x05\x38\x30\x30\x30\x30\x1a\x44\n\x0fNamespacesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.NamespaceSummary:\x02\x38\x01:\x8c\x01\x92\x41\x88\x01\x32\x85\x01{"namespaces": {"": {"vectorCount": 50000}, "example-namespace-2": {"vectorCount": 30000}}, "dimension": 1024, "index_fullness": 0.4}2\xbd\x05\n\rVectorService\x12\x63\n\x06Upsert\x12\x0e.UpsertRequest\x1a\x0f.UpsertResponse"8\x82\xd3\xe4\x93\x02\x14"\x0f/vectors/upsert:\x01*\x92\x41\x1b\n\x11Vector Operations*\x06upsert\x12v\n\x06\x44\x65lete\x12\x0e.DeleteRequest\x1a\x0f.DeleteResponse"K\x82\xd3\xe4\x93\x02\'"\x0f/vectors/delete:\x01*Z\x11*\x0f/vectors/delete\x92\x41\x1b\n\x11Vector Operations*\x06\x64\x65lete\x12[\n\x05\x46\x65tch\x12\r.FetchRequest\x1a\x0e.FetchResponse"3\x82\xd3\xe4\x93\x02\x10\x12\x0e/vectors/fetch\x92\x41\x1a\n\x11Vector Operations*\x05\x66\x65tch\x12V\n\x05Query\x12\r.QueryRequest\x1a\x0e.QueryResponse".\x82\xd3\xe4\x93\x02\x0b"\x06/query:\x01*\x92\x41\x1a\n\x11Vector Operations*\x05query\x12\x63\n\x06Update\x12\x0e.UpdateRequest\x1a\x0f.UpdateResponse"8\x82\xd3\xe4\x93\x02\x14"\x0f/vectors/update:\x01*\x92\x41\x1b\n\x11Vector Operations*\x06update\x12\xb4\x01\n\x12\x44\x65scribeIndexStats\x12\x1a.DescribeIndexStatsRequest\x1a\x1b.DescribeIndexStatsResponse"e\x82\xd3\xe4\x93\x02\x33"\x15/describe_index_stats:\x01*Z\x17\x12\x15/describe_index_stats\x92\x41)\n\x11Vector Operations*\x14\x64\x65scribe_index_statsB\xc0\x03\n\x11io.pinecone.protoP\x01Z/github.com/pinecone-io/new-go-pinecone/pinecone\x92\x41\xf6\x02\x12K\n\x0cPinecone API";\n\x0fPinecone.io Ops\x12\x13https://pinecone.io\x1a\x13support@pinecone.io\x1a\x39{index_name}-{project_name}.svc.{environment}.pinecone.io*\x01\x02\x32\x10\x61pplication/json:\x10\x61pplication/jsonZx\nv\n\nApiKeyAuth\x12h\x08\x02\x12YAn API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/\x1a\x07\x41pi-Key \x02\x62\x10\n\x0e\n\nApiKeyAuth\x12\x00r9\n\x19More Pinecone.io API docs\x12\x1chttps://www.pinecone.io/docsb\x06proto3', - dependencies=[ - google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - protoc__gen__openapiv2_dot_options_dot_annotations__pb2.DESCRIPTOR, - ], -) + name='vector_service.proto', + package='', + syntax='proto3', + serialized_options=b'\n\021io.pinecone.protoP\001Z/github.com/pinecone-io/new-go-pinecone/pinecone\222A\366\002\022K\n\014Pinecone API\";\n\017Pinecone.io Ops\022\023https://pinecone.io\032\023support@pinecone.io\0329{index_name}-{project_name}.svc.{environment}.pinecone.io*\001\0022\020application/json:\020application/jsonZx\nv\n\nApiKeyAuth\022h\010\002\022YAn API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/\032\007Api-Key \002b\020\n\016\n\nApiKeyAuth\022\000r9\n\031More Pinecone.io API docs\022\034https://www.pinecone.io/docs', + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x14vector_service.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a.protoc-gen-openapiv2/options/annotations.proto\"~\n\x0cSparseValues\x12\x35\n\x07indices\x18\x01 \x03(\rB$\x92\x41\x1eJ\x16[1, 312, 822, 14, 980]x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12\x37\n\x06values\x18\x02 \x03(\x02\x42\'\x92\x41!J\x19[0.1, 0.2, 0.3, 0.4, 0.5]x\xe8\x07\x80\x01\x01\xe0\x41\x02\"\xfd\x01\n\x06Vector\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12\"example-vector-1\"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12G\n\x06values\x18\x02 \x03(\x02\x42\x37\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\xe0\x41\x02\x12$\n\rsparse_values\x18\x04 \x01(\x0b\x32\r.SparseValues\x12V\n\x08metadata\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{\"genre\": \"documentary\", \"year\": 2019}\"\x93\x02\n\x0cScoredVector\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12\"example-vector-1\"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12\x18\n\x05score\x18\x02 \x01(\x02\x42\t\x92\x41\x06J\x04\x30.08\x12=\n\x06values\x18\x03 \x03(\x02\x42-\x92\x41*J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12V\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{\"genre\": \"documentary\", \"year\": 2019}\"d\n\rUpsertRequest\x12&\n\x07vectors\x18\x01 \x03(\x0b\x32\x07.VectorB\x0c\x92\x41\x06x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\"1\n\x0eUpsertResponse\x12\x1f\n\x0eupserted_count\x18\x01 \x01(\rB\x07\x92\x41\x04J\x02\x31\x30\"\xb6\x01\n\rDeleteRequest\x12(\n\x03ids\x18\x01 \x03(\tB\x1b\x92\x41\x18J\x10[\"id-0\", \"id-1\"]x\xe8\x07\x80\x01\x01\x12%\n\ndelete_all\x18\x02 \x01(\x08\x42\x11\x92\x41\x0e:\x05\x66\x61lseJ\x05\x66\x61lse\x12+\n\tnamespace\x18\x03 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\x12\'\n\x06\x66ilter\x18\x04 \x01(\x0b\x32\x17.google.protobuf.Struct\"\x10\n\x0e\x44\x65leteResponse\"h\n\x0c\x46\x65tchRequest\x12+\n\x03ids\x18\x01 \x03(\tB\x1e\x92\x41\x18J\x10[\"id-0\", \"id-1\"]x\xe8\x07\x80\x01\x01\xe0\x41\x02\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\"\xa3\x01\n\rFetchResponse\x12,\n\x07vectors\x18\x01 \x03(\x0b\x32\x1b.FetchResponse.VectorsEntry\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\x1a\x37\n\x0cVectorsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x16\n\x05value\x18\x02 \x01(\x0b\x32\x07.Vector:\x02\x38\x01\"\xd0\x02\n\x0bQueryVector\x12G\n\x06values\x18\x01 \x03(\x02\x42\x37\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\xe0\x41\x02\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12(\n\x05top_k\x18\x02 \x01(\rB\x19\x92\x41\x16J\x02\x31\x30Y\x00\x00\x00\x00\x00\x88\xc3@i\x00\x00\x00\x00\x00\x00\xf0?\x12+\n\tnamespace\x18\x03 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\x12{\n\x06\x66ilter\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructBR\x92\x41OJM{\"genre\": {\"$in\": [\"comedy\", \"documentary\", \"drama\"]}, \"year\": {\"$eq\": 2019}}\"\xfa\x03\n\x0cQueryRequest\x12+\n\tnamespace\x18\x01 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\x12+\n\x05top_k\x18\x02 \x01(\rB\x1c\x92\x41\x16J\x02\x31\x30Y\x00\x00\x00\x00\x00\x88\xc3@i\x00\x00\x00\x00\x00\x00\xf0?\xe0\x41\x02\x12{\n\x06\x66ilter\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructBR\x92\x41OJM{\"genre\": {\"$in\": [\"comedy\", \"documentary\", \"drama\"]}, \"year\": {\"$eq\": 2019}}\x12(\n\x0einclude_values\x18\x04 \x01(\x08\x42\x10\x92\x41\r:\x05\x66\x61lseJ\x04true\x12*\n\x10include_metadata\x18\x05 \x01(\x08\x42\x10\x92\x41\r:\x05\x66\x61lseJ\x04true\x12)\n\x07queries\x18\x06 \x03(\x0b\x32\x0c.QueryVectorB\n\x18\x01\x92\x41\x05x\n\x80\x01\x01\x12\x44\n\x06vector\x18\x07 \x03(\x02\x42\x34\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\x12$\n\rsparse_vector\x18\t \x01(\x0b\x32\r.SparseValues\x12&\n\x02id\x18\x08 \x01(\tB\x1a\x92\x41\x17J\x12\"example-vector-1\"x\x80\x04\"a\n\x12SingleQueryResults\x12\x1e\n\x07matches\x18\x01 \x03(\x0b\x32\r.ScoredVector\x12+\n\tnamespace\x18\x02 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\"l\n\rQueryResponse\x12(\n\x07results\x18\x01 \x03(\x0b\x32\x13.SingleQueryResultsB\x02\x18\x01\x12\x1e\n\x07matches\x18\x02 \x03(\x0b\x32\r.ScoredVector\x12\x11\n\tnamespace\x18\x03 \x01(\t\"\xb2\x02\n\rUpdateRequest\x12,\n\x02id\x18\x01 \x01(\tB \x92\x41\x1aJ\x12\"example-vector-1\"x\x80\x04\x80\x01\x01\xe0\x41\x02\x12\x44\n\x06values\x18\x02 \x03(\x02\x42\x34\x92\x41\x31J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\xa0\x9c\x01\x80\x01\x01\x12$\n\rsparse_values\x18\x05 \x01(\x0b\x32\r.SparseValues\x12Z\n\x0cset_metadata\x18\x03 \x01(\x0b\x32\x17.google.protobuf.StructB+\x92\x41(J&{\"genre\": \"documentary\", \"year\": 2019}\x12+\n\tnamespace\x18\x04 \x01(\tB\x18\x92\x41\x15J\x13\"example-namespace\"\"\x10\n\x0eUpdateResponse\"D\n\x19\x44\x65scribeIndexStatsRequest\x12\'\n\x06\x66ilter\x18\x01 \x01(\x0b\x32\x17.google.protobuf.Struct\"4\n\x10NamespaceSummary\x12 \n\x0cvector_count\x18\x01 \x01(\rB\n\x92\x41\x07J\x05\x35\x30\x30\x30\x30\"\x9a\x03\n\x1a\x44\x65scribeIndexStatsResponse\x12?\n\nnamespaces\x18\x01 \x03(\x0b\x32+.DescribeIndexStatsResponse.NamespacesEntry\x12\x1c\n\tdimension\x18\x02 \x01(\rB\t\x92\x41\x06J\x04\x31\x30\x32\x34\x12 \n\x0eindex_fullness\x18\x03 \x01(\x02\x42\x08\x92\x41\x05J\x03\x30.4\x12&\n\x12total_vector_count\x18\x04 \x01(\rB\n\x92\x41\x07J\x05\x38\x30\x30\x30\x30\x1a\x44\n\x0fNamespacesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12 \n\x05value\x18\x02 \x01(\x0b\x32\x11.NamespaceSummary:\x02\x38\x01:\x8c\x01\x92\x41\x88\x01\x32\x85\x01{\"namespaces\": {\"\": {\"vectorCount\": 50000}, \"example-namespace-2\": {\"vectorCount\": 30000}}, \"dimension\": 1024, \"index_fullness\": 0.4}2\xbd\x05\n\rVectorService\x12\x63\n\x06Upsert\x12\x0e.UpsertRequest\x1a\x0f.UpsertResponse\"8\x82\xd3\xe4\x93\x02\x14\"\x0f/vectors/upsert:\x01*\x92\x41\x1b\n\x11Vector Operations*\x06upsert\x12v\n\x06\x44\x65lete\x12\x0e.DeleteRequest\x1a\x0f.DeleteResponse\"K\x82\xd3\xe4\x93\x02\'\"\x0f/vectors/delete:\x01*Z\x11*\x0f/vectors/delete\x92\x41\x1b\n\x11Vector Operations*\x06\x64\x65lete\x12[\n\x05\x46\x65tch\x12\r.FetchRequest\x1a\x0e.FetchResponse\"3\x82\xd3\xe4\x93\x02\x10\x12\x0e/vectors/fetch\x92\x41\x1a\n\x11Vector Operations*\x05\x66\x65tch\x12V\n\x05Query\x12\r.QueryRequest\x1a\x0e.QueryResponse\".\x82\xd3\xe4\x93\x02\x0b\"\x06/query:\x01*\x92\x41\x1a\n\x11Vector Operations*\x05query\x12\x63\n\x06Update\x12\x0e.UpdateRequest\x1a\x0f.UpdateResponse\"8\x82\xd3\xe4\x93\x02\x14\"\x0f/vectors/update:\x01*\x92\x41\x1b\n\x11Vector Operations*\x06update\x12\xb4\x01\n\x12\x44\x65scribeIndexStats\x12\x1a.DescribeIndexStatsRequest\x1a\x1b.DescribeIndexStatsResponse\"e\x82\xd3\xe4\x93\x02\x33\"\x15/describe_index_stats:\x01*Z\x17\x12\x15/describe_index_stats\x92\x41)\n\x11Vector Operations*\x14\x64\x65scribe_index_statsB\xc0\x03\n\x11io.pinecone.protoP\x01Z/github.com/pinecone-io/new-go-pinecone/pinecone\x92\x41\xf6\x02\x12K\n\x0cPinecone API\";\n\x0fPinecone.io Ops\x12\x13https://pinecone.io\x1a\x13support@pinecone.io\x1a\x39{index_name}-{project_name}.svc.{environment}.pinecone.io*\x01\x02\x32\x10\x61pplication/json:\x10\x61pplication/jsonZx\nv\n\nApiKeyAuth\x12h\x08\x02\x12YAn API Key is required to call Pinecone APIs. Get yours at https://www.pinecone.io/start/\x1a\x07\x41pi-Key \x02\x62\x10\n\x0e\n\nApiKeyAuth\x12\x00r9\n\x19More Pinecone.io API docs\x12\x1chttps://www.pinecone.io/docsb\x06proto3' + , + dependencies=[google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,google_dot_api_dot_annotations__pb2.DESCRIPTOR,google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,protoc__gen__openapiv2_dot_options_dot_annotations__pb2.DESCRIPTOR,]) + + _SPARSEVALUES = _descriptor.Descriptor( - name="SparseValues", - full_name="SparseValues", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="indices", - full_name="SparseValues.indices", - index=0, - number=1, - type=13, - cpp_type=3, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\036J\026[1, 312, 822, 14, 980]x\350\007\200\001\001\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="values", - full_name="SparseValues.values", - index=1, - number=2, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A!J\031[0.1, 0.2, 0.3, 0.4, 0.5]x\350\007\200\001\001\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=165, - serialized_end=291, + name='SparseValues', + full_name='SparseValues', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='indices', full_name='SparseValues.indices', index=0, + number=1, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\036J\026[1, 312, 822, 14, 980]x\350\007\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='values', full_name='SparseValues.values', index=1, + number=2, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A!J\031[0.1, 0.2, 0.3, 0.4, 0.5]x\350\007\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=165, + serialized_end=291, ) _VECTOR = _descriptor.Descriptor( - name="Vector", - full_name="Vector", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="Vector.id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\032J\022"example-vector-1"x\200\004\200\001\001\340A\002', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="values", - full_name="Vector.values", - index=1, - number=2, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sparse_values", - full_name="Vector.sparse_values", - index=2, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="Vector.metadata", - index=3, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A(J&{"genre": "documentary", "year": 2019}', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=294, - serialized_end=547, + name='Vector', + full_name='Vector', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='Vector.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\032J\022\"example-vector-1\"x\200\004\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='values', full_name='Vector.values', index=1, + number=2, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sparse_values', full_name='Vector.sparse_values', index=2, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='Vector.metadata', index=3, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A(J&{\"genre\": \"documentary\", \"year\": 2019}', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=294, + serialized_end=547, ) _SCOREDVECTOR = _descriptor.Descriptor( - name="ScoredVector", - full_name="ScoredVector", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="ScoredVector.id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\032J\022"example-vector-1"x\200\004\200\001\001\340A\002', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="score", - full_name="ScoredVector.score", - index=1, - number=2, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\006J\0040.08", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="values", - full_name="ScoredVector.values", - index=2, - number=3, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A*J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sparse_values", - full_name="ScoredVector.sparse_values", - index=3, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="ScoredVector.metadata", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A(J&{"genre": "documentary", "year": 2019}', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=550, - serialized_end=825, + name='ScoredVector', + full_name='ScoredVector', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='ScoredVector.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\032J\022\"example-vector-1\"x\200\004\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='score', full_name='ScoredVector.score', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\006J\0040.08', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='values', full_name='ScoredVector.values', index=2, + number=3, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A*J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sparse_values', full_name='ScoredVector.sparse_values', index=3, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='metadata', full_name='ScoredVector.metadata', index=4, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A(J&{\"genre\": \"documentary\", \"year\": 2019}', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=550, + serialized_end=825, ) _UPSERTREQUEST = _descriptor.Descriptor( - name="UpsertRequest", - full_name="UpsertRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="vectors", - full_name="UpsertRequest.vectors", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\006x\350\007\200\001\001\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="UpsertRequest.namespace", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=827, - serialized_end=927, + name='UpsertRequest', + full_name='UpsertRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vectors', full_name='UpsertRequest.vectors', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\006x\350\007\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='UpsertRequest.namespace', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=827, + serialized_end=927, ) _UPSERTRESPONSE = _descriptor.Descriptor( - name="UpsertResponse", - full_name="UpsertResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="upserted_count", - full_name="UpsertResponse.upserted_count", - index=0, - number=1, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\004J\00210", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=929, - serialized_end=978, + name='UpsertResponse', + full_name='UpsertResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='upserted_count', full_name='UpsertResponse.upserted_count', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\004J\00210', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=929, + serialized_end=978, ) _DELETEREQUEST = _descriptor.Descriptor( - name="DeleteRequest", - full_name="DeleteRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="ids", - full_name="DeleteRequest.ids", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\030J\020["id-0", "id-1"]x\350\007\200\001\001', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="delete_all", - full_name="DeleteRequest.delete_all", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\016:\005falseJ\005false", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="DeleteRequest.namespace", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="DeleteRequest.filter", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=981, - serialized_end=1163, + name='DeleteRequest', + full_name='DeleteRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='ids', full_name='DeleteRequest.ids', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\030J\020[\"id-0\", \"id-1\"]x\350\007\200\001\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='delete_all', full_name='DeleteRequest.delete_all', index=1, + number=2, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\016:\005falseJ\005false', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='DeleteRequest.namespace', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='filter', full_name='DeleteRequest.filter', index=3, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=981, + serialized_end=1163, ) _DELETERESPONSE = _descriptor.Descriptor( - name="DeleteResponse", - full_name="DeleteResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1165, - serialized_end=1181, + name='DeleteResponse', + full_name='DeleteResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1165, + serialized_end=1181, ) _FETCHREQUEST = _descriptor.Descriptor( - name="FetchRequest", - full_name="FetchRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="ids", - full_name="FetchRequest.ids", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\030J\020["id-0", "id-1"]x\350\007\200\001\001\340A\002', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="FetchRequest.namespace", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1183, - serialized_end=1287, + name='FetchRequest', + full_name='FetchRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='ids', full_name='FetchRequest.ids', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\030J\020[\"id-0\", \"id-1\"]x\350\007\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='FetchRequest.namespace', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1183, + serialized_end=1287, ) _FETCHRESPONSE_VECTORSENTRY = _descriptor.Descriptor( - name="VectorsEntry", - full_name="FetchResponse.VectorsEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="FetchResponse.VectorsEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="FetchResponse.VectorsEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1398, - serialized_end=1453, + name='VectorsEntry', + full_name='FetchResponse.VectorsEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='FetchResponse.VectorsEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='FetchResponse.VectorsEntry.value', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1398, + serialized_end=1453, ) _FETCHRESPONSE = _descriptor.Descriptor( - name="FetchResponse", - full_name="FetchResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="vectors", - full_name="FetchResponse.vectors", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="FetchResponse.namespace", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _FETCHRESPONSE_VECTORSENTRY, - ], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1290, - serialized_end=1453, + name='FetchResponse', + full_name='FetchResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vectors', full_name='FetchResponse.vectors', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='FetchResponse.namespace', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_FETCHRESPONSE_VECTORSENTRY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1290, + serialized_end=1453, ) _QUERYVECTOR = _descriptor.Descriptor( - name="QueryVector", - full_name="QueryVector", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="values", - full_name="QueryVector.values", - index=0, - number=1, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sparse_values", - full_name="QueryVector.sparse_values", - index=1, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="top_k", - full_name="QueryVector.top_k", - index=2, - number=2, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\026J\00210Y\000\000\000\000\000\210\303@i\000\000\000\000\000\000\360?", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="QueryVector.namespace", - index=3, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="QueryVector.filter", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222AOJM{"genre": {"$in": ["comedy", "documentary", "drama"]}, "year": {"$eq": 2019}}', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1456, - serialized_end=1792, + name='QueryVector', + full_name='QueryVector', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='values', full_name='QueryVector.values', index=0, + number=1, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sparse_values', full_name='QueryVector.sparse_values', index=1, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='top_k', full_name='QueryVector.top_k', index=2, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\026J\00210Y\000\000\000\000\000\210\303@i\000\000\000\000\000\000\360?', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='QueryVector.namespace', index=3, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='filter', full_name='QueryVector.filter', index=4, + number=4, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222AOJM{\"genre\": {\"$in\": [\"comedy\", \"documentary\", \"drama\"]}, \"year\": {\"$eq\": 2019}}', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1456, + serialized_end=1792, ) _QUERYREQUEST = _descriptor.Descriptor( - name="QueryRequest", - full_name="QueryRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="namespace", - full_name="QueryRequest.namespace", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="top_k", - full_name="QueryRequest.top_k", - index=1, - number=2, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\026J\00210Y\000\000\000\000\000\210\303@i\000\000\000\000\000\000\360?\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="QueryRequest.filter", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222AOJM{"genre": {"$in": ["comedy", "documentary", "drama"]}, "year": {"$eq": 2019}}', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="include_values", - full_name="QueryRequest.include_values", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\r:\005falseJ\004true", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="include_metadata", - full_name="QueryRequest.include_metadata", - index=4, - number=5, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\r:\005falseJ\004true", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="queries", - full_name="QueryRequest.queries", - index=5, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001\222A\005x\n\200\001\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="vector", - full_name="QueryRequest.vector", - index=6, - number=7, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sparse_vector", - full_name="QueryRequest.sparse_vector", - index=7, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="QueryRequest.id", - index=8, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\027J\022"example-vector-1"x\200\004', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1795, - serialized_end=2301, + name='QueryRequest', + full_name='QueryRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='namespace', full_name='QueryRequest.namespace', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='top_k', full_name='QueryRequest.top_k', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\026J\00210Y\000\000\000\000\000\210\303@i\000\000\000\000\000\000\360?\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='filter', full_name='QueryRequest.filter', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222AOJM{\"genre\": {\"$in\": [\"comedy\", \"documentary\", \"drama\"]}, \"year\": {\"$eq\": 2019}}', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='include_values', full_name='QueryRequest.include_values', index=3, + number=4, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\r:\005falseJ\004true', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='include_metadata', full_name='QueryRequest.include_metadata', index=4, + number=5, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\r:\005falseJ\004true', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='queries', full_name='QueryRequest.queries', index=5, + number=6, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\030\001\222A\005x\n\200\001\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='vector', full_name='QueryRequest.vector', index=6, + number=7, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sparse_vector', full_name='QueryRequest.sparse_vector', index=7, + number=9, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='id', full_name='QueryRequest.id', index=8, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\027J\022\"example-vector-1\"x\200\004', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1795, + serialized_end=2301, ) _SINGLEQUERYRESULTS = _descriptor.Descriptor( - name="SingleQueryResults", - full_name="SingleQueryResults", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="matches", - full_name="SingleQueryResults.matches", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="SingleQueryResults.namespace", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2303, - serialized_end=2400, + name='SingleQueryResults', + full_name='SingleQueryResults', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='matches', full_name='SingleQueryResults.matches', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='SingleQueryResults.namespace', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2303, + serialized_end=2400, ) _QUERYRESPONSE = _descriptor.Descriptor( - name="QueryResponse", - full_name="QueryResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="results", - full_name="QueryResponse.results", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="matches", - full_name="QueryResponse.matches", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="QueryResponse.namespace", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2402, - serialized_end=2510, + name='QueryResponse', + full_name='QueryResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='results', full_name='QueryResponse.results', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\030\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='matches', full_name='QueryResponse.matches', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='QueryResponse.namespace', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2402, + serialized_end=2510, ) _UPDATEREQUEST = _descriptor.Descriptor( - name="UpdateRequest", - full_name="UpdateRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="id", - full_name="UpdateRequest.id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\032J\022"example-vector-1"x\200\004\200\001\001\340A\002', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="values", - full_name="UpdateRequest.values", - index=1, - number=2, - type=2, - cpp_type=6, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="sparse_values", - full_name="UpdateRequest.sparse_values", - index=2, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="set_metadata", - full_name="UpdateRequest.set_metadata", - index=3, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A(J&{"genre": "documentary", "year": 2019}', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="namespace", - full_name="UpdateRequest.namespace", - index=4, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b'\222A\025J\023"example-namespace"', - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2513, - serialized_end=2819, + name='UpdateRequest', + full_name='UpdateRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='id', full_name='UpdateRequest.id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\032J\022\"example-vector-1\"x\200\004\200\001\001\340A\002', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='values', full_name='UpdateRequest.values', index=1, + number=2, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A1J([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]x\240\234\001\200\001\001', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='sparse_values', full_name='UpdateRequest.sparse_values', index=2, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='set_metadata', full_name='UpdateRequest.set_metadata', index=3, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A(J&{\"genre\": \"documentary\", \"year\": 2019}', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='namespace', full_name='UpdateRequest.namespace', index=4, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\025J\023\"example-namespace\"', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2513, + serialized_end=2819, ) _UPDATERESPONSE = _descriptor.Descriptor( - name="UpdateResponse", - full_name="UpdateResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2821, - serialized_end=2837, + name='UpdateResponse', + full_name='UpdateResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2821, + serialized_end=2837, ) _DESCRIBEINDEXSTATSREQUEST = _descriptor.Descriptor( - name="DescribeIndexStatsRequest", - full_name="DescribeIndexStatsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="filter", - full_name="DescribeIndexStatsRequest.filter", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2839, - serialized_end=2907, + name='DescribeIndexStatsRequest', + full_name='DescribeIndexStatsRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='filter', full_name='DescribeIndexStatsRequest.filter', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2839, + serialized_end=2907, ) _NAMESPACESUMMARY = _descriptor.Descriptor( - name="NamespaceSummary", - full_name="NamespaceSummary", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="vector_count", - full_name="NamespaceSummary.vector_count", - index=0, - number=1, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\007J\00550000", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2909, - serialized_end=2961, + name='NamespaceSummary', + full_name='NamespaceSummary', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='vector_count', full_name='NamespaceSummary.vector_count', index=0, + number=1, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\007J\00550000', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2909, + serialized_end=2961, ) _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY = _descriptor.Descriptor( - name="NamespacesEntry", - full_name="DescribeIndexStatsResponse.NamespacesEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="DescribeIndexStatsResponse.NamespacesEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="DescribeIndexStatsResponse.NamespacesEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3163, - serialized_end=3231, + name='NamespacesEntry', + full_name='DescribeIndexStatsResponse.NamespacesEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='DescribeIndexStatsResponse.NamespacesEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='DescribeIndexStatsResponse.NamespacesEntry.value', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=3163, + serialized_end=3231, ) _DESCRIBEINDEXSTATSRESPONSE = _descriptor.Descriptor( - name="DescribeIndexStatsResponse", - full_name="DescribeIndexStatsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="namespaces", - full_name="DescribeIndexStatsResponse.namespaces", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="dimension", - full_name="DescribeIndexStatsResponse.dimension", - index=1, - number=2, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\006J\0041024", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="index_fullness", - full_name="DescribeIndexStatsResponse.index_fullness", - index=2, - number=3, - type=2, - cpp_type=6, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\005J\0030.4", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="total_vector_count", - full_name="DescribeIndexStatsResponse.total_vector_count", - index=3, - number=4, - type=13, - cpp_type=3, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\222A\007J\00580000", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY, - ], - enum_types=[], - serialized_options=b'\222A\210\0012\205\001{"namespaces": {"": {"vectorCount": 50000}, "example-namespace-2": {"vectorCount": 30000}}, "dimension": 1024, "index_fullness": 0.4}', - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2964, - serialized_end=3374, + name='DescribeIndexStatsResponse', + full_name='DescribeIndexStatsResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='namespaces', full_name='DescribeIndexStatsResponse.namespaces', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='dimension', full_name='DescribeIndexStatsResponse.dimension', index=1, + number=2, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\006J\0041024', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='index_fullness', full_name='DescribeIndexStatsResponse.index_fullness', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\005J\0030.4', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='total_vector_count', full_name='DescribeIndexStatsResponse.total_vector_count', index=3, + number=4, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=b'\222A\007J\00580000', file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY, ], + enum_types=[ + ], + serialized_options=b'\222A\210\0012\205\001{\"namespaces\": {\"\": {\"vectorCount\": 50000}, \"example-namespace-2\": {\"vectorCount\": 30000}}, \"dimension\": 1024, \"index_fullness\": 0.4}', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=2964, + serialized_end=3374, ) -_VECTOR.fields_by_name["sparse_values"].message_type = _SPARSEVALUES -_VECTOR.fields_by_name["metadata"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_SCOREDVECTOR.fields_by_name["sparse_values"].message_type = _SPARSEVALUES -_SCOREDVECTOR.fields_by_name["metadata"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_UPSERTREQUEST.fields_by_name["vectors"].message_type = _VECTOR -_DELETEREQUEST.fields_by_name["filter"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_FETCHRESPONSE_VECTORSENTRY.fields_by_name["value"].message_type = _VECTOR +_VECTOR.fields_by_name['sparse_values'].message_type = _SPARSEVALUES +_VECTOR.fields_by_name['metadata'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_SCOREDVECTOR.fields_by_name['sparse_values'].message_type = _SPARSEVALUES +_SCOREDVECTOR.fields_by_name['metadata'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_UPSERTREQUEST.fields_by_name['vectors'].message_type = _VECTOR +_DELETEREQUEST.fields_by_name['filter'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_FETCHRESPONSE_VECTORSENTRY.fields_by_name['value'].message_type = _VECTOR _FETCHRESPONSE_VECTORSENTRY.containing_type = _FETCHRESPONSE -_FETCHRESPONSE.fields_by_name["vectors"].message_type = _FETCHRESPONSE_VECTORSENTRY -_QUERYVECTOR.fields_by_name["sparse_values"].message_type = _SPARSEVALUES -_QUERYVECTOR.fields_by_name["filter"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYREQUEST.fields_by_name["filter"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_QUERYREQUEST.fields_by_name["queries"].message_type = _QUERYVECTOR -_QUERYREQUEST.fields_by_name["sparse_vector"].message_type = _SPARSEVALUES -_SINGLEQUERYRESULTS.fields_by_name["matches"].message_type = _SCOREDVECTOR -_QUERYRESPONSE.fields_by_name["results"].message_type = _SINGLEQUERYRESULTS -_QUERYRESPONSE.fields_by_name["matches"].message_type = _SCOREDVECTOR -_UPDATEREQUEST.fields_by_name["sparse_values"].message_type = _SPARSEVALUES -_UPDATEREQUEST.fields_by_name["set_metadata"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_DESCRIBEINDEXSTATSREQUEST.fields_by_name["filter"].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT -_DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY.fields_by_name["value"].message_type = _NAMESPACESUMMARY +_FETCHRESPONSE.fields_by_name['vectors'].message_type = _FETCHRESPONSE_VECTORSENTRY +_QUERYVECTOR.fields_by_name['sparse_values'].message_type = _SPARSEVALUES +_QUERYVECTOR.fields_by_name['filter'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_QUERYREQUEST.fields_by_name['filter'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_QUERYREQUEST.fields_by_name['queries'].message_type = _QUERYVECTOR +_QUERYREQUEST.fields_by_name['sparse_vector'].message_type = _SPARSEVALUES +_SINGLEQUERYRESULTS.fields_by_name['matches'].message_type = _SCOREDVECTOR +_QUERYRESPONSE.fields_by_name['results'].message_type = _SINGLEQUERYRESULTS +_QUERYRESPONSE.fields_by_name['matches'].message_type = _SCOREDVECTOR +_UPDATEREQUEST.fields_by_name['sparse_values'].message_type = _SPARSEVALUES +_UPDATEREQUEST.fields_by_name['set_metadata'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_DESCRIBEINDEXSTATSREQUEST.fields_by_name['filter'].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY.fields_by_name['value'].message_type = _NAMESPACESUMMARY _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY.containing_type = _DESCRIBEINDEXSTATSRESPONSE -_DESCRIBEINDEXSTATSRESPONSE.fields_by_name["namespaces"].message_type = _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY -DESCRIPTOR.message_types_by_name["SparseValues"] = _SPARSEVALUES -DESCRIPTOR.message_types_by_name["Vector"] = _VECTOR -DESCRIPTOR.message_types_by_name["ScoredVector"] = _SCOREDVECTOR -DESCRIPTOR.message_types_by_name["UpsertRequest"] = _UPSERTREQUEST -DESCRIPTOR.message_types_by_name["UpsertResponse"] = _UPSERTRESPONSE -DESCRIPTOR.message_types_by_name["DeleteRequest"] = _DELETEREQUEST -DESCRIPTOR.message_types_by_name["DeleteResponse"] = _DELETERESPONSE -DESCRIPTOR.message_types_by_name["FetchRequest"] = _FETCHREQUEST -DESCRIPTOR.message_types_by_name["FetchResponse"] = _FETCHRESPONSE -DESCRIPTOR.message_types_by_name["QueryVector"] = _QUERYVECTOR -DESCRIPTOR.message_types_by_name["QueryRequest"] = _QUERYREQUEST -DESCRIPTOR.message_types_by_name["SingleQueryResults"] = _SINGLEQUERYRESULTS -DESCRIPTOR.message_types_by_name["QueryResponse"] = _QUERYRESPONSE -DESCRIPTOR.message_types_by_name["UpdateRequest"] = _UPDATEREQUEST -DESCRIPTOR.message_types_by_name["UpdateResponse"] = _UPDATERESPONSE -DESCRIPTOR.message_types_by_name["DescribeIndexStatsRequest"] = _DESCRIBEINDEXSTATSREQUEST -DESCRIPTOR.message_types_by_name["NamespaceSummary"] = _NAMESPACESUMMARY -DESCRIPTOR.message_types_by_name["DescribeIndexStatsResponse"] = _DESCRIBEINDEXSTATSRESPONSE +_DESCRIBEINDEXSTATSRESPONSE.fields_by_name['namespaces'].message_type = _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY +DESCRIPTOR.message_types_by_name['SparseValues'] = _SPARSEVALUES +DESCRIPTOR.message_types_by_name['Vector'] = _VECTOR +DESCRIPTOR.message_types_by_name['ScoredVector'] = _SCOREDVECTOR +DESCRIPTOR.message_types_by_name['UpsertRequest'] = _UPSERTREQUEST +DESCRIPTOR.message_types_by_name['UpsertResponse'] = _UPSERTRESPONSE +DESCRIPTOR.message_types_by_name['DeleteRequest'] = _DELETEREQUEST +DESCRIPTOR.message_types_by_name['DeleteResponse'] = _DELETERESPONSE +DESCRIPTOR.message_types_by_name['FetchRequest'] = _FETCHREQUEST +DESCRIPTOR.message_types_by_name['FetchResponse'] = _FETCHRESPONSE +DESCRIPTOR.message_types_by_name['QueryVector'] = _QUERYVECTOR +DESCRIPTOR.message_types_by_name['QueryRequest'] = _QUERYREQUEST +DESCRIPTOR.message_types_by_name['SingleQueryResults'] = _SINGLEQUERYRESULTS +DESCRIPTOR.message_types_by_name['QueryResponse'] = _QUERYRESPONSE +DESCRIPTOR.message_types_by_name['UpdateRequest'] = _UPDATEREQUEST +DESCRIPTOR.message_types_by_name['UpdateResponse'] = _UPDATERESPONSE +DESCRIPTOR.message_types_by_name['DescribeIndexStatsRequest'] = _DESCRIBEINDEXSTATSREQUEST +DESCRIPTOR.message_types_by_name['NamespaceSummary'] = _NAMESPACESUMMARY +DESCRIPTOR.message_types_by_name['DescribeIndexStatsResponse'] = _DESCRIBEINDEXSTATSRESPONSE _sym_db.RegisterFileDescriptor(DESCRIPTOR) -SparseValues = _reflection.GeneratedProtocolMessageType( - "SparseValues", - (_message.Message,), - { - "DESCRIPTOR": _SPARSEVALUES, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:SparseValues) - }, -) +SparseValues = _reflection.GeneratedProtocolMessageType('SparseValues', (_message.Message,), { + 'DESCRIPTOR' : _SPARSEVALUES, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:SparseValues) + }) _sym_db.RegisterMessage(SparseValues) -Vector = _reflection.GeneratedProtocolMessageType( - "Vector", - (_message.Message,), - { - "DESCRIPTOR": _VECTOR, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:Vector) - }, -) +Vector = _reflection.GeneratedProtocolMessageType('Vector', (_message.Message,), { + 'DESCRIPTOR' : _VECTOR, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:Vector) + }) _sym_db.RegisterMessage(Vector) -ScoredVector = _reflection.GeneratedProtocolMessageType( - "ScoredVector", - (_message.Message,), - { - "DESCRIPTOR": _SCOREDVECTOR, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:ScoredVector) - }, -) +ScoredVector = _reflection.GeneratedProtocolMessageType('ScoredVector', (_message.Message,), { + 'DESCRIPTOR' : _SCOREDVECTOR, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:ScoredVector) + }) _sym_db.RegisterMessage(ScoredVector) -UpsertRequest = _reflection.GeneratedProtocolMessageType( - "UpsertRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPSERTREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:UpsertRequest) - }, -) +UpsertRequest = _reflection.GeneratedProtocolMessageType('UpsertRequest', (_message.Message,), { + 'DESCRIPTOR' : _UPSERTREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:UpsertRequest) + }) _sym_db.RegisterMessage(UpsertRequest) -UpsertResponse = _reflection.GeneratedProtocolMessageType( - "UpsertResponse", - (_message.Message,), - { - "DESCRIPTOR": _UPSERTRESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:UpsertResponse) - }, -) +UpsertResponse = _reflection.GeneratedProtocolMessageType('UpsertResponse', (_message.Message,), { + 'DESCRIPTOR' : _UPSERTRESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:UpsertResponse) + }) _sym_db.RegisterMessage(UpsertResponse) -DeleteRequest = _reflection.GeneratedProtocolMessageType( - "DeleteRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:DeleteRequest) - }, -) +DeleteRequest = _reflection.GeneratedProtocolMessageType('DeleteRequest', (_message.Message,), { + 'DESCRIPTOR' : _DELETEREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:DeleteRequest) + }) _sym_db.RegisterMessage(DeleteRequest) -DeleteResponse = _reflection.GeneratedProtocolMessageType( - "DeleteResponse", - (_message.Message,), - { - "DESCRIPTOR": _DELETERESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:DeleteResponse) - }, -) +DeleteResponse = _reflection.GeneratedProtocolMessageType('DeleteResponse', (_message.Message,), { + 'DESCRIPTOR' : _DELETERESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:DeleteResponse) + }) _sym_db.RegisterMessage(DeleteResponse) -FetchRequest = _reflection.GeneratedProtocolMessageType( - "FetchRequest", - (_message.Message,), - { - "DESCRIPTOR": _FETCHREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:FetchRequest) - }, -) +FetchRequest = _reflection.GeneratedProtocolMessageType('FetchRequest', (_message.Message,), { + 'DESCRIPTOR' : _FETCHREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:FetchRequest) + }) _sym_db.RegisterMessage(FetchRequest) -FetchResponse = _reflection.GeneratedProtocolMessageType( - "FetchResponse", - (_message.Message,), - { - "VectorsEntry": _reflection.GeneratedProtocolMessageType( - "VectorsEntry", - (_message.Message,), - { - "DESCRIPTOR": _FETCHRESPONSE_VECTORSENTRY, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:FetchResponse.VectorsEntry) - }, - ), - "DESCRIPTOR": _FETCHRESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:FetchResponse) - }, -) +FetchResponse = _reflection.GeneratedProtocolMessageType('FetchResponse', (_message.Message,), { + + 'VectorsEntry' : _reflection.GeneratedProtocolMessageType('VectorsEntry', (_message.Message,), { + 'DESCRIPTOR' : _FETCHRESPONSE_VECTORSENTRY, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:FetchResponse.VectorsEntry) + }) + , + 'DESCRIPTOR' : _FETCHRESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:FetchResponse) + }) _sym_db.RegisterMessage(FetchResponse) _sym_db.RegisterMessage(FetchResponse.VectorsEntry) -QueryVector = _reflection.GeneratedProtocolMessageType( - "QueryVector", - (_message.Message,), - { - "DESCRIPTOR": _QUERYVECTOR, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:QueryVector) - }, -) +QueryVector = _reflection.GeneratedProtocolMessageType('QueryVector', (_message.Message,), { + 'DESCRIPTOR' : _QUERYVECTOR, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:QueryVector) + }) _sym_db.RegisterMessage(QueryVector) -QueryRequest = _reflection.GeneratedProtocolMessageType( - "QueryRequest", - (_message.Message,), - { - "DESCRIPTOR": _QUERYREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:QueryRequest) - }, -) +QueryRequest = _reflection.GeneratedProtocolMessageType('QueryRequest', (_message.Message,), { + 'DESCRIPTOR' : _QUERYREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:QueryRequest) + }) _sym_db.RegisterMessage(QueryRequest) -SingleQueryResults = _reflection.GeneratedProtocolMessageType( - "SingleQueryResults", - (_message.Message,), - { - "DESCRIPTOR": _SINGLEQUERYRESULTS, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:SingleQueryResults) - }, -) +SingleQueryResults = _reflection.GeneratedProtocolMessageType('SingleQueryResults', (_message.Message,), { + 'DESCRIPTOR' : _SINGLEQUERYRESULTS, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:SingleQueryResults) + }) _sym_db.RegisterMessage(SingleQueryResults) -QueryResponse = _reflection.GeneratedProtocolMessageType( - "QueryResponse", - (_message.Message,), - { - "DESCRIPTOR": _QUERYRESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:QueryResponse) - }, -) +QueryResponse = _reflection.GeneratedProtocolMessageType('QueryResponse', (_message.Message,), { + 'DESCRIPTOR' : _QUERYRESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:QueryResponse) + }) _sym_db.RegisterMessage(QueryResponse) -UpdateRequest = _reflection.GeneratedProtocolMessageType( - "UpdateRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:UpdateRequest) - }, -) +UpdateRequest = _reflection.GeneratedProtocolMessageType('UpdateRequest', (_message.Message,), { + 'DESCRIPTOR' : _UPDATEREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:UpdateRequest) + }) _sym_db.RegisterMessage(UpdateRequest) -UpdateResponse = _reflection.GeneratedProtocolMessageType( - "UpdateResponse", - (_message.Message,), - { - "DESCRIPTOR": _UPDATERESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:UpdateResponse) - }, -) +UpdateResponse = _reflection.GeneratedProtocolMessageType('UpdateResponse', (_message.Message,), { + 'DESCRIPTOR' : _UPDATERESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:UpdateResponse) + }) _sym_db.RegisterMessage(UpdateResponse) -DescribeIndexStatsRequest = _reflection.GeneratedProtocolMessageType( - "DescribeIndexStatsRequest", - (_message.Message,), - { - "DESCRIPTOR": _DESCRIBEINDEXSTATSREQUEST, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:DescribeIndexStatsRequest) - }, -) +DescribeIndexStatsRequest = _reflection.GeneratedProtocolMessageType('DescribeIndexStatsRequest', (_message.Message,), { + 'DESCRIPTOR' : _DESCRIBEINDEXSTATSREQUEST, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:DescribeIndexStatsRequest) + }) _sym_db.RegisterMessage(DescribeIndexStatsRequest) -NamespaceSummary = _reflection.GeneratedProtocolMessageType( - "NamespaceSummary", - (_message.Message,), - { - "DESCRIPTOR": _NAMESPACESUMMARY, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:NamespaceSummary) - }, -) +NamespaceSummary = _reflection.GeneratedProtocolMessageType('NamespaceSummary', (_message.Message,), { + 'DESCRIPTOR' : _NAMESPACESUMMARY, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:NamespaceSummary) + }) _sym_db.RegisterMessage(NamespaceSummary) -DescribeIndexStatsResponse = _reflection.GeneratedProtocolMessageType( - "DescribeIndexStatsResponse", - (_message.Message,), - { - "NamespacesEntry": _reflection.GeneratedProtocolMessageType( - "NamespacesEntry", - (_message.Message,), - { - "DESCRIPTOR": _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:DescribeIndexStatsResponse.NamespacesEntry) - }, - ), - "DESCRIPTOR": _DESCRIBEINDEXSTATSRESPONSE, - "__module__": "vector_service_pb2" - # @@protoc_insertion_point(class_scope:DescribeIndexStatsResponse) - }, -) +DescribeIndexStatsResponse = _reflection.GeneratedProtocolMessageType('DescribeIndexStatsResponse', (_message.Message,), { + + 'NamespacesEntry' : _reflection.GeneratedProtocolMessageType('NamespacesEntry', (_message.Message,), { + 'DESCRIPTOR' : _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:DescribeIndexStatsResponse.NamespacesEntry) + }) + , + 'DESCRIPTOR' : _DESCRIBEINDEXSTATSRESPONSE, + '__module__' : 'vector_service_pb2' + # @@protoc_insertion_point(class_scope:DescribeIndexStatsResponse) + }) _sym_db.RegisterMessage(DescribeIndexStatsResponse) _sym_db.RegisterMessage(DescribeIndexStatsResponse.NamespacesEntry) DESCRIPTOR._options = None -_SPARSEVALUES.fields_by_name["indices"]._options = None -_SPARSEVALUES.fields_by_name["values"]._options = None -_VECTOR.fields_by_name["id"]._options = None -_VECTOR.fields_by_name["values"]._options = None -_VECTOR.fields_by_name["metadata"]._options = None -_SCOREDVECTOR.fields_by_name["id"]._options = None -_SCOREDVECTOR.fields_by_name["score"]._options = None -_SCOREDVECTOR.fields_by_name["values"]._options = None -_SCOREDVECTOR.fields_by_name["metadata"]._options = None -_UPSERTREQUEST.fields_by_name["vectors"]._options = None -_UPSERTREQUEST.fields_by_name["namespace"]._options = None -_UPSERTRESPONSE.fields_by_name["upserted_count"]._options = None -_DELETEREQUEST.fields_by_name["ids"]._options = None -_DELETEREQUEST.fields_by_name["delete_all"]._options = None -_DELETEREQUEST.fields_by_name["namespace"]._options = None -_FETCHREQUEST.fields_by_name["ids"]._options = None -_FETCHREQUEST.fields_by_name["namespace"]._options = None +_SPARSEVALUES.fields_by_name['indices']._options = None +_SPARSEVALUES.fields_by_name['values']._options = None +_VECTOR.fields_by_name['id']._options = None +_VECTOR.fields_by_name['values']._options = None +_VECTOR.fields_by_name['metadata']._options = None +_SCOREDVECTOR.fields_by_name['id']._options = None +_SCOREDVECTOR.fields_by_name['score']._options = None +_SCOREDVECTOR.fields_by_name['values']._options = None +_SCOREDVECTOR.fields_by_name['metadata']._options = None +_UPSERTREQUEST.fields_by_name['vectors']._options = None +_UPSERTREQUEST.fields_by_name['namespace']._options = None +_UPSERTRESPONSE.fields_by_name['upserted_count']._options = None +_DELETEREQUEST.fields_by_name['ids']._options = None +_DELETEREQUEST.fields_by_name['delete_all']._options = None +_DELETEREQUEST.fields_by_name['namespace']._options = None +_FETCHREQUEST.fields_by_name['ids']._options = None +_FETCHREQUEST.fields_by_name['namespace']._options = None _FETCHRESPONSE_VECTORSENTRY._options = None -_FETCHRESPONSE.fields_by_name["namespace"]._options = None -_QUERYVECTOR.fields_by_name["values"]._options = None -_QUERYVECTOR.fields_by_name["top_k"]._options = None -_QUERYVECTOR.fields_by_name["namespace"]._options = None -_QUERYVECTOR.fields_by_name["filter"]._options = None -_QUERYREQUEST.fields_by_name["namespace"]._options = None -_QUERYREQUEST.fields_by_name["top_k"]._options = None -_QUERYREQUEST.fields_by_name["filter"]._options = None -_QUERYREQUEST.fields_by_name["include_values"]._options = None -_QUERYREQUEST.fields_by_name["include_metadata"]._options = None -_QUERYREQUEST.fields_by_name["queries"]._options = None -_QUERYREQUEST.fields_by_name["vector"]._options = None -_QUERYREQUEST.fields_by_name["id"]._options = None -_SINGLEQUERYRESULTS.fields_by_name["namespace"]._options = None -_QUERYRESPONSE.fields_by_name["results"]._options = None -_UPDATEREQUEST.fields_by_name["id"]._options = None -_UPDATEREQUEST.fields_by_name["values"]._options = None -_UPDATEREQUEST.fields_by_name["set_metadata"]._options = None -_UPDATEREQUEST.fields_by_name["namespace"]._options = None -_NAMESPACESUMMARY.fields_by_name["vector_count"]._options = None +_FETCHRESPONSE.fields_by_name['namespace']._options = None +_QUERYVECTOR.fields_by_name['values']._options = None +_QUERYVECTOR.fields_by_name['top_k']._options = None +_QUERYVECTOR.fields_by_name['namespace']._options = None +_QUERYVECTOR.fields_by_name['filter']._options = None +_QUERYREQUEST.fields_by_name['namespace']._options = None +_QUERYREQUEST.fields_by_name['top_k']._options = None +_QUERYREQUEST.fields_by_name['filter']._options = None +_QUERYREQUEST.fields_by_name['include_values']._options = None +_QUERYREQUEST.fields_by_name['include_metadata']._options = None +_QUERYREQUEST.fields_by_name['queries']._options = None +_QUERYREQUEST.fields_by_name['vector']._options = None +_QUERYREQUEST.fields_by_name['id']._options = None +_SINGLEQUERYRESULTS.fields_by_name['namespace']._options = None +_QUERYRESPONSE.fields_by_name['results']._options = None +_UPDATEREQUEST.fields_by_name['id']._options = None +_UPDATEREQUEST.fields_by_name['values']._options = None +_UPDATEREQUEST.fields_by_name['set_metadata']._options = None +_UPDATEREQUEST.fields_by_name['namespace']._options = None +_NAMESPACESUMMARY.fields_by_name['vector_count']._options = None _DESCRIBEINDEXSTATSRESPONSE_NAMESPACESENTRY._options = None -_DESCRIBEINDEXSTATSRESPONSE.fields_by_name["dimension"]._options = None -_DESCRIBEINDEXSTATSRESPONSE.fields_by_name["index_fullness"]._options = None -_DESCRIBEINDEXSTATSRESPONSE.fields_by_name["total_vector_count"]._options = None +_DESCRIBEINDEXSTATSRESPONSE.fields_by_name['dimension']._options = None +_DESCRIBEINDEXSTATSRESPONSE.fields_by_name['index_fullness']._options = None +_DESCRIBEINDEXSTATSRESPONSE.fields_by_name['total_vector_count']._options = None _DESCRIBEINDEXSTATSRESPONSE._options = None _VECTORSERVICE = _descriptor.ServiceDescriptor( - name="VectorService", - full_name="VectorService", - file=DESCRIPTOR, + name='VectorService', + full_name='VectorService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=3377, + serialized_end=4078, + methods=[ + _descriptor.MethodDescriptor( + name='Upsert', + full_name='VectorService.Upsert', index=0, - serialized_options=None, + containing_service=None, + input_type=_UPSERTREQUEST, + output_type=_UPSERTRESPONSE, + serialized_options=b'\202\323\344\223\002\024\"\017/vectors/upsert:\001*\222A\033\n\021Vector Operations*\006upsert', create_key=_descriptor._internal_create_key, - serialized_start=3377, - serialized_end=4078, - methods=[ - _descriptor.MethodDescriptor( - name="Upsert", - full_name="VectorService.Upsert", - index=0, - containing_service=None, - input_type=_UPSERTREQUEST, - output_type=_UPSERTRESPONSE, - serialized_options=b'\202\323\344\223\002\024"\017/vectors/upsert:\001*\222A\033\n\021Vector Operations*\006upsert', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="Delete", - full_name="VectorService.Delete", - index=1, - containing_service=None, - input_type=_DELETEREQUEST, - output_type=_DELETERESPONSE, - serialized_options=b"\202\323\344\223\002'\"\017/vectors/delete:\001*Z\021*\017/vectors/delete\222A\033\n\021Vector Operations*\006delete", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="Fetch", - full_name="VectorService.Fetch", - index=2, - containing_service=None, - input_type=_FETCHREQUEST, - output_type=_FETCHRESPONSE, - serialized_options=b"\202\323\344\223\002\020\022\016/vectors/fetch\222A\032\n\021Vector Operations*\005fetch", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="Query", - full_name="VectorService.Query", - index=3, - containing_service=None, - input_type=_QUERYREQUEST, - output_type=_QUERYRESPONSE, - serialized_options=b'\202\323\344\223\002\013"\006/query:\001*\222A\032\n\021Vector Operations*\005query', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="Update", - full_name="VectorService.Update", - index=4, - containing_service=None, - input_type=_UPDATEREQUEST, - output_type=_UPDATERESPONSE, - serialized_options=b'\202\323\344\223\002\024"\017/vectors/update:\001*\222A\033\n\021Vector Operations*\006update', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DescribeIndexStats", - full_name="VectorService.DescribeIndexStats", - index=5, - containing_service=None, - input_type=_DESCRIBEINDEXSTATSREQUEST, - output_type=_DESCRIBEINDEXSTATSRESPONSE, - serialized_options=b'\202\323\344\223\0023"\025/describe_index_stats:\001*Z\027\022\025/describe_index_stats\222A)\n\021Vector Operations*\024describe_index_stats', - create_key=_descriptor._internal_create_key, - ), - ], -) + ), + _descriptor.MethodDescriptor( + name='Delete', + full_name='VectorService.Delete', + index=1, + containing_service=None, + input_type=_DELETEREQUEST, + output_type=_DELETERESPONSE, + serialized_options=b'\202\323\344\223\002\'\"\017/vectors/delete:\001*Z\021*\017/vectors/delete\222A\033\n\021Vector Operations*\006delete', + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='Fetch', + full_name='VectorService.Fetch', + index=2, + containing_service=None, + input_type=_FETCHREQUEST, + output_type=_FETCHRESPONSE, + serialized_options=b'\202\323\344\223\002\020\022\016/vectors/fetch\222A\032\n\021Vector Operations*\005fetch', + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='Query', + full_name='VectorService.Query', + index=3, + containing_service=None, + input_type=_QUERYREQUEST, + output_type=_QUERYRESPONSE, + serialized_options=b'\202\323\344\223\002\013\"\006/query:\001*\222A\032\n\021Vector Operations*\005query', + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='Update', + full_name='VectorService.Update', + index=4, + containing_service=None, + input_type=_UPDATEREQUEST, + output_type=_UPDATERESPONSE, + serialized_options=b'\202\323\344\223\002\024\"\017/vectors/update:\001*\222A\033\n\021Vector Operations*\006update', + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='DescribeIndexStats', + full_name='VectorService.DescribeIndexStats', + index=5, + containing_service=None, + input_type=_DESCRIBEINDEXSTATSREQUEST, + output_type=_DESCRIBEINDEXSTATSRESPONSE, + serialized_options=b'\202\323\344\223\0023\"\025/describe_index_stats:\001*Z\027\022\025/describe_index_stats\222A)\n\021Vector Operations*\024describe_index_stats', + create_key=_descriptor._internal_create_key, + ), +]) _sym_db.RegisterServiceDescriptor(_VECTORSERVICE) -DESCRIPTOR.services_by_name["VectorService"] = _VECTORSERVICE +DESCRIPTOR.services_by_name['VectorService'] = _VECTORSERVICE # @@protoc_insertion_point(module_scope) diff --git a/pinecone/core/grpc/protos/vector_service_pb2.pyi b/pinecone/core/grpc/protos/vector_service_pb2.pyi index a8c3c4d0..0c2c73f6 100644 --- a/pinecone/core/grpc/protos/vector_service_pb2.pyi +++ b/pinecone/core/grpc/protos/vector_service_pb2.pyi @@ -30,11 +30,13 @@ from typing_extensions import ( Literal as typing_extensions___Literal, ) + builtin___bool = bool builtin___bytes = bytes builtin___float = float builtin___int = int + DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ... class SparseValues(google___protobuf___message___Message): @@ -42,16 +44,12 @@ class SparseValues(google___protobuf___message___Message): indices: google___protobuf___internal___containers___RepeatedScalarFieldContainer[builtin___int] = ... values: google___protobuf___internal___containers___RepeatedScalarFieldContainer[builtin___float] = ... - def __init__( - self, + def __init__(self, *, - indices: typing___Optional[typing___Iterable[builtin___int]] = None, - values: typing___Optional[typing___Iterable[builtin___float]] = None, - ) -> None: ... - def ClearField( - self, field_name: typing_extensions___Literal["indices", b"indices", "values", b"values"] - ) -> None: ... - + indices : typing___Optional[typing___Iterable[builtin___int]] = None, + values : typing___Optional[typing___Iterable[builtin___float]] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"indices",b"indices",u"values",b"values"]) -> None: ... type___SparseValues = SparseValues class Vector(google___protobuf___message___Message): @@ -61,26 +59,19 @@ class Vector(google___protobuf___message___Message): @property def sparse_values(self) -> type___SparseValues: ... + @property def metadata(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - id: typing___Optional[typing___Text] = None, - values: typing___Optional[typing___Iterable[builtin___float]] = None, - sparse_values: typing___Optional[type___SparseValues] = None, - metadata: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - ) -> None: ... - def HasField( - self, field_name: typing_extensions___Literal["metadata", b"metadata", "sparse_values", b"sparse_values"] - ) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "id", b"id", "metadata", b"metadata", "sparse_values", b"sparse_values", "values", b"values" - ], - ) -> None: ... + def __init__(self, + *, + id : typing___Optional[typing___Text] = None, + values : typing___Optional[typing___Iterable[builtin___float]] = None, + sparse_values : typing___Optional[type___SparseValues] = None, + metadata : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"metadata",b"metadata",u"sparse_values",b"sparse_values"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"id",b"id",u"metadata",b"metadata",u"sparse_values",b"sparse_values",u"values",b"values"]) -> None: ... type___Vector = Vector class ScoredVector(google___protobuf___message___Message): @@ -91,36 +82,20 @@ class ScoredVector(google___protobuf___message___Message): @property def sparse_values(self) -> type___SparseValues: ... + @property def metadata(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - id: typing___Optional[typing___Text] = None, - score: typing___Optional[builtin___float] = None, - values: typing___Optional[typing___Iterable[builtin___float]] = None, - sparse_values: typing___Optional[type___SparseValues] = None, - metadata: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - ) -> None: ... - def HasField( - self, field_name: typing_extensions___Literal["metadata", b"metadata", "sparse_values", b"sparse_values"] - ) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "id", - b"id", - "metadata", - b"metadata", - "score", - b"score", - "sparse_values", - b"sparse_values", - "values", - b"values", - ], - ) -> None: ... + def __init__(self, + *, + id : typing___Optional[typing___Text] = None, + score : typing___Optional[builtin___float] = None, + values : typing___Optional[typing___Iterable[builtin___float]] = None, + sparse_values : typing___Optional[type___SparseValues] = None, + metadata : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"metadata",b"metadata",u"sparse_values",b"sparse_values"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"id",b"id",u"metadata",b"metadata",u"score",b"score",u"sparse_values",b"sparse_values",u"values",b"values"]) -> None: ... type___ScoredVector = ScoredVector class UpsertRequest(google___protobuf___message___Message): @@ -129,29 +104,24 @@ class UpsertRequest(google___protobuf___message___Message): @property def vectors(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___Vector]: ... - def __init__( - self, - *, - vectors: typing___Optional[typing___Iterable[type___Vector]] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def ClearField( - self, field_name: typing_extensions___Literal["namespace", b"namespace", "vectors", b"vectors"] - ) -> None: ... + def __init__(self, + *, + vectors : typing___Optional[typing___Iterable[type___Vector]] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"namespace",b"namespace",u"vectors",b"vectors"]) -> None: ... type___UpsertRequest = UpsertRequest class UpsertResponse(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... upserted_count: builtin___int = ... - def __init__( - self, + def __init__(self, *, - upserted_count: typing___Optional[builtin___int] = None, - ) -> None: ... - def ClearField(self, field_name: typing_extensions___Literal["upserted_count", b"upserted_count"]) -> None: ... - + upserted_count : typing___Optional[builtin___int] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"upserted_count",b"upserted_count"]) -> None: ... type___UpsertResponse = UpsertResponse class DeleteRequest(google___protobuf___message___Message): @@ -162,31 +132,23 @@ class DeleteRequest(google___protobuf___message___Message): @property def filter(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - ids: typing___Optional[typing___Iterable[typing___Text]] = None, - delete_all: typing___Optional[builtin___bool] = None, - namespace: typing___Optional[typing___Text] = None, - filter: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - ) -> None: ... - def HasField(self, field_name: typing_extensions___Literal["filter", b"filter"]) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "delete_all", b"delete_all", "filter", b"filter", "ids", b"ids", "namespace", b"namespace" - ], - ) -> None: ... + def __init__(self, + *, + ids : typing___Optional[typing___Iterable[typing___Text]] = None, + delete_all : typing___Optional[builtin___bool] = None, + namespace : typing___Optional[typing___Text] = None, + filter : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"filter",b"filter"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"delete_all",b"delete_all",u"filter",b"filter",u"ids",b"ids",u"namespace",b"namespace"]) -> None: ... type___DeleteRequest = DeleteRequest class DeleteResponse(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - def __init__( - self, - ) -> None: ... - + def __init__(self, + ) -> None: ... type___DeleteResponse = DeleteResponse class FetchRequest(google___protobuf___message___Message): @@ -194,49 +156,43 @@ class FetchRequest(google___protobuf___message___Message): ids: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] = ... namespace: typing___Text = ... - def __init__( - self, + def __init__(self, *, - ids: typing___Optional[typing___Iterable[typing___Text]] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def ClearField(self, field_name: typing_extensions___Literal["ids", b"ids", "namespace", b"namespace"]) -> None: ... - + ids : typing___Optional[typing___Iterable[typing___Text]] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"ids",b"ids",u"namespace",b"namespace"]) -> None: ... type___FetchRequest = FetchRequest class FetchResponse(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - class VectorsEntry(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... key: typing___Text = ... @property def value(self) -> type___Vector: ... - def __init__( - self, + + def __init__(self, *, - key: typing___Optional[typing___Text] = None, - value: typing___Optional[type___Vector] = None, - ) -> None: ... - def HasField(self, field_name: typing_extensions___Literal["value", b"value"]) -> builtin___bool: ... - def ClearField(self, field_name: typing_extensions___Literal["key", b"key", "value", b"value"]) -> None: ... + key : typing___Optional[typing___Text] = None, + value : typing___Optional[type___Vector] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"value",b"value"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"key",b"key",u"value",b"value"]) -> None: ... type___VectorsEntry = VectorsEntry namespace: typing___Text = ... @property def vectors(self) -> typing___MutableMapping[typing___Text, type___Vector]: ... - def __init__( - self, - *, - vectors: typing___Optional[typing___Mapping[typing___Text, type___Vector]] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def ClearField( - self, field_name: typing_extensions___Literal["namespace", b"namespace", "vectors", b"vectors"] - ) -> None: ... + def __init__(self, + *, + vectors : typing___Optional[typing___Mapping[typing___Text, type___Vector]] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"namespace",b"namespace",u"vectors",b"vectors"]) -> None: ... type___FetchResponse = FetchResponse class QueryVector(google___protobuf___message___Message): @@ -247,36 +203,20 @@ class QueryVector(google___protobuf___message___Message): @property def sparse_values(self) -> type___SparseValues: ... + @property def filter(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - values: typing___Optional[typing___Iterable[builtin___float]] = None, - sparse_values: typing___Optional[type___SparseValues] = None, - top_k: typing___Optional[builtin___int] = None, - namespace: typing___Optional[typing___Text] = None, - filter: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - ) -> None: ... - def HasField( - self, field_name: typing_extensions___Literal["filter", b"filter", "sparse_values", b"sparse_values"] - ) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "filter", - b"filter", - "namespace", - b"namespace", - "sparse_values", - b"sparse_values", - "top_k", - b"top_k", - "values", - b"values", - ], - ) -> None: ... + def __init__(self, + *, + values : typing___Optional[typing___Iterable[builtin___float]] = None, + sparse_values : typing___Optional[type___SparseValues] = None, + top_k : typing___Optional[builtin___int] = None, + namespace : typing___Optional[typing___Text] = None, + filter : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"filter",b"filter",u"sparse_values",b"sparse_values"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"filter",b"filter",u"namespace",b"namespace",u"sparse_values",b"sparse_values",u"top_k",b"top_k",u"values",b"values"]) -> None: ... type___QueryVector = QueryVector class QueryRequest(google___protobuf___message___Message): @@ -290,52 +230,27 @@ class QueryRequest(google___protobuf___message___Message): @property def filter(self) -> google___protobuf___struct_pb2___Struct: ... + @property - def queries( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___QueryVector]: ... + def queries(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___QueryVector]: ... + @property def sparse_vector(self) -> type___SparseValues: ... - def __init__( - self, - *, - namespace: typing___Optional[typing___Text] = None, - top_k: typing___Optional[builtin___int] = None, - filter: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - include_values: typing___Optional[builtin___bool] = None, - include_metadata: typing___Optional[builtin___bool] = None, - queries: typing___Optional[typing___Iterable[type___QueryVector]] = None, - vector: typing___Optional[typing___Iterable[builtin___float]] = None, - sparse_vector: typing___Optional[type___SparseValues] = None, - id: typing___Optional[typing___Text] = None, - ) -> None: ... - def HasField( - self, field_name: typing_extensions___Literal["filter", b"filter", "sparse_vector", b"sparse_vector"] - ) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "filter", - b"filter", - "id", - b"id", - "include_metadata", - b"include_metadata", - "include_values", - b"include_values", - "namespace", - b"namespace", - "queries", - b"queries", - "sparse_vector", - b"sparse_vector", - "top_k", - b"top_k", - "vector", - b"vector", - ], - ) -> None: ... + def __init__(self, + *, + namespace : typing___Optional[typing___Text] = None, + top_k : typing___Optional[builtin___int] = None, + filter : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + include_values : typing___Optional[builtin___bool] = None, + include_metadata : typing___Optional[builtin___bool] = None, + queries : typing___Optional[typing___Iterable[type___QueryVector]] = None, + vector : typing___Optional[typing___Iterable[builtin___float]] = None, + sparse_vector : typing___Optional[type___SparseValues] = None, + id : typing___Optional[typing___Text] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"filter",b"filter",u"sparse_vector",b"sparse_vector"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"filter",b"filter",u"id",b"id",u"include_metadata",b"include_metadata",u"include_values",b"include_values",u"namespace",b"namespace",u"queries",b"queries",u"sparse_vector",b"sparse_vector",u"top_k",b"top_k",u"vector",b"vector"]) -> None: ... type___QueryRequest = QueryRequest class SingleQueryResults(google___protobuf___message___Message): @@ -343,19 +258,14 @@ class SingleQueryResults(google___protobuf___message___Message): namespace: typing___Text = ... @property - def matches( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ScoredVector]: ... - def __init__( - self, - *, - matches: typing___Optional[typing___Iterable[type___ScoredVector]] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def ClearField( - self, field_name: typing_extensions___Literal["matches", b"matches", "namespace", b"namespace"] - ) -> None: ... + def matches(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ScoredVector]: ... + def __init__(self, + *, + matches : typing___Optional[typing___Iterable[type___ScoredVector]] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"matches",b"matches",u"namespace",b"namespace"]) -> None: ... type___SingleQueryResults = SingleQueryResults class QueryResponse(google___protobuf___message___Message): @@ -363,27 +273,18 @@ class QueryResponse(google___protobuf___message___Message): namespace: typing___Text = ... @property - def results( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___SingleQueryResults]: ... + def results(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___SingleQueryResults]: ... + @property - def matches( - self, - ) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ScoredVector]: ... - def __init__( - self, - *, - results: typing___Optional[typing___Iterable[type___SingleQueryResults]] = None, - matches: typing___Optional[typing___Iterable[type___ScoredVector]] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "matches", b"matches", "namespace", b"namespace", "results", b"results" - ], - ) -> None: ... + def matches(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___ScoredVector]: ... + def __init__(self, + *, + results : typing___Optional[typing___Iterable[type___SingleQueryResults]] = None, + matches : typing___Optional[typing___Iterable[type___ScoredVector]] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"matches",b"matches",u"namespace",b"namespace",u"results",b"results"]) -> None: ... type___QueryResponse = QueryResponse class UpdateRequest(google___protobuf___message___Message): @@ -394,46 +295,27 @@ class UpdateRequest(google___protobuf___message___Message): @property def sparse_values(self) -> type___SparseValues: ... + @property def set_metadata(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - id: typing___Optional[typing___Text] = None, - values: typing___Optional[typing___Iterable[builtin___float]] = None, - sparse_values: typing___Optional[type___SparseValues] = None, - set_metadata: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - namespace: typing___Optional[typing___Text] = None, - ) -> None: ... - def HasField( - self, - field_name: typing_extensions___Literal["set_metadata", b"set_metadata", "sparse_values", b"sparse_values"], - ) -> builtin___bool: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "id", - b"id", - "namespace", - b"namespace", - "set_metadata", - b"set_metadata", - "sparse_values", - b"sparse_values", - "values", - b"values", - ], - ) -> None: ... + def __init__(self, + *, + id : typing___Optional[typing___Text] = None, + values : typing___Optional[typing___Iterable[builtin___float]] = None, + sparse_values : typing___Optional[type___SparseValues] = None, + set_metadata : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + namespace : typing___Optional[typing___Text] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"set_metadata",b"set_metadata",u"sparse_values",b"sparse_values"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"id",b"id",u"namespace",b"namespace",u"set_metadata",b"set_metadata",u"sparse_values",b"sparse_values",u"values",b"values"]) -> None: ... type___UpdateRequest = UpdateRequest class UpdateResponse(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - def __init__( - self, - ) -> None: ... - + def __init__(self, + ) -> None: ... type___UpdateResponse = UpdateResponse class DescribeIndexStatsRequest(google___protobuf___message___Message): @@ -441,46 +323,42 @@ class DescribeIndexStatsRequest(google___protobuf___message___Message): @property def filter(self) -> google___protobuf___struct_pb2___Struct: ... - def __init__( - self, - *, - filter: typing___Optional[google___protobuf___struct_pb2___Struct] = None, - ) -> None: ... - def HasField(self, field_name: typing_extensions___Literal["filter", b"filter"]) -> builtin___bool: ... - def ClearField(self, field_name: typing_extensions___Literal["filter", b"filter"]) -> None: ... + def __init__(self, + *, + filter : typing___Optional[google___protobuf___struct_pb2___Struct] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"filter",b"filter"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"filter",b"filter"]) -> None: ... type___DescribeIndexStatsRequest = DescribeIndexStatsRequest class NamespaceSummary(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... vector_count: builtin___int = ... - def __init__( - self, + def __init__(self, *, - vector_count: typing___Optional[builtin___int] = None, - ) -> None: ... - def ClearField(self, field_name: typing_extensions___Literal["vector_count", b"vector_count"]) -> None: ... - + vector_count : typing___Optional[builtin___int] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"vector_count",b"vector_count"]) -> None: ... type___NamespaceSummary = NamespaceSummary class DescribeIndexStatsResponse(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... - class NamespacesEntry(google___protobuf___message___Message): DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... key: typing___Text = ... @property def value(self) -> type___NamespaceSummary: ... - def __init__( - self, + + def __init__(self, *, - key: typing___Optional[typing___Text] = None, - value: typing___Optional[type___NamespaceSummary] = None, - ) -> None: ... - def HasField(self, field_name: typing_extensions___Literal["value", b"value"]) -> builtin___bool: ... - def ClearField(self, field_name: typing_extensions___Literal["key", b"key", "value", b"value"]) -> None: ... + key : typing___Optional[typing___Text] = None, + value : typing___Optional[type___NamespaceSummary] = None, + ) -> None: ... + def HasField(self, field_name: typing_extensions___Literal[u"value",b"value"]) -> builtin___bool: ... + def ClearField(self, field_name: typing_extensions___Literal[u"key",b"key",u"value",b"value"]) -> None: ... type___NamespacesEntry = NamespacesEntry dimension: builtin___int = ... @@ -489,26 +367,13 @@ class DescribeIndexStatsResponse(google___protobuf___message___Message): @property def namespaces(self) -> typing___MutableMapping[typing___Text, type___NamespaceSummary]: ... - def __init__( - self, - *, - namespaces: typing___Optional[typing___Mapping[typing___Text, type___NamespaceSummary]] = None, - dimension: typing___Optional[builtin___int] = None, - index_fullness: typing___Optional[builtin___float] = None, - total_vector_count: typing___Optional[builtin___int] = None, - ) -> None: ... - def ClearField( - self, - field_name: typing_extensions___Literal[ - "dimension", - b"dimension", - "index_fullness", - b"index_fullness", - "namespaces", - b"namespaces", - "total_vector_count", - b"total_vector_count", - ], - ) -> None: ... + def __init__(self, + *, + namespaces : typing___Optional[typing___Mapping[typing___Text, type___NamespaceSummary]] = None, + dimension : typing___Optional[builtin___int] = None, + index_fullness : typing___Optional[builtin___float] = None, + total_vector_count : typing___Optional[builtin___int] = None, + ) -> None: ... + def ClearField(self, field_name: typing_extensions___Literal[u"dimension",b"dimension",u"index_fullness",b"index_fullness",u"namespaces",b"namespaces",u"total_vector_count",b"total_vector_count"]) -> None: ... type___DescribeIndexStatsResponse = DescribeIndexStatsResponse diff --git a/pinecone/core/grpc/protos/vector_service_pb2_grpc.py b/pinecone/core/grpc/protos/vector_service_pb2_grpc.py index 2d7a899d..9688e5ae 100644 --- a/pinecone/core/grpc/protos/vector_service_pb2_grpc.py +++ b/pinecone/core/grpc/protos/vector_service_pb2_grpc.py @@ -4,7 +4,6 @@ import pinecone.core.grpc.protos.vector_service_pb2 as vector__service__pb2 - class VectorServiceStub(object): """The `VectorService` interface is exposed by Pinecone's vector index services. This service could also be called a `gRPC` service or a `REST`-like api. @@ -17,35 +16,35 @@ def __init__(self, channel): channel: A grpc.Channel. """ self.Upsert = channel.unary_unary( - "/VectorService/Upsert", - request_serializer=vector__service__pb2.UpsertRequest.SerializeToString, - response_deserializer=vector__service__pb2.UpsertResponse.FromString, - ) + '/VectorService/Upsert', + request_serializer=vector__service__pb2.UpsertRequest.SerializeToString, + response_deserializer=vector__service__pb2.UpsertResponse.FromString, + ) self.Delete = channel.unary_unary( - "/VectorService/Delete", - request_serializer=vector__service__pb2.DeleteRequest.SerializeToString, - response_deserializer=vector__service__pb2.DeleteResponse.FromString, - ) + '/VectorService/Delete', + request_serializer=vector__service__pb2.DeleteRequest.SerializeToString, + response_deserializer=vector__service__pb2.DeleteResponse.FromString, + ) self.Fetch = channel.unary_unary( - "/VectorService/Fetch", - request_serializer=vector__service__pb2.FetchRequest.SerializeToString, - response_deserializer=vector__service__pb2.FetchResponse.FromString, - ) + '/VectorService/Fetch', + request_serializer=vector__service__pb2.FetchRequest.SerializeToString, + response_deserializer=vector__service__pb2.FetchResponse.FromString, + ) self.Query = channel.unary_unary( - "/VectorService/Query", - request_serializer=vector__service__pb2.QueryRequest.SerializeToString, - response_deserializer=vector__service__pb2.QueryResponse.FromString, - ) + '/VectorService/Query', + request_serializer=vector__service__pb2.QueryRequest.SerializeToString, + response_deserializer=vector__service__pb2.QueryResponse.FromString, + ) self.Update = channel.unary_unary( - "/VectorService/Update", - request_serializer=vector__service__pb2.UpdateRequest.SerializeToString, - response_deserializer=vector__service__pb2.UpdateResponse.FromString, - ) + '/VectorService/Update', + request_serializer=vector__service__pb2.UpdateRequest.SerializeToString, + response_deserializer=vector__service__pb2.UpdateResponse.FromString, + ) self.DescribeIndexStats = channel.unary_unary( - "/VectorService/DescribeIndexStats", - request_serializer=vector__service__pb2.DescribeIndexStatsRequest.SerializeToString, - response_deserializer=vector__service__pb2.DescribeIndexStatsResponse.FromString, - ) + '/VectorService/DescribeIndexStats', + request_serializer=vector__service__pb2.DescribeIndexStatsRequest.SerializeToString, + response_deserializer=vector__service__pb2.DescribeIndexStatsResponse.FromString, + ) class VectorServiceServicer(object): @@ -60,8 +59,8 @@ def Upsert(self, request, context): If a new value is upserted for an existing vector id, it will overwrite the previous value. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def Delete(self, request, context): """Delete @@ -70,8 +69,8 @@ def Delete(self, request, context): You can delete items by their id, from a single namespace. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def Fetch(self, request, context): """Fetch @@ -80,8 +79,8 @@ def Fetch(self, request, context): The returned vectors include the vector data and/or metadata. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def Query(self, request, context): """Query @@ -90,8 +89,8 @@ def Query(self, request, context): It retrieves the ids of the most similar items in a namespace, along with their similarity scores. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def Update(self, request, context): """Update @@ -101,8 +100,8 @@ def Update(self, request, context): If a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value. """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def DescribeIndexStats(self, request, context): """DescribeIndexStats @@ -115,223 +114,152 @@ def DescribeIndexStats(self, request, context): [`describe_index`](https://www.pinecone.io/docs/api/operation/describe_index/). """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') def add_VectorServiceServicer_to_server(servicer, server): rpc_method_handlers = { - "Upsert": grpc.unary_unary_rpc_method_handler( - servicer.Upsert, - request_deserializer=vector__service__pb2.UpsertRequest.FromString, - response_serializer=vector__service__pb2.UpsertResponse.SerializeToString, - ), - "Delete": grpc.unary_unary_rpc_method_handler( - servicer.Delete, - request_deserializer=vector__service__pb2.DeleteRequest.FromString, - response_serializer=vector__service__pb2.DeleteResponse.SerializeToString, - ), - "Fetch": grpc.unary_unary_rpc_method_handler( - servicer.Fetch, - request_deserializer=vector__service__pb2.FetchRequest.FromString, - response_serializer=vector__service__pb2.FetchResponse.SerializeToString, - ), - "Query": grpc.unary_unary_rpc_method_handler( - servicer.Query, - request_deserializer=vector__service__pb2.QueryRequest.FromString, - response_serializer=vector__service__pb2.QueryResponse.SerializeToString, - ), - "Update": grpc.unary_unary_rpc_method_handler( - servicer.Update, - request_deserializer=vector__service__pb2.UpdateRequest.FromString, - response_serializer=vector__service__pb2.UpdateResponse.SerializeToString, - ), - "DescribeIndexStats": grpc.unary_unary_rpc_method_handler( - servicer.DescribeIndexStats, - request_deserializer=vector__service__pb2.DescribeIndexStatsRequest.FromString, - response_serializer=vector__service__pb2.DescribeIndexStatsResponse.SerializeToString, - ), + 'Upsert': grpc.unary_unary_rpc_method_handler( + servicer.Upsert, + request_deserializer=vector__service__pb2.UpsertRequest.FromString, + response_serializer=vector__service__pb2.UpsertResponse.SerializeToString, + ), + 'Delete': grpc.unary_unary_rpc_method_handler( + servicer.Delete, + request_deserializer=vector__service__pb2.DeleteRequest.FromString, + response_serializer=vector__service__pb2.DeleteResponse.SerializeToString, + ), + 'Fetch': grpc.unary_unary_rpc_method_handler( + servicer.Fetch, + request_deserializer=vector__service__pb2.FetchRequest.FromString, + response_serializer=vector__service__pb2.FetchResponse.SerializeToString, + ), + 'Query': grpc.unary_unary_rpc_method_handler( + servicer.Query, + request_deserializer=vector__service__pb2.QueryRequest.FromString, + response_serializer=vector__service__pb2.QueryResponse.SerializeToString, + ), + 'Update': grpc.unary_unary_rpc_method_handler( + servicer.Update, + request_deserializer=vector__service__pb2.UpdateRequest.FromString, + response_serializer=vector__service__pb2.UpdateResponse.SerializeToString, + ), + 'DescribeIndexStats': grpc.unary_unary_rpc_method_handler( + servicer.DescribeIndexStats, + request_deserializer=vector__service__pb2.DescribeIndexStatsRequest.FromString, + response_serializer=vector__service__pb2.DescribeIndexStatsResponse.SerializeToString, + ), } - generic_handler = grpc.method_handlers_generic_handler("VectorService", rpc_method_handlers) + generic_handler = grpc.method_handlers_generic_handler( + 'VectorService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) -# This class is part of an EXPERIMENTAL API. + # This class is part of an EXPERIMENTAL API. class VectorService(object): """The `VectorService` interface is exposed by Pinecone's vector index services. This service could also be called a `gRPC` service or a `REST`-like api. """ @staticmethod - def Upsert( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Upsert(request, target, - "/VectorService/Upsert", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/Upsert', vector__service__pb2.UpsertRequest.SerializeToString, vector__service__pb2.UpsertResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def Delete( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Delete(request, target, - "/VectorService/Delete", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/Delete', vector__service__pb2.DeleteRequest.SerializeToString, vector__service__pb2.DeleteResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def Fetch( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Fetch(request, target, - "/VectorService/Fetch", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/Fetch', vector__service__pb2.FetchRequest.SerializeToString, vector__service__pb2.FetchResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def Query( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Query(request, target, - "/VectorService/Query", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/Query', vector__service__pb2.QueryRequest.SerializeToString, vector__service__pb2.QueryResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def Update( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def Update(request, target, - "/VectorService/Update", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/Update', vector__service__pb2.UpdateRequest.SerializeToString, vector__service__pb2.UpdateResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) @staticmethod - def DescribeIndexStats( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, + def DescribeIndexStats(request, target, - "/VectorService/DescribeIndexStats", + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/VectorService/DescribeIndexStats', vector__service__pb2.DescribeIndexStatsRequest.SerializeToString, vector__service__pb2.DescribeIndexStatsResponse.FromString, - options, - channel_credentials, - insecure, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/pinecone/data/index.py b/pinecone/data/index.py index c2250352..e295af7f 100644 --- a/pinecone/data/index.py +++ b/pinecone/data/index.py @@ -10,7 +10,7 @@ from pinecone.config import Config -from pinecone.core.client.models.sparse_values import SparseValues +from pinecone.core.client.models import SparseValues from pinecone.core.client import ApiClient from pinecone.core.client.models import ( FetchResponse, @@ -69,10 +69,10 @@ def parse_query_response(response: QueryResponse, unary_query: bool): if unary_query: - response.results = None + response._data_store.pop("results", None) else: - response.matches = None - response.namespace = None + response._data_store.pop("matches", None) + response._data_store.pop("namespace", None) return response diff --git a/poetry.lock b/poetry.lock index 1060d39a..ff1d212f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,17 +1,5 @@ # This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. -[[package]] -name = "aenum" -version = "3.1.11" -description = "Advanced Enumerations (compatible with Python's stdlib Enum), NamedTuples, and NamedConstants" -optional = false -python-versions = "*" -files = [ - {file = "aenum-3.1.11-py2-none-any.whl", hash = "sha256:525b4870a27d0b471c265bda692bc657f1e0dd7597ad4186d072c59f9db666f6"}, - {file = "aenum-3.1.11-py3-none-any.whl", hash = "sha256:12ae89967f2e25c0ce28c293955d643f891603488bc3d9946158ba2b35203638"}, - {file = "aenum-3.1.11.tar.gz", hash = "sha256:aed2c273547ae72a0d5ee869719c02a643da16bf507c80958faadc7e038e3f73"}, -] - [[package]] name = "astunparse" version = "1.6.3" @@ -707,58 +695,6 @@ files = [ {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] -[[package]] -name = "pydantic" -version = "1.10.12" -description = "Data validation and settings management using python type hints" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pydantic-1.10.12-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a1fcb59f2f355ec350073af41d927bf83a63b50e640f4dbaa01053a28b7a7718"}, - {file = "pydantic-1.10.12-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b7ccf02d7eb340b216ec33e53a3a629856afe1c6e0ef91d84a4e6f2fb2ca70fe"}, - {file = "pydantic-1.10.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8fb2aa3ab3728d950bcc885a2e9eff6c8fc40bc0b7bb434e555c215491bcf48b"}, - {file = "pydantic-1.10.12-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:771735dc43cf8383959dc9b90aa281f0b6092321ca98677c5fb6125a6f56d58d"}, - {file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ca48477862372ac3770969b9d75f1bf66131d386dba79506c46d75e6b48c1e09"}, - {file = "pydantic-1.10.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a5e7add47a5b5a40c49b3036d464e3c7802f8ae0d1e66035ea16aa5b7a3923ed"}, - {file = "pydantic-1.10.12-cp310-cp310-win_amd64.whl", hash = "sha256:e4129b528c6baa99a429f97ce733fff478ec955513630e61b49804b6cf9b224a"}, - {file = "pydantic-1.10.12-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b0d191db0f92dfcb1dec210ca244fdae5cbe918c6050b342d619c09d31eea0cc"}, - {file = "pydantic-1.10.12-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:795e34e6cc065f8f498c89b894a3c6da294a936ee71e644e4bd44de048af1405"}, - {file = "pydantic-1.10.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:69328e15cfda2c392da4e713443c7dbffa1505bc9d566e71e55abe14c97ddc62"}, - {file = "pydantic-1.10.12-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2031de0967c279df0d8a1c72b4ffc411ecd06bac607a212892757db7462fc494"}, - {file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:ba5b2e6fe6ca2b7e013398bc7d7b170e21cce322d266ffcd57cca313e54fb246"}, - {file = "pydantic-1.10.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:2a7bac939fa326db1ab741c9d7f44c565a1d1e80908b3797f7f81a4f86bc8d33"}, - {file = "pydantic-1.10.12-cp311-cp311-win_amd64.whl", hash = "sha256:87afda5539d5140cb8ba9e8b8c8865cb5b1463924d38490d73d3ccfd80896b3f"}, - {file = "pydantic-1.10.12-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:549a8e3d81df0a85226963611950b12d2d334f214436a19537b2efed61b7639a"}, - {file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:598da88dfa127b666852bef6d0d796573a8cf5009ffd62104094a4fe39599565"}, - {file = "pydantic-1.10.12-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ba5c4a8552bff16c61882db58544116d021d0b31ee7c66958d14cf386a5b5350"}, - {file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c79e6a11a07da7374f46970410b41d5e266f7f38f6a17a9c4823db80dadf4303"}, - {file = "pydantic-1.10.12-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ab26038b8375581dc832a63c948f261ae0aa21f1d34c1293469f135fa92972a5"}, - {file = "pydantic-1.10.12-cp37-cp37m-win_amd64.whl", hash = "sha256:e0a16d274b588767602b7646fa05af2782576a6cf1022f4ba74cbb4db66f6ca8"}, - {file = "pydantic-1.10.12-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6a9dfa722316f4acf4460afdf5d41d5246a80e249c7ff475c43a3a1e9d75cf62"}, - {file = "pydantic-1.10.12-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a73f489aebd0c2121ed974054cb2759af8a9f747de120acd2c3394cf84176ccb"}, - {file = "pydantic-1.10.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b30bcb8cbfccfcf02acb8f1a261143fab622831d9c0989707e0e659f77a18e0"}, - {file = "pydantic-1.10.12-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2fcfb5296d7877af406ba1547dfde9943b1256d8928732267e2653c26938cd9c"}, - {file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:2f9a6fab5f82ada41d56b0602606a5506aab165ca54e52bc4545028382ef1c5d"}, - {file = "pydantic-1.10.12-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dea7adcc33d5d105896401a1f37d56b47d443a2b2605ff8a969a0ed5543f7e33"}, - {file = "pydantic-1.10.12-cp38-cp38-win_amd64.whl", hash = "sha256:1eb2085c13bce1612da8537b2d90f549c8cbb05c67e8f22854e201bde5d98a47"}, - {file = "pydantic-1.10.12-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ef6c96b2baa2100ec91a4b428f80d8f28a3c9e53568219b6c298c1125572ebc6"}, - {file = "pydantic-1.10.12-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6c076be61cd0177a8433c0adcb03475baf4ee91edf5a4e550161ad57fc90f523"}, - {file = "pydantic-1.10.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d5a58feb9a39f481eda4d5ca220aa8b9d4f21a41274760b9bc66bfd72595b86"}, - {file = "pydantic-1.10.12-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e5f805d2d5d0a41633651a73fa4ecdd0b3d7a49de4ec3fadf062fe16501ddbf1"}, - {file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:1289c180abd4bd4555bb927c42ee42abc3aee02b0fb2d1223fb7c6e5bef87dbe"}, - {file = "pydantic-1.10.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5d1197e462e0364906cbc19681605cb7c036f2475c899b6f296104ad42b9f5fb"}, - {file = "pydantic-1.10.12-cp39-cp39-win_amd64.whl", hash = "sha256:fdbdd1d630195689f325c9ef1a12900524dceb503b00a987663ff4f58669b93d"}, - {file = "pydantic-1.10.12-py3-none-any.whl", hash = "sha256:b749a43aa51e32839c9d71dc67eb1e4221bb04af1033a32e3923d46f9effa942"}, - {file = "pydantic-1.10.12.tar.gz", hash = "sha256:0fe8a415cea8f340e7a9af9c54fc71a649b43e8ca3cc732986116b3cb135d303"}, -] - -[package.dependencies] -typing-extensions = ">=4.2.0" - -[package.extras] -dotenv = ["python-dotenv (>=0.10.4)"] -email = ["email-validator (>=1.0.3)"] - [[package]] name = "pygments" version = "2.16.1" @@ -1114,4 +1050,4 @@ grpc = ["googleapis-common-protos", "grpc-gateway-protoc-gen-openapiv2", "grpcio [metadata] lock-version = "2.0" python-versions = ">=3.8,<4.0" -content-hash = "59c7274e14abcf26e77715ecca2f5339ef46f61d1a267e3701e0031e607f5792" +content-hash = "a533d1e09ab2ff0c50d91cf5d2ec52c1c112e6e11a79738f47c2a1847035782f" diff --git a/pyproject.toml b/pyproject.toml index 61c905ef..4c545766 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,8 +69,6 @@ grpc-gateway-protoc-gen-openapiv2 = "0.1.0" googleapis-common-protos = ">=1.53.0" lz4 = ">=3.1.3" protobuf = "~=3.20.0" -aenum = "3.1.11" -pydantic = "1.10.12" [tool.poetry.group.dev.dependencies] pdoc = "^14.1.0" diff --git a/tests/unit/test_control.py b/tests/unit/test_control.py index b15c5acd..1d54e736 100644 --- a/tests/unit/test_control.py +++ b/tests/unit/test_control.py @@ -1,6 +1,5 @@ import pytest from pinecone import Pinecone -from pinecone.core.client.api import IndexOperationsApi import time class TestControl: @@ -24,43 +23,24 @@ def test_passing_host(self): (-1, [{"status": {"ready": False}}], 0, 0), ]) def test_create_index_with_timeout(self, mocker, timeout_value, describe_index_responses, expected_describe_index_calls, expected_sleep_calls): - mocker.patch.object(IndexOperationsApi, 'describe_index', side_effect=describe_index_responses) - mocker.patch.object(IndexOperationsApi, 'create_index') + p = Pinecone(api_key="123-456-789") + mocker.patch.object(p.index_api, 'describe_index', side_effect=describe_index_responses) + mocker.patch.object(p.index_api, 'create_index') mocker.patch('time.sleep') - p = Pinecone(api_key="123-456-789") p.create_index("my-index", 10, timeout=timeout_value, cloud="aws", region="us-west1", capacity_mode="pod") - assert IndexOperationsApi.create_index.call_count == 1 - assert IndexOperationsApi.describe_index.call_count == expected_describe_index_calls + assert p.index_api.create_index.call_count == 1 + assert p.index_api.describe_index.call_count == expected_describe_index_calls assert time.sleep.call_count == expected_sleep_calls def test_create_index_when_timeout_exceeded(self, mocker): with pytest.raises(TimeoutError): - get_status_responses = [{"status": {"ready": False}}] * 5 - mocker.patch.object(IndexOperationsApi, 'describe_index', side_effect=get_status_responses) - mocker.patch.object(IndexOperationsApi, 'create_index') - mocker.patch('time.sleep') - p = Pinecone(api_key="123-456-789") - p.create_index("my-index", 10, timeout=10, cloud="aws", region="us-west1", capacity_mode="pod") - - # @pytest.mark.parametrize("timeout_value, list_indexes_calls, time_sleep_calls, list_indexes_responses", [ - # # No timeout, list_indexes called twice, sleep called once - # (None, 2, 1, [["my-index", "index-1"], ["index-1"]]), - # # Timeout of 10 seconds, list_indexes called 3 times, sleep twice - # (10, 3, 2, [["my-index", "index-1"], ["my-index", "index-1"], ["index-1"]]), - # # Timeout of -1 seconds, list_indexes not called, no sleep - # (-1, 0, 0, [["my-index", "index-1"]]), - # ]) - # def test_delete_index_with_timeout(self, mocker, timeout_value, list_indexes_calls, time_sleep_calls, list_indexes_responses): - # api_instance_mock = mocker.Mock() - # api_instance_mock.list_indexes = mocker.Mock(side_effect=list_indexes_responses) - # mocker.patch('pinecone.manage._get_api_instance', return_value=api_instance_mock) - # mocker.patch('time.sleep') + mocker.patch.object(p.index_api, 'create_index') - # pinecone.manage.delete_index("my-index", timeout=timeout_value) + describe_index_response = [{"status": {"ready": False}}] * 5 + mocker.patch.object(p.index_api, 'describe_index', side_effect=describe_index_response) + mocker.patch('time.sleep') - # pinecone.manage._get_api_instance.assert_called_once() - # assert api_instance_mock.list_indexes.call_count == list_indexes_calls - # assert time.sleep.call_count == time_sleep_calls \ No newline at end of file + p.create_index("my-index", 10, timeout=10, cloud="aws", region="us-west1", capacity_mode="pod") diff --git a/tests/unit/test_index.py b/tests/unit/test_index.py index de90bad2..d37bb1d9 100644 --- a/tests/unit/test_index.py +++ b/tests/unit/test_index.py @@ -3,7 +3,6 @@ import pytest import pinecone -from pinecone.config import PineconeConfig from pinecone import Index from pinecone import UpsertRequest, Vector from pinecone import DescribeIndexStatsRequest, ScoredVector, QueryResponse, UpsertResponse, SparseValues @@ -356,7 +355,6 @@ def test_query_byVectorNoFilter_queryVectorNoFilter(self, mocker): response = QueryResponse( results=[], matches=[ScoredVector(id="1", score=0.9, values=[0.0], metadata={"a": 2})], namespace="test" ) - mocker.patch.object(self.index._vector_api, "query", autospec=True, return_value=response) actual = self.index.query(top_k=10, vector=self.vals1)