diff --git a/pinecone/core/openapi/repository_data/__init__.py b/pinecone/core/openapi/repository_data/__init__.py index b661aaf5..58041610 100644 --- a/pinecone/core/openapi/repository_data/__init__.py +++ b/pinecone/core/openapi/repository_data/__init__.py @@ -1,16 +1,17 @@ # flake8: noqa """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + __version__ = "1.0.0" # import ApiClient @@ -26,5 +27,4 @@ from pinecone.openapi_support.exceptions import PineconeApiValueError from pinecone.openapi_support.exceptions import PineconeApiKeyError from pinecone.openapi_support.exceptions import PineconeApiException - -API_VERSION = "unstable" +API_VERSION = 'unstable' diff --git a/pinecone/core/openapi/repository_data/api/document_operations_api.py b/pinecone/core/openapi/repository_data/api/document_operations_api.py index 3b7e585f..86c9545d 100644 --- a/pinecone/core/openapi/repository_data/api/document_operations_api.py +++ b/pinecone/core/openapi/repository_data/api/document_operations_api.py @@ -1,19 +1,17 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support import ApiClient, AsyncioApiClient -from pinecone.openapi_support.endpoint_utils import ( - ExtraOpenApiKwargsTypedDict, - KwargsWithOpenApiKwargDefaultsTypedDict, -) +from pinecone.openapi_support.endpoint_utils import ExtraOpenApiKwargsTypedDict, KwargsWithOpenApiKwargDefaultsTypedDict from pinecone.openapi_support.endpoint import Endpoint as _Endpoint, ExtraOpenApiKwargsTypedDict from pinecone.openapi_support.asyncio_endpoint import AsyncioEndpoint as _AsyncioEndpoint from pinecone.openapi_support.model_utils import ( # noqa: F401 @@ -21,18 +19,15 @@ datetime, file_type, none_type, - validate_and_convert_types, -) -from pinecone.core.openapi.repository_data.model.delete_document_response import ( - DeleteDocumentResponse, + validate_and_convert_types ) +from pinecone.core.openapi.repository_data.model.delete_document_response import DeleteDocumentResponse from pinecone.core.openapi.repository_data.model.get_document_response import GetDocumentResponse -from pinecone.core.openapi.repository_data.model.list_documents_response import ( - ListDocumentsResponse, -) -from pinecone.core.openapi.repository_data.model.upsert_document_response import ( - UpsertDocumentResponse, -) +from pinecone.core.openapi.repository_data.model.list_documents_response import ListDocumentsResponse +from pinecone.core.openapi.repository_data.model.search_documents import SearchDocuments +from pinecone.core.openapi.repository_data.model.search_documents_response import SearchDocumentsResponse +from pinecone.core.openapi.repository_data.model.upsert_document_request import UpsertDocumentRequest +from pinecone.core.openapi.repository_data.model.upsert_document_response import UpsertDocumentResponse class DocumentOperationsApi: @@ -46,19 +41,26 @@ def __init__(self, api_client=None) -> None: api_client = ApiClient() self.api_client = api_client - def __delete_document(self, namespace, document_id, **kwargs: ExtraOpenApiKwargsTypedDict): + def __delete_document( + self, + namespace, + document_id, + x_pinecone_api_version="unstable", + **kwargs: ExtraOpenApiKwargsTypedDict + ): """Delete a document from the given namespace # noqa: E501 Deletes a document from the specified 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_document(namespace, document_id, async_req=True) + >>> thread = api.delete_document(namespace, document_id, x_pinecone_api_version="unstable", async_req=True) >>> result = thread.get() Args: - namespace (str): Namespace to fetch document from. - document_id (str): Document ID to fetch. + namespace (str): Namespace to delete the document from. + document_id (str): Document ID to delete. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -84,52 +86,99 @@ def __delete_document(self, namespace, document_id, **kwargs: ExtraOpenApiKwargs thread. """ kwargs = self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["document_id"] = document_id + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['document_id'] = \ + document_id return self.call_with_http_info(**kwargs) self.delete_document = _Endpoint( settings={ - "response_type": (DeleteDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/{document_id}", - "operation_id": "delete_document", - "http_method": "DELETE", - "servers": None, + 'response_type': (DeleteDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/{document_id}', + 'operation_id': 'delete_document', + 'http_method': 'DELETE', + 'servers': None, }, params_map={ - "all": ["namespace", "document_id"], - "required": ["namespace", "document_id"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,), "document_id": (str,)}, - "attribute_map": {"namespace": "namespace", "document_id": "document_id"}, - "location_map": {"namespace": "path", "document_id": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'document_id': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + 'document_id': 'document_id', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'document_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, api_client=api_client, - callable=__delete_document, + callable=__delete_document ) - def __get_document(self, namespace, document_id, **kwargs: ExtraOpenApiKwargsTypedDict): + def __get_document( + self, + namespace, + document_id, + x_pinecone_api_version="unstable", + **kwargs: ExtraOpenApiKwargsTypedDict + ): """Get a document from the given namespace # noqa: E501 Retrieves a document from the specified 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.get_document(namespace, document_id, async_req=True) + >>> thread = api.get_document(namespace, document_id, x_pinecone_api_version="unstable", async_req=True) >>> result = thread.get() Args: namespace (str): Namespace to fetch document from. document_id (str): Document ID to fetch. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -155,51 +204,97 @@ def __get_document(self, namespace, document_id, **kwargs: ExtraOpenApiKwargsTyp thread. """ kwargs = self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["document_id"] = document_id + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['document_id'] = \ + document_id return self.call_with_http_info(**kwargs) self.get_document = _Endpoint( settings={ - "response_type": (GetDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/{document_id}", - "operation_id": "get_document", - "http_method": "GET", - "servers": None, + 'response_type': (GetDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/{document_id}', + 'operation_id': 'get_document', + 'http_method': 'GET', + 'servers': None, }, params_map={ - "all": ["namespace", "document_id"], - "required": ["namespace", "document_id"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,), "document_id": (str,)}, - "attribute_map": {"namespace": "namespace", "document_id": "document_id"}, - "location_map": {"namespace": "path", "document_id": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'document_id': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + 'document_id': 'document_id', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'document_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, api_client=api_client, - callable=__get_document, + callable=__get_document ) - def __list_documents(self, namespace, **kwargs: ExtraOpenApiKwargsTypedDict): + def __list_documents( + self, + namespace, + x_pinecone_api_version="unstable", + **kwargs: ExtraOpenApiKwargsTypedDict + ): """List documents from the given namespace # noqa: E501 Lists documents from the specified namespace. (Paginated) # 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_documents(namespace, async_req=True) + >>> thread = api.list_documents(namespace, x_pinecone_api_version="unstable", async_req=True) >>> result = thread.get() Args: namespace (str): Namespace to fetch documents from. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -225,51 +320,210 @@ def __list_documents(self, namespace, **kwargs: ExtraOpenApiKwargsTypedDict): thread. """ kwargs = self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace return self.call_with_http_info(**kwargs) self.list_documents = _Endpoint( settings={ - "response_type": (ListDocumentsResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents", - "operation_id": "list_documents", - "http_method": "GET", - "servers": None, + 'response_type': (ListDocumentsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents', + 'operation_id': 'list_documents', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'x_pinecone_api_version', + 'namespace', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list_documents + ) + + def __search_documents( + self, + namespace, + search_documents, + x_pinecone_api_version="unstable", + **kwargs: ExtraOpenApiKwargsTypedDict + ): + """Search the documents in the given namespace. # noqa: E501 + + Search the documents in the specified 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.search_documents(namespace, search_documents, x_pinecone_api_version="unstable", async_req=True) + >>> result = thread.get() + + Args: + namespace (str): Namespace with the documents to search. + search_documents (SearchDocuments): The configuration for performing a search. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] + + 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. + async_req (bool): execute request asynchronously + + Returns: + SearchDocumentsResponse + If the method is called asynchronously, returns the request + thread. + """ + kwargs = self._process_openapi_kwargs(kwargs) + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['search_documents'] = \ + search_documents + return self.call_with_http_info(**kwargs) + + self.search_documents = _Endpoint( + settings={ + 'response_type': (SearchDocumentsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/search', + 'operation_id': 'search_documents', + 'http_method': 'POST', + 'servers': None, }, params_map={ - "all": ["namespace"], - "required": ["namespace"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'search_documents', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'search_documents', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,)}, - "attribute_map": {"namespace": "namespace"}, - "location_map": {"namespace": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'search_documents': + (SearchDocuments,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'search_documents': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, api_client=api_client, - callable=__list_documents, + callable=__search_documents ) - def __upsert_document(self, namespace, request_body, **kwargs: ExtraOpenApiKwargsTypedDict): + def __upsert_document( + self, + namespace, + upsert_document_request, + x_pinecone_api_version="unstable", + **kwargs: ExtraOpenApiKwargsTypedDict + ): """Create or update a document in the given namespace # noqa: E501 Upserts a document into the specified namespace. The request body may contain any valid JSON document that conforms to the schema. Optionally, an `_id` field can be provided to use as the document's identifier; if omitted, the system will assign one. # 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_document(namespace, request_body, async_req=True) + >>> thread = api.upsert_document(namespace, upsert_document_request, x_pinecone_api_version="unstable", async_req=True) >>> result = thread.get() Args: namespace (str): Namespace where the document will be stored. - request_body ({str: (bool, dict, float, int, list, str, none_type)}): + upsert_document_request (UpsertDocumentRequest): + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -295,43 +549,82 @@ def __upsert_document(self, namespace, request_body, **kwargs: ExtraOpenApiKwarg thread. """ kwargs = self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["request_body"] = request_body + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['upsert_document_request'] = \ + upsert_document_request return self.call_with_http_info(**kwargs) self.upsert_document = _Endpoint( settings={ - "response_type": (UpsertDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/upsert", - "operation_id": "upsert_document", - "http_method": "POST", - "servers": None, + 'response_type': (UpsertDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/upsert', + 'operation_id': 'upsert_document', + 'http_method': 'POST', + 'servers': None, }, params_map={ - "all": ["namespace", "request_body"], - "required": ["namespace", "request_body"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'upsert_document_request', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'upsert_document_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "namespace": (str,), - "request_body": ({str: (bool, dict, float, int, list, str, none_type)},), + 'validations': { }, - "attribute_map": {"namespace": "namespace"}, - "location_map": {"namespace": "path", "request_body": "body"}, - "collection_format_map": {}, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'upsert_document_request': + (UpsertDocumentRequest,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'upsert_document_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, api_client=api_client, - callable=__upsert_document, + callable=__upsert_document ) + class AsyncioDocumentOperationsApi: """NOTE: This class is @generated using OpenAPI @@ -343,15 +636,22 @@ def __init__(self, api_client=None) -> None: api_client = AsyncioApiClient() self.api_client = api_client - async def __delete_document(self, namespace, document_id, **kwargs): + async def __delete_document( + self, + namespace, + document_id, + x_pinecone_api_version="unstable", + **kwargs + ): """Delete a document from the given namespace # noqa: E501 Deletes a document from the specified namespace. # noqa: E501 Args: - namespace (str): Namespace to fetch document from. - document_id (str): Document ID to fetch. + namespace (str): Namespace to delete the document from. + document_id (str): Document ID to delete. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -374,40 +674,86 @@ async def __delete_document(self, namespace, document_id, **kwargs): DeleteDocumentResponse """ self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["document_id"] = document_id + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['document_id'] = \ + document_id return await self.call_with_http_info(**kwargs) self.delete_document = _AsyncioEndpoint( settings={ - "response_type": (DeleteDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/{document_id}", - "operation_id": "delete_document", - "http_method": "DELETE", - "servers": None, + 'response_type': (DeleteDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/{document_id}', + 'operation_id': 'delete_document', + 'http_method': 'DELETE', + 'servers': None, }, params_map={ - "all": ["namespace", "document_id"], - "required": ["namespace", "document_id"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,), "document_id": (str,)}, - "attribute_map": {"namespace": "namespace", "document_id": "document_id"}, - "location_map": {"namespace": "path", "document_id": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'document_id': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + 'document_id': 'document_id', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'document_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, api_client=api_client, - callable=__delete_document, + callable=__delete_document ) - async def __get_document(self, namespace, document_id, **kwargs): + async def __get_document( + self, + namespace, + document_id, + x_pinecone_api_version="unstable", + **kwargs + ): """Get a document from the given namespace # noqa: E501 Retrieves a document from the specified namespace. # noqa: E501 @@ -416,6 +762,7 @@ async def __get_document(self, namespace, document_id, **kwargs): Args: namespace (str): Namespace to fetch document from. document_id (str): Document ID to fetch. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -438,40 +785,85 @@ async def __get_document(self, namespace, document_id, **kwargs): GetDocumentResponse """ self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["document_id"] = document_id + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['document_id'] = \ + document_id return await self.call_with_http_info(**kwargs) self.get_document = _AsyncioEndpoint( settings={ - "response_type": (GetDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/{document_id}", - "operation_id": "get_document", - "http_method": "GET", - "servers": None, + 'response_type': (GetDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/{document_id}', + 'operation_id': 'get_document', + 'http_method': 'GET', + 'servers': None, }, params_map={ - "all": ["namespace", "document_id"], - "required": ["namespace", "document_id"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'document_id', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,), "document_id": (str,)}, - "attribute_map": {"namespace": "namespace", "document_id": "document_id"}, - "location_map": {"namespace": "path", "document_id": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'document_id': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + 'document_id': 'document_id', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'document_id': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, api_client=api_client, - callable=__get_document, + callable=__get_document ) - async def __list_documents(self, namespace, **kwargs): + async def __list_documents( + self, + namespace, + x_pinecone_api_version="unstable", + **kwargs + ): """List documents from the given namespace # noqa: E501 Lists documents from the specified namespace. (Paginated) # noqa: E501 @@ -479,6 +871,7 @@ async def __list_documents(self, namespace, **kwargs): Args: namespace (str): Namespace to fetch documents from. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -501,39 +894,190 @@ async def __list_documents(self, namespace, **kwargs): ListDocumentsResponse """ self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace return await self.call_with_http_info(**kwargs) self.list_documents = _AsyncioEndpoint( settings={ - "response_type": (ListDocumentsResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents", - "operation_id": "list_documents", - "http_method": "GET", - "servers": None, + 'response_type': (ListDocumentsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents', + 'operation_id': 'list_documents', + 'http_method': 'GET', + 'servers': None, + }, + params_map={ + 'all': [ + 'x_pinecone_api_version', + 'namespace', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] + }, + root_map={ + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [], + }, + api_client=api_client, + callable=__list_documents + ) + + async def __search_documents( + self, + namespace, + search_documents, + x_pinecone_api_version="unstable", + **kwargs + ): + """Search the documents in the given namespace. # noqa: E501 + + Search the documents in the specified namespace. # noqa: E501 + + + Args: + namespace (str): Namespace with the documents to search. + search_documents (SearchDocuments): The configuration for performing a search. + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] + + 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. + + Returns: + SearchDocumentsResponse + """ + self._process_openapi_kwargs(kwargs) + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['search_documents'] = \ + search_documents + return await self.call_with_http_info(**kwargs) + + self.search_documents = _AsyncioEndpoint( + settings={ + 'response_type': (SearchDocumentsResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/search', + 'operation_id': 'search_documents', + 'http_method': 'POST', + 'servers': None, }, params_map={ - "all": ["namespace"], - "required": ["namespace"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'search_documents', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'search_documents', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": {"namespace": (str,)}, - "attribute_map": {"namespace": "namespace"}, - "location_map": {"namespace": "path"}, - "collection_format_map": {}, - }, - headers_map={"accept": ["application/json"], "content_type": []}, + 'validations': { + }, + 'allowed_values': { + }, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'search_documents': + (SearchDocuments,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'search_documents': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] + }, api_client=api_client, - callable=__list_documents, + callable=__search_documents ) - async def __upsert_document(self, namespace, request_body, **kwargs): + async def __upsert_document( + self, + namespace, + upsert_document_request, + x_pinecone_api_version="unstable", + **kwargs + ): """Create or update a document in the given namespace # noqa: E501 Upserts a document into the specified namespace. The request body may contain any valid JSON document that conforms to the schema. Optionally, an `_id` field can be provided to use as the document's identifier; if omitted, the system will assign one. # noqa: E501 @@ -541,7 +1085,8 @@ async def __upsert_document(self, namespace, request_body, **kwargs): Args: namespace (str): Namespace where the document will be stored. - request_body ({str: (bool, dict, float, int, list, str, none_type)}): + upsert_document_request (UpsertDocumentRequest): + x_pinecone_api_version (str): Required date-based version header Defaults to "unstable", must be one of ["unstable"] Keyword Args: _return_http_data_only (bool): response data without head status @@ -564,38 +1109,76 @@ async def __upsert_document(self, namespace, request_body, **kwargs): UpsertDocumentResponse """ self._process_openapi_kwargs(kwargs) - kwargs["namespace"] = namespace - kwargs["request_body"] = request_body + kwargs['x_pinecone_api_version'] = \ + x_pinecone_api_version + kwargs['namespace'] = \ + namespace + kwargs['upsert_document_request'] = \ + upsert_document_request return await self.call_with_http_info(**kwargs) self.upsert_document = _AsyncioEndpoint( settings={ - "response_type": (UpsertDocumentResponse,), - "auth": ["ApiKeyAuth"], - "endpoint_path": "/ckb-stub-namespaces/{namespace}/documents/upsert", - "operation_id": "upsert_document", - "http_method": "POST", - "servers": None, + 'response_type': (UpsertDocumentResponse,), + 'auth': [ + 'ApiKeyAuth' + ], + 'endpoint_path': '/namespaces/{namespace}/documents/upsert', + 'operation_id': 'upsert_document', + 'http_method': 'POST', + 'servers': None, }, params_map={ - "all": ["namespace", "request_body"], - "required": ["namespace", "request_body"], - "nullable": [], - "enum": [], - "validation": [], + 'all': [ + 'x_pinecone_api_version', + 'namespace', + 'upsert_document_request', + ], + 'required': [ + 'x_pinecone_api_version', + 'namespace', + 'upsert_document_request', + ], + 'nullable': [ + ], + 'enum': [ + ], + 'validation': [ + ] }, root_map={ - "validations": {}, - "allowed_values": {}, - "openapi_types": { - "namespace": (str,), - "request_body": ({str: (bool, dict, float, int, list, str, none_type)},), + 'validations': { + }, + 'allowed_values': { }, - "attribute_map": {"namespace": "namespace"}, - "location_map": {"namespace": "path", "request_body": "body"}, - "collection_format_map": {}, + 'openapi_types': { + 'x_pinecone_api_version': + (str,), + 'namespace': + (str,), + 'upsert_document_request': + (UpsertDocumentRequest,), + }, + 'attribute_map': { + 'x_pinecone_api_version': 'X-Pinecone-Api-Version', + 'namespace': 'namespace', + }, + 'location_map': { + 'x_pinecone_api_version': 'header', + 'namespace': 'path', + 'upsert_document_request': 'body', + }, + 'collection_format_map': { + } + }, + headers_map={ + 'accept': [ + 'application/json' + ], + 'content_type': [ + 'application/json' + ] }, - headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, api_client=api_client, - callable=__upsert_document, + callable=__upsert_document ) diff --git a/pinecone/core/openapi/repository_data/api_client.py b/pinecone/core/openapi/repository_data/api_client.py new file mode 100644 index 00000000..8cf9e891 --- /dev/null +++ b/pinecone/core/openapi/repository_data/api_client.py @@ -0,0 +1 @@ +# Deleted diff --git a/pinecone/core/openapi/repository_data/apis/__init__.py b/pinecone/core/openapi/repository_data/apis/__init__.py index 44f505a0..5a768f10 100644 --- a/pinecone/core/openapi/repository_data/apis/__init__.py +++ b/pinecone/core/openapi/repository_data/apis/__init__.py @@ -1,3 +1,4 @@ + # flake8: noqa # Import all APIs into this package. diff --git a/pinecone/core/openapi/repository_data/configuration.py b/pinecone/core/openapi/repository_data/configuration.py new file mode 100644 index 00000000..8cf9e891 --- /dev/null +++ b/pinecone/core/openapi/repository_data/configuration.py @@ -0,0 +1 @@ +# Deleted diff --git a/pinecone/core/openapi/repository_data/exceptions.py b/pinecone/core/openapi/repository_data/exceptions.py new file mode 100644 index 00000000..8cf9e891 --- /dev/null +++ b/pinecone/core/openapi/repository_data/exceptions.py @@ -0,0 +1 @@ +# Deleted diff --git a/pinecone/core/openapi/repository_data/model/context_options_model.py b/pinecone/core/openapi/repository_data/model/context_options_model.py new file mode 100644 index 00000000..f02d91f3 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/context_options_model.py @@ -0,0 +1,330 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.document_context_unit_model import DocumentContextUnitModel + globals()['DocumentContextUnitModel'] = DocumentContextUnitModel + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="ContextOptionsModel") + + +class ContextOptionsModel(ModelComposed): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'unit': (str,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + lazy_import() + val = { + 'DocumentContextUnitModel': DocumentContextUnitModel, + 'document': DocumentContextUnitModel, + } + if not val: + return None + return {'unit': val} + + attribute_map: Dict[str, str] = { + 'unit': 'unit', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 + """ContextOptionsModel - a model defined in OpenAPI + + Keyword Args: + unit (str): The search result context unit. Always \"document\". + _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 PineconeApiTypeError( + "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__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_spec_property_naming': _spec_property_naming, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + composed_info = validate_get_composed_info( + constant_args, kwargs, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + discarded_args = composed_info[3] + + for var_name, var_value in kwargs.items(): + if var_name in discarded_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + return self + + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs) -> None: # noqa: E501 + """ContextOptionsModel - a model defined in OpenAPI + + Keyword Args: + unit (str): The search result context unit. Always \"document\". + _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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_spec_property_naming': _spec_property_naming, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + composed_info = validate_get_composed_info( + constant_args, kwargs, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + discarded_args = composed_info[3] + + for var_name, var_value in kwargs.items(): + if var_name in discarded_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") + + @cached_property + def _composed_schemas(): # type: ignore + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + lazy_import() + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + DocumentContextUnitModel, + ], + } diff --git a/pinecone/core/openapi/repository_data/model/delete_document_response.py b/pinecone/core/openapi/repository_data/model/delete_document_response.py index f1607674..43056899 100644 --- a/pinecone/core/openapi/repository_data/model/delete_document_response.py +++ b/pinecone/core/openapi/repository_data/model/delete_document_response.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -30,9 +31,8 @@ def lazy_import(): from pinecone.core.openapi.repository_data.model.lsn_status import LSNStatus from pinecone.core.openapi.repository_data.model.usage import Usage - - globals()["LSNStatus"] = LSNStatus - globals()["Usage"] = Usage + globals()['LSNStatus'] = LSNStatus + globals()['Usage'] = Usage from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar @@ -67,9 +67,11 @@ class DeleteDocumentResponse(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -78,7 +80,7 @@ def additional_properties_type(cls): of type self, this must run after the class is loaded """ lazy_import() - return (bool, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -94,26 +96,28 @@ def openapi_types(cls): """ lazy_import() return { - "id": (str,), # noqa: E501 - "namespace": (str,), # noqa: E501 - "usage": (Usage,), # noqa: E501 - "lsn_status": (LSNStatus,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'usage': (Usage,), # noqa: E501 + 'lsn_status': (LSNStatus,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "id": "_id", # noqa: E501 - "namespace": "namespace", # noqa: E501 - "usage": "usage", # noqa: E501 - "lsn_status": "_lsn_status", # noqa: E501 + 'id': '_id', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'usage': 'usage', # noqa: E501 + 'lsn_status': '_lsn_status', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -159,20 +163,22 @@ def _from_openapi_data(cls: Type[T], id, namespace, usage, lsn_status, *args, ** _visited_composed_classes = (Animal,) """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -191,29 +197,25 @@ def _from_openapi_data(cls: Type[T], id, namespace, usage, lsn_status, *args, ** self.usage = usage self.lsn_status = lsn_status 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, id, namespace, usage, lsn_status, *args, **kwargs) -> None: # noqa: E501 @@ -259,17 +261,19 @@ def __init__(self, id, namespace, usage, lsn_status, *args, **kwargs) -> None: """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -288,17 +292,13 @@ def __init__(self, id, namespace, usage, lsn_status, *args, **kwargs) -> None: self.usage = usage self.lsn_status = lsn_status 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/document.py b/pinecone/core/openapi/repository_data/model/document.py index 46ac58c3..f21d2ea0 100644 --- a/pinecone/core/openapi/repository_data/model/document.py +++ b/pinecone/core/openapi/repository_data/model/document.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -27,6 +28,7 @@ from pinecone.openapi_support.exceptions import PineconeApiAttributeError + from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property @@ -59,9 +61,11 @@ class Document(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -69,7 +73,7 @@ def additional_properties_type(cls): 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, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -84,20 +88,22 @@ def openapi_types(cls): and the value is attribute type. """ return { - "id": (str,) # noqa: E501 + 'id': (str,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "id": "_id" # noqa: E501 + 'id': '_id', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -140,20 +146,22 @@ def _from_openapi_data(cls: Type[T], id, *args, **kwargs) -> T: # noqa: E501 _visited_composed_classes = (Animal,) """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -169,29 +177,25 @@ def _from_openapi_data(cls: Type[T], id, *args, **kwargs) -> T: # noqa: E501 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_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) -> None: # noqa: E501 @@ -234,17 +238,19 @@ def __init__(self, id, *args, **kwargs) -> None: # noqa: E501 """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -260,17 +266,13 @@ def __init__(self, id, *args, **kwargs) -> None: # noqa: E501 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/document_context_unit_model.py b/pinecone/core/openapi/repository_data/model/document_context_unit_model.py new file mode 100644 index 00000000..705c2084 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/document_context_unit_model.py @@ -0,0 +1,278 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="DocumentContextUnitModel") + + +class DocumentContextUnitModel(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'unit': (str,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'unit': 'unit', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], unit, *args, **kwargs) -> T: # noqa: E501 + """DocumentContextUnitModel - a model defined in OpenAPI + + Args: + unit (str): The search result context unit. Always \"document\". + + 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.unit = unit + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, unit, *args, **kwargs) -> None: # noqa: E501 + """DocumentContextUnitModel - a model defined in OpenAPI + + Args: + unit (str): The search result context unit. Always \"document\". + + 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.unit = unit + 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 PineconeApiAttributeError(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/openapi/repository_data/model/document_list.py b/pinecone/core/openapi/repository_data/model/document_list.py index 55532fc5..eeb0fe8e 100644 --- a/pinecone/core/openapi/repository_data/model/document_list.py +++ b/pinecone/core/openapi/repository_data/model/document_list.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -29,8 +30,7 @@ def lazy_import(): from pinecone.core.openapi.repository_data.model.document import Document - - globals()["Document"] = Document + globals()['Document'] = Document from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar @@ -61,9 +61,11 @@ class DocumentList(ModelSimple): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -72,7 +74,7 @@ def additional_properties_type(cls): of type self, this must run after the class is loaded """ lazy_import() - return (bool, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -87,30 +89,31 @@ def openapi_types(cls): and the value is attribute type. """ lazy_import() - return {"value": ([Document],)} + return { + 'value': ([Document],), + } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = {} read_only_vars: Set[str] = set() _composed_schemas = None - required_properties = set( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_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) -> None: @@ -155,19 +158,21 @@ def __init__(self, *args, **kwargs) -> None: _visited_composed_classes = (Animal,) """ # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) + _path_to_item = kwargs.pop('_path_to_item', ()) value = None - if "value" in kwargs: - value = kwargs.pop("value") + if 'value' in kwargs: + value = kwargs.pop('value') if value is None and args: if len(args) == 1: value = args[0] elif len(args) > 1: raise PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -179,12 +184,13 @@ def __init__(self, *args, **kwargs) -> None: valid_classes=(self.__class__,), ) - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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', ()) self._data_store = {} self._enforce_allowed_values = _enforce_allowed_values @@ -197,8 +203,10 @@ def __init__(self, *args, **kwargs) -> None: self.value = value if kwargs: raise PineconeApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % (kwargs, self.__class__.__name__), + "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__,), ) @@ -247,21 +255,23 @@ def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: _visited_composed_classes = (Animal,) """ # required up here when default value is not given - _path_to_item = kwargs.pop("_path_to_item", ()) + _path_to_item = kwargs.pop('_path_to_item', ()) self = super(OpenApiModel, cls).__new__(cls) value = None - if "value" in kwargs: - value = kwargs.pop("value") + if 'value' in kwargs: + value = kwargs.pop('value') if value is None and args: if len(args) == 1: value = args[0] elif len(args) > 1: raise PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -273,12 +283,13 @@ def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: valid_classes=(self.__class__,), ) - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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', ()) self._data_store = {} self._enforce_allowed_values = _enforce_allowed_values @@ -291,8 +302,10 @@ def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: self.value = value if kwargs: raise PineconeApiTypeError( - "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." - % (kwargs, self.__class__.__name__), + "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__,), ) diff --git a/pinecone/core/openapi/repository_data/model/document_result_model.py b/pinecone/core/openapi/repository_data/model/document_result_model.py new file mode 100644 index 00000000..132e7adc --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/document_result_model.py @@ -0,0 +1,302 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.matched_chunk_model import MatchedChunkModel + globals()['MatchedChunkModel'] = MatchedChunkModel + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="DocumentResultModel") + + +class DocumentResultModel(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'score': (float,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'document': ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 + 'matching_chunks': ([MatchedChunkModel],), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'score': 'score', # noqa: E501 + 'id': '_id', # noqa: E501 + 'document': 'document', # noqa: E501 + 'matching_chunks': 'matching_chunks', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], score, id, document, matching_chunks, *args, **kwargs) -> T: # noqa: E501 + """DocumentResultModel - a model defined in OpenAPI + + Args: + score (float): The relevance of the document to the query. + id (str): The ID of the document. + document ({str: (bool, dict, float, int, list, str, none_type)}): The document JSON, which may include the entire document or only a relevant part of it. + matching_chunks ([MatchedChunkModel]): List of chunks within the document that matched the 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.score = score + self.id = id + self.document = document + self.matching_chunks = matching_chunks + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, score, id, document, matching_chunks, *args, **kwargs) -> None: # noqa: E501 + """DocumentResultModel - a model defined in OpenAPI + + Args: + score (float): The relevance of the document to the query. + id (str): The ID of the document. + document ({str: (bool, dict, float, int, list, str, none_type)}): The document JSON, which may include the entire document or only a relevant part of it. + matching_chunks ([MatchedChunkModel]): List of chunks within the document that matched the 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.score = score + self.id = id + self.document = document + self.matching_chunks = matching_chunks + 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 PineconeApiAttributeError(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/openapi/repository_data/model/get_document_response.py b/pinecone/core/openapi/repository_data/model/get_document_response.py index 7ff1afb3..d467a5d0 100644 --- a/pinecone/core/openapi/repository_data/model/get_document_response.py +++ b/pinecone/core/openapi/repository_data/model/get_document_response.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -31,10 +32,9 @@ def lazy_import(): from pinecone.core.openapi.repository_data.model.document import Document from pinecone.core.openapi.repository_data.model.lsn_status import LSNStatus from pinecone.core.openapi.repository_data.model.usage import Usage - - globals()["Document"] = Document - globals()["LSNStatus"] = LSNStatus - globals()["Usage"] = Usage + globals()['Document'] = Document + globals()['LSNStatus'] = LSNStatus + globals()['Usage'] = Usage from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar @@ -69,9 +69,11 @@ class GetDocumentResponse(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -80,7 +82,7 @@ def additional_properties_type(cls): of type self, this must run after the class is loaded """ lazy_import() - return (bool, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -96,32 +98,32 @@ def openapi_types(cls): """ lazy_import() return { - "namespace": (str,), # noqa: E501 - "document": (Document,), # noqa: E501 - "usage": (Usage,), # noqa: E501 - "lsn_status": (LSNStatus,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'document': (Document,), # noqa: E501 + 'usage': (Usage,), # noqa: E501 + 'lsn_status': (LSNStatus,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "namespace": "namespace", # noqa: E501 - "document": "document", # noqa: E501 - "usage": "usage", # noqa: E501 - "lsn_status": "_lsn_status", # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'document': 'document', # noqa: E501 + 'usage': 'usage', # noqa: E501 + 'lsn_status': '_lsn_status', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args - def _from_openapi_data( - cls: Type[T], namespace, document, usage, lsn_status, *args, **kwargs - ) -> T: # noqa: E501 + def _from_openapi_data(cls: Type[T], namespace, document, usage, lsn_status, *args, **kwargs) -> T: # noqa: E501 """GetDocumentResponse - a model defined in OpenAPI Args: @@ -163,20 +165,22 @@ def _from_openapi_data( _visited_composed_classes = (Animal,) """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -195,29 +199,25 @@ def _from_openapi_data( self.usage = usage self.lsn_status = lsn_status 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, namespace, document, usage, lsn_status, *args, **kwargs) -> None: # noqa: E501 @@ -263,17 +263,19 @@ def __init__(self, namespace, document, usage, lsn_status, *args, **kwargs) -> N """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -292,17 +294,13 @@ def __init__(self, namespace, document, usage, lsn_status, *args, **kwargs) -> N self.usage = usage self.lsn_status = lsn_status 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/list_documents_response.py b/pinecone/core/openapi/repository_data/model/list_documents_response.py index ee953eff..c0d54dbb 100644 --- a/pinecone/core/openapi/repository_data/model/list_documents_response.py +++ b/pinecone/core/openapi/repository_data/model/list_documents_response.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -32,11 +33,10 @@ def lazy_import(): from pinecone.core.openapi.repository_data.model.lsn_status import LSNStatus from pinecone.core.openapi.repository_data.model.pagination_response import PaginationResponse from pinecone.core.openapi.repository_data.model.usage import Usage - - globals()["DocumentList"] = DocumentList - globals()["LSNStatus"] = LSNStatus - globals()["PaginationResponse"] = PaginationResponse - globals()["Usage"] = Usage + globals()['DocumentList'] = DocumentList + globals()['LSNStatus'] = LSNStatus + globals()['PaginationResponse'] = PaginationResponse + globals()['Usage'] = Usage from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar @@ -71,9 +71,11 @@ class ListDocumentsResponse(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -82,7 +84,7 @@ def additional_properties_type(cls): of type self, this must run after the class is loaded """ lazy_import() - return (bool, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -98,34 +100,34 @@ def openapi_types(cls): """ lazy_import() return { - "namespace": (str,), # noqa: E501 - "documents": (DocumentList,), # noqa: E501 - "usage": (Usage,), # noqa: E501 - "lsn_status": (LSNStatus,), # noqa: E501 - "pagination": (PaginationResponse,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'documents': (DocumentList,), # noqa: E501 + 'usage': (Usage,), # noqa: E501 + 'lsn_status': (LSNStatus,), # noqa: E501 + 'pagination': (PaginationResponse,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "namespace": "namespace", # noqa: E501 - "documents": "documents", # noqa: E501 - "usage": "usage", # noqa: E501 - "lsn_status": "_lsn_status", # noqa: E501 - "pagination": "pagination", # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'documents': 'documents', # noqa: E501 + 'usage': 'usage', # noqa: E501 + 'lsn_status': '_lsn_status', # noqa: E501 + 'pagination': 'pagination', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args - def _from_openapi_data( - cls: Type[T], namespace, documents, usage, lsn_status, *args, **kwargs - ) -> T: # noqa: E501 + def _from_openapi_data(cls: Type[T], namespace, documents, usage, lsn_status, *args, **kwargs) -> T: # noqa: E501 """ListDocumentsResponse - a model defined in OpenAPI Args: @@ -168,20 +170,22 @@ def _from_openapi_data( pagination (PaginationResponse): [optional] # noqa: E501 """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -200,29 +204,25 @@ def _from_openapi_data( self.usage = usage self.lsn_status = lsn_status 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, namespace, documents, usage, lsn_status, *args, **kwargs) -> None: # noqa: E501 @@ -269,17 +269,19 @@ def __init__(self, namespace, documents, usage, lsn_status, *args, **kwargs) -> """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -298,17 +300,13 @@ def __init__(self, namespace, documents, usage, lsn_status, *args, **kwargs) -> self.usage = usage self.lsn_status = lsn_status 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/lsn_status.py b/pinecone/core/openapi/repository_data/model/lsn_status.py index 57489531..3e9bdab9 100644 --- a/pinecone/core/openapi/repository_data/model/lsn_status.py +++ b/pinecone/core/openapi/repository_data/model/lsn_status.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -27,6 +28,7 @@ from pinecone.openapi_support.exceptions import PineconeApiAttributeError + from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property @@ -59,9 +61,11 @@ class LSNStatus(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -69,7 +73,7 @@ def additional_properties_type(cls): 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, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -84,22 +88,24 @@ def openapi_types(cls): and the value is attribute type. """ return { - "reconciled": (int,), # noqa: E501 - "committed": (int,), # noqa: E501 + 'reconciled': (int,), # noqa: E501 + 'committed': (int,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "reconciled": "reconciled", # noqa: E501 - "committed": "committed", # noqa: E501 + 'reconciled': 'reconciled', # noqa: E501 + 'committed': 'committed', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -143,20 +149,22 @@ def _from_openapi_data(cls: Type[T], reconciled, *args, **kwargs) -> T: # noqa: committed (int): The committed log sequence number for this write operation. [optional] # noqa: E501 """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -172,29 +180,25 @@ def _from_openapi_data(cls: Type[T], reconciled, *args, **kwargs) -> T: # noqa: self.reconciled = reconciled 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, reconciled, *args, **kwargs) -> None: # noqa: E501 @@ -238,17 +242,19 @@ def __init__(self, reconciled, *args, **kwargs) -> None: # noqa: E501 """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -264,17 +270,13 @@ def __init__(self, reconciled, *args, **kwargs) -> None: # noqa: E501 self.reconciled = reconciled 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/matched_chunk_model.py b/pinecone/core/openapi/repository_data/model/matched_chunk_model.py new file mode 100644 index 00000000..e7a155ea --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/matched_chunk_model.py @@ -0,0 +1,284 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="MatchedChunkModel") + + +class MatchedChunkModel(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'score': (float,), # noqa: E501 + 'origin_json_path': (str,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'score': 'score', # noqa: E501 + 'origin_json_path': 'origin_json_path', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], score, origin_json_path, *args, **kwargs) -> T: # noqa: E501 + """MatchedChunkModel - a model defined in OpenAPI + + Args: + score (float): The relevance of the chunk to the query. + origin_json_path (str): JSON path pointing to the chunk in the original document. + + 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.score = score + self.origin_json_path = origin_json_path + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, score, origin_json_path, *args, **kwargs) -> None: # noqa: E501 + """MatchedChunkModel - a model defined in OpenAPI + + Args: + score (float): The relevance of the chunk to the query. + origin_json_path (str): JSON path pointing to the chunk in the original document. + + 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.score = score + self.origin_json_path = origin_json_path + 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 PineconeApiAttributeError(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/openapi/repository_data/model/options_model.py b/pinecone/core/openapi/repository_data/model/options_model.py new file mode 100644 index 00000000..f15de011 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/options_model.py @@ -0,0 +1,278 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.context_options_model import ContextOptionsModel + globals()['ContextOptionsModel'] = ContextOptionsModel + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="OptionsModel") + + +class OptionsModel(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'context': (ContextOptionsModel,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'context': 'context', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 + """OptionsModel - 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,) + context (ContextOptionsModel): [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_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) -> None: # noqa: E501 + """OptionsModel - 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,) + context (ContextOptionsModel): [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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 PineconeApiAttributeError(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/openapi/repository_data/model/pagination_response.py b/pinecone/core/openapi/repository_data/model/pagination_response.py index b1c11924..e0537481 100644 --- a/pinecone/core/openapi/repository_data/model/pagination_response.py +++ b/pinecone/core/openapi/repository_data/model/pagination_response.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -27,6 +28,7 @@ from pinecone.openapi_support.exceptions import PineconeApiAttributeError + from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property @@ -59,9 +61,11 @@ class PaginationResponse(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -69,7 +73,7 @@ def additional_properties_type(cls): 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, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -84,20 +88,22 @@ def openapi_types(cls): and the value is attribute type. """ return { - "next": (str,) # noqa: E501 + 'next': (str,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "next": "next" # noqa: E501 + 'next': 'next', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -140,20 +146,22 @@ def _from_openapi_data(cls: Type[T], next, *args, **kwargs) -> T: # noqa: E501 _visited_composed_classes = (Animal,) """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -169,29 +177,25 @@ def _from_openapi_data(cls: Type[T], next, *args, **kwargs) -> T: # noqa: E501 self.next = next 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, next, *args, **kwargs) -> None: # noqa: E501 @@ -234,17 +238,19 @@ def __init__(self, next, *args, **kwargs) -> None: # noqa: E501 """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -260,17 +266,13 @@ def __init__(self, next, *args, **kwargs) -> None: # noqa: E501 self.next = next 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/query_input_model.py b/pinecone/core/openapi/repository_data/model/query_input_model.py new file mode 100644 index 00000000..cbc18fa9 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/query_input_model.py @@ -0,0 +1,324 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.query_input_model_one_of import QueryInputModelOneOf + globals()['QueryInputModelOneOf'] = QueryInputModelOneOf + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="QueryInputModel") + + +class QueryInputModel(ModelComposed): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'text': (str,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'text': 'text', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 + """QueryInputModel - 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,) + text (str): The query string used to search. [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 PineconeApiTypeError( + "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__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_spec_property_naming': _spec_property_naming, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + composed_info = validate_get_composed_info( + constant_args, kwargs, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + discarded_args = composed_info[3] + + for var_name, var_value in kwargs.items(): + if var_name in discarded_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + + return self + + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + '_composed_instances', + '_var_name_to_model_instances', + '_additional_properties_model_instances', + ]) + + @convert_js_args_to_python_args + def __init__(self, *args, **kwargs) -> None: # noqa: E501 + """QueryInputModel - 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,) + text (str): The query string used to search. [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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__,) + + constant_args = { + '_check_type': _check_type, + '_path_to_item': _path_to_item, + '_spec_property_naming': _spec_property_naming, + '_configuration': _configuration, + '_visited_composed_classes': self._visited_composed_classes, + } + composed_info = validate_get_composed_info( + constant_args, kwargs, self) + self._composed_instances = composed_info[0] + self._var_name_to_model_instances = composed_info[1] + self._additional_properties_model_instances = composed_info[2] + discarded_args = composed_info[3] + + for var_name, var_value in kwargs.items(): + if var_name in discarded_args and \ + self._configuration is not None and \ + self._configuration.discard_unknown_keys and \ + self._additional_properties_model_instances: + # discard variable. + continue + setattr(self, var_name, var_value) + if var_name in self.read_only_vars: + raise PineconeApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " + f"class with read only attributes.") + + @cached_property + def _composed_schemas(): # type: ignore + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error beause the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + lazy_import() + return { + 'anyOf': [ + ], + 'allOf': [ + ], + 'oneOf': [ + QueryInputModelOneOf, + ], + } diff --git a/pinecone/core/openapi/repository_data/model/query_input_model_one_of.py b/pinecone/core/openapi/repository_data/model/query_input_model_one_of.py new file mode 100644 index 00000000..f7a8f217 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/query_input_model_one_of.py @@ -0,0 +1,278 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="QueryInputModelOneOf") + + +class QueryInputModelOneOf(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'text': (str,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'text': 'text', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], text, *args, **kwargs) -> T: # noqa: E501 + """QueryInputModelOneOf - a model defined in OpenAPI + + Args: + text (str): The query string used to search. + + 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.text = text + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, text, *args, **kwargs) -> None: # noqa: E501 + """QueryInputModelOneOf - a model defined in OpenAPI + + Args: + text (str): The query string used to search. + + 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.text = text + 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 PineconeApiAttributeError(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/openapi/repository_data/model/query_model.py b/pinecone/core/openapi/repository_data/model/query_model.py new file mode 100644 index 00000000..b4d39eac --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/query_model.py @@ -0,0 +1,294 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.query_input_model import QueryInputModel + globals()['QueryInputModel'] = QueryInputModel + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="QueryModel") + + +class QueryModel(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 + 'inputs': (QueryInputModel,), # noqa: E501 + 'filter': ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'top_k': 'top_k', # noqa: E501 + 'inputs': 'inputs', # noqa: E501 + 'filter': 'filter', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], top_k, inputs, *args, **kwargs) -> T: # noqa: E501 + """QueryModel - a model defined in OpenAPI + + Args: + top_k (int): The maximum number of search results to return. Minimum is 1. Maximum is 20. + inputs (QueryInputModel): + + 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, dict, float, int, list, str, none_type)}): Optionally filter which chunks can be searched using the metadata fields. [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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 + self.inputs = inputs + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_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, inputs, *args, **kwargs) -> None: # noqa: E501 + """QueryModel - a model defined in OpenAPI + + Args: + top_k (int): The maximum number of search results to return. Minimum is 1. Maximum is 20. + inputs (QueryInputModel): + + 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, dict, float, int, list, str, none_type)}): Optionally filter which chunks can be searched using the metadata fields. [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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 + self.inputs = inputs + 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 PineconeApiAttributeError(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/openapi/repository_data/model/search_documents.py b/pinecone/core/openapi/repository_data/model/search_documents.py new file mode 100644 index 00000000..7d573ca6 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/search_documents.py @@ -0,0 +1,290 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.options_model import OptionsModel + from pinecone.core.openapi.repository_data.model.query_model import QueryModel + globals()['OptionsModel'] = OptionsModel + globals()['QueryModel'] = QueryModel + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="SearchDocuments") + + +class SearchDocuments(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + 'query': (QueryModel,), # noqa: E501 + 'options': (OptionsModel,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'query': 'query', # noqa: E501 + 'options': 'options', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], query, *args, **kwargs) -> T: # noqa: E501 + """SearchDocuments - a model defined in OpenAPI + + Args: + query (QueryModel): + + 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,) + options (OptionsModel): [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.query = query + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, query, *args, **kwargs) -> None: # noqa: E501 + """SearchDocuments - a model defined in OpenAPI + + Args: + query (QueryModel): + + 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,) + options (OptionsModel): [optional] # noqa: E501 + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.query = query + 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 PineconeApiAttributeError(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/openapi/repository_data/model/search_documents_response.py b/pinecone/core/openapi/repository_data/model/search_documents_response.py new file mode 100644 index 00000000..2c4895c9 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/search_documents_response.py @@ -0,0 +1,292 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + +def lazy_import(): + from pinecone.core.openapi.repository_data.model.document_result_model import DocumentResultModel + from pinecone.core.openapi.repository_data.model.usage import Usage + globals()['DocumentResultModel'] = DocumentResultModel + globals()['Usage'] = Usage + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="SearchDocumentsResponse") + + +class SearchDocumentsResponse(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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': ([DocumentResultModel],), # noqa: E501 + 'usage': (Usage,), # noqa: E501 + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + 'results': 'results', # noqa: E501 + 'usage': 'usage', # noqa: E501 + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], results, usage, *args, **kwargs) -> T: # noqa: E501 + """SearchDocumentsResponse - a model defined in OpenAPI + + Args: + results ([DocumentResultModel]): + usage (Usage): + + 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.results = results + self.usage = usage + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) + + @convert_js_args_to_python_args + def __init__(self, results, usage, *args, **kwargs) -> None: # noqa: E501 + """SearchDocumentsResponse - a model defined in OpenAPI + + Args: + results ([DocumentResultModel]): + usage (Usage): + + 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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.results = results + self.usage = usage + 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 PineconeApiAttributeError(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/openapi/repository_data/model/upsert_document_request.py b/pinecone/core/openapi/repository_data/model/upsert_document_request.py new file mode 100644 index 00000000..2b54eb54 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model/upsert_document_request.py @@ -0,0 +1,268 @@ +""" + Pinecone Data Plane API for Repositories + + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + + This file is @generated using OpenAPI. + + The version of the OpenAPI document: unstable + Contact: support@pinecone.io +""" + + +from pinecone.openapi_support.model_utils import ( # noqa: F401 + PineconeApiTypeError, + ModelComposed, + ModelNormal, + ModelSimple, + OpenApiModel, + cached_property, + change_keys_js_to_python, + convert_js_args_to_python_args, + date, + datetime, + file_type, + none_type, + validate_get_composed_info, +) +from pinecone.openapi_support.exceptions import PineconeApiAttributeError + + + +from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar +from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property + +T = TypeVar("T", bound="UpsertDocumentRequest") + + +class UpsertDocumentRequest(ModelNormal): + """NOTE: This class is @generated using OpenAPI. + + 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. + """ + + _data_store: Dict[str, Any] + _check_type: bool + + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } + + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } + + @cached_class_property + def additional_properties_type(cls): + """ + 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, dict, float, int, list, str, none_type,) # noqa: E501 + + _nullable = False + + @cached_class_property + def openapi_types(cls): + """ + 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 { + } + + @cached_class_property + def discriminator(cls): + return None + + + attribute_map: Dict[str, str] = { + } + + read_only_vars: Set[str] = set([ + ]) + + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} + + @classmethod + @convert_js_args_to_python_args + def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 + """UpsertDocumentRequest - 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,) + """ + + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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([ + '_enforce_allowed_values', + '_enforce_validations', + '_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) -> None: # noqa: E501 + """UpsertDocumentRequest - 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,) + """ + + _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( + "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._enforce_allowed_values = _enforce_allowed_values + self._enforce_validations = _enforce_validations + 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 PineconeApiAttributeError(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/openapi/repository_data/model/upsert_document_response.py b/pinecone/core/openapi/repository_data/model/upsert_document_response.py index cf2215b5..c44b6e6b 100644 --- a/pinecone/core/openapi/repository_data/model/upsert_document_response.py +++ b/pinecone/core/openapi/repository_data/model/upsert_document_response.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -29,8 +30,7 @@ def lazy_import(): from pinecone.core.openapi.repository_data.model.lsn_status import LSNStatus - - globals()["LSNStatus"] = LSNStatus + globals()['LSNStatus'] = LSNStatus from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar @@ -65,9 +65,11 @@ class UpsertDocumentResponse(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -76,7 +78,7 @@ def additional_properties_type(cls): of type self, this must run after the class is loaded """ lazy_import() - return (bool, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -92,24 +94,26 @@ def openapi_types(cls): """ lazy_import() return { - "id": (str,), # noqa: E501 - "namespace": (str,), # noqa: E501 - "lsn_status": (LSNStatus,), # noqa: E501 + 'id': (str,), # noqa: E501 + 'namespace': (str,), # noqa: E501 + 'lsn_status': (LSNStatus,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "id": "_id", # noqa: E501 - "namespace": "namespace", # noqa: E501 - "lsn_status": "_lsn_status", # noqa: E501 + 'id': '_id', # noqa: E501 + 'namespace': 'namespace', # noqa: E501 + 'lsn_status': '_lsn_status', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -154,20 +158,22 @@ def _from_openapi_data(cls: Type[T], id, namespace, lsn_status, *args, **kwargs) _visited_composed_classes = (Animal,) """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -185,29 +191,25 @@ def _from_openapi_data(cls: Type[T], id, namespace, lsn_status, *args, **kwargs) self.namespace = namespace self.lsn_status = lsn_status 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_data_store', + '_check_type', + '_spec_property_naming', + '_path_to_item', + '_configuration', + '_visited_composed_classes', + ]) @convert_js_args_to_python_args def __init__(self, id, namespace, lsn_status, *args, **kwargs) -> None: # noqa: E501 @@ -252,17 +254,19 @@ def __init__(self, id, namespace, lsn_status, *args, **kwargs) -> None: # noqa: """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -280,17 +284,13 @@ def __init__(self, id, namespace, lsn_status, *args, **kwargs) -> None: # noqa: self.namespace = namespace self.lsn_status = lsn_status 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model/usage.py b/pinecone/core/openapi/repository_data/model/usage.py index fa195ec9..4ee9186b 100644 --- a/pinecone/core/openapi/repository_data/model/usage.py +++ b/pinecone/core/openapi/repository_data/model/usage.py @@ -1,14 +1,15 @@ """ -Pinecone Data Plane API for Repositories + Pinecone Data Plane API for Repositories -Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 + Pinecone Repositories build on the vector database to make it easy to store, search and retrieve your data. # noqa: E501 -This file is @generated using OpenAPI. + This file is @generated using OpenAPI. -The version of the OpenAPI document: unstable -Contact: support@pinecone.io + The version of the OpenAPI document: unstable + Contact: support@pinecone.io """ + from pinecone.openapi_support.model_utils import ( # noqa: F401 PineconeApiTypeError, ModelComposed, @@ -27,6 +28,7 @@ from pinecone.openapi_support.exceptions import PineconeApiAttributeError + from typing import Dict, Literal, Tuple, Set, Any, Type, TypeVar from pinecone.openapi_support import PropertyValidationTypedDict, cached_class_property @@ -59,9 +61,11 @@ class Usage(ModelNormal): _data_store: Dict[str, Any] _check_type: bool - allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = {} + allowed_values: Dict[Tuple[str, ...], Dict[str, Any]] = { + } - validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = {} + validations: Dict[Tuple[str, ...], PropertyValidationTypedDict] = { + } @cached_class_property def additional_properties_type(cls): @@ -69,7 +73,7 @@ def additional_properties_type(cls): 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, dict, float, int, list, str, none_type) # noqa: E501 + return (bool, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @@ -84,26 +88,26 @@ def openapi_types(cls): and the value is attribute type. """ return { - "kb_read_units": (float,), # noqa: E501 - "kb_write_units": (float,), # noqa: E501 - "embed_total_tokens": (int,), # noqa: E501 - "rerank_units": (int,), # noqa: E501 + 'kb_read_units': (float,), # noqa: E501 + 'kb_write_units': (float,), # noqa: E501 + 'embed_total_tokens': (int,), # noqa: E501 } @cached_class_property def discriminator(cls): return None + attribute_map: Dict[str, str] = { - "kb_read_units": "kb_read_units", # noqa: E501 - "kb_write_units": "kb_write_units", # noqa: E501 - "embed_total_tokens": "embed_total_tokens", # noqa: E501 - "rerank_units": "rerank_units", # noqa: E501 + 'kb_read_units': 'kb_read_units', # noqa: E501 + 'kb_write_units': 'kb_write_units', # noqa: E501 + 'embed_total_tokens': 'embed_total_tokens', # noqa: E501 } - read_only_vars: Set[str] = set([]) + read_only_vars: Set[str] = set([ + ]) - _composed_schemas: Dict[Literal["allOf", "oneOf", "anyOf"], Any] = {} + _composed_schemas: Dict[Literal['allOf', 'oneOf', 'anyOf'], Any] = {} @classmethod @convert_js_args_to_python_args @@ -144,23 +148,24 @@ def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 kb_read_units (float): The number of read units consumed by this operation. [optional] # noqa: E501 kb_write_units (float): The number of write units consumed by this operation. [optional] # noqa: E501 embed_total_tokens (int): The number of embedding tokens consumed by this operation. [optional] # noqa: E501 - rerank_units (int): The number of rerank units consumed by this operation. [optional] # noqa: E501 """ - _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", False) - _enforce_validations = kwargs.pop("_enforce_validations", False) - _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", ()) + _enforce_allowed_values = kwargs.pop('_enforce_allowed_values', False) + _enforce_validations = kwargs.pop('_enforce_validations', False) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -175,29 +180,25 @@ def _from_openapi_data(cls: Type[T], *args, **kwargs) -> T: # noqa: E501 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 - ): + 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( - [ - "_enforce_allowed_values", - "_enforce_validations", - "_data_store", - "_check_type", - "_spec_property_naming", - "_path_to_item", - "_configuration", - "_visited_composed_classes", - ] - ) + required_properties = set([ + '_enforce_allowed_values', + '_enforce_validations', + '_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) -> None: # noqa: E501 @@ -237,21 +238,22 @@ def __init__(self, *args, **kwargs) -> None: # noqa: E501 kb_read_units (float): The number of read units consumed by this operation. [optional] # noqa: E501 kb_write_units (float): The number of write units consumed by this operation. [optional] # noqa: E501 embed_total_tokens (int): The number of embedding tokens consumed by this operation. [optional] # noqa: E501 - rerank_units (int): The number of rerank units consumed by this operation. [optional] # noqa: E501 """ _enforce_allowed_values = kwargs.pop("_enforce_allowed_values", True) - _enforce_validations = kwargs.pop("_enforce_validations", True) - _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", ()) + _enforce_validations = kwargs.pop('_enforce_validations', True) + _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 PineconeApiTypeError( - "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." - % (args, self.__class__.__name__), + "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__,), ) @@ -266,17 +268,13 @@ def __init__(self, *args, **kwargs) -> None: # noqa: E501 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 - ): + 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 PineconeApiAttributeError( - f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " - f"class with read only attributes." - ) + raise PineconeApiAttributeError(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/openapi/repository_data/model_utils.py b/pinecone/core/openapi/repository_data/model_utils.py new file mode 100644 index 00000000..bb2d2523 --- /dev/null +++ b/pinecone/core/openapi/repository_data/model_utils.py @@ -0,0 +1 @@ +# Deleted this file we are not using diff --git a/pinecone/core/openapi/repository_data/models/__init__.py b/pinecone/core/openapi/repository_data/models/__init__.py index 2615558e..0e7eccf0 100644 --- a/pinecone/core/openapi/repository_data/models/__init__.py +++ b/pinecone/core/openapi/repository_data/models/__init__.py @@ -9,18 +9,23 @@ # import sys # sys.setrecursionlimit(n) -from pinecone.core.openapi.repository_data.model.delete_document_response import ( - DeleteDocumentResponse, -) +from pinecone.core.openapi.repository_data.model.context_options_model import ContextOptionsModel +from pinecone.core.openapi.repository_data.model.delete_document_response import DeleteDocumentResponse from pinecone.core.openapi.repository_data.model.document import Document +from pinecone.core.openapi.repository_data.model.document_context_unit_model import DocumentContextUnitModel from pinecone.core.openapi.repository_data.model.document_list import DocumentList +from pinecone.core.openapi.repository_data.model.document_result_model import DocumentResultModel from pinecone.core.openapi.repository_data.model.get_document_response import GetDocumentResponse from pinecone.core.openapi.repository_data.model.lsn_status import LSNStatus -from pinecone.core.openapi.repository_data.model.list_documents_response import ( - ListDocumentsResponse, -) +from pinecone.core.openapi.repository_data.model.list_documents_response import ListDocumentsResponse +from pinecone.core.openapi.repository_data.model.matched_chunk_model import MatchedChunkModel +from pinecone.core.openapi.repository_data.model.options_model import OptionsModel from pinecone.core.openapi.repository_data.model.pagination_response import PaginationResponse -from pinecone.core.openapi.repository_data.model.upsert_document_response import ( - UpsertDocumentResponse, -) +from pinecone.core.openapi.repository_data.model.query_input_model import QueryInputModel +from pinecone.core.openapi.repository_data.model.query_input_model_one_of import QueryInputModelOneOf +from pinecone.core.openapi.repository_data.model.query_model import QueryModel +from pinecone.core.openapi.repository_data.model.search_documents import SearchDocuments +from pinecone.core.openapi.repository_data.model.search_documents_response import SearchDocumentsResponse +from pinecone.core.openapi.repository_data.model.upsert_document_request import UpsertDocumentRequest +from pinecone.core.openapi.repository_data.model.upsert_document_response import UpsertDocumentResponse from pinecone.core.openapi.repository_data.model.usage import Usage diff --git a/pinecone/core/openapi/repository_data/rest.py b/pinecone/core/openapi/repository_data/rest.py new file mode 100644 index 00000000..8cf9e891 --- /dev/null +++ b/pinecone/core/openapi/repository_data/rest.py @@ -0,0 +1 @@ +# Deleted diff --git a/pinecone/repository_data/dataclasses/__init__.py b/pinecone/repository_data/dataclasses/__init__.py new file mode 100644 index 00000000..4df4fc6a --- /dev/null +++ b/pinecone/repository_data/dataclasses/__init__.py @@ -0,0 +1,3 @@ +from .search_query import SearchQuery + +__all__ = ["SearchQuery"] diff --git a/pinecone/repository_data/dataclasses/search_query.py b/pinecone/repository_data/dataclasses/search_query.py new file mode 100644 index 00000000..663c967f --- /dev/null +++ b/pinecone/repository_data/dataclasses/search_query.py @@ -0,0 +1,34 @@ +from dataclasses import dataclass +from typing import Optional, Any, Dict + + +@dataclass +class SearchQuery: + """ + SearchQuery represents the query when searching within a specific namespace. + """ + + inputs: Dict[str, Any] + """ + The input data to search with. + Required. + """ + + top_k: int + """ + The number of results to return with each search. + Required. + """ + + filter: Optional[Dict[str, Any]] = None + """ + The filter to apply to the search. + Optional. + """ + + def as_dict(self) -> Dict[str, Any]: + """ + Returns the SearchQuery as a dictionary. + """ + d = {"inputs": self.inputs, "top_k": self.top_k, "filter": self.filter} + return {k: v for k, v in d.items() if v is not None} diff --git a/pinecone/repository_data/repository.py b/pinecone/repository_data/repository.py index f72f79b5..d763d110 100644 --- a/pinecone/repository_data/repository.py +++ b/pinecone/repository_data/repository.py @@ -9,6 +9,9 @@ from multiprocessing import cpu_count from pinecone.core.openapi.repository_data import API_VERSION from .models.document import Document +from .repository_search import RepositorySearch + +from pinecone.core.openapi.repository_data.models import SearchDocumentsResponse logger = logging.getLogger(__name__) @@ -97,6 +100,16 @@ def __init__( if additional_headers: self._default_headers.update(additional_headers) + # Search uses the OpenAPI client-based impl + self._search_client = RepositorySearch( + api_key=api_key, + host=host, + pool_threads=pool_threads, + additional_headers=additional_headers, + openapi_config=openapi_config, + **kwargs, + ) + # ----------------------- # Internal request helper # ----------------------- @@ -157,6 +170,16 @@ def _request( except json.JSONDecodeError: payload = None + if do_echo: + print("\n\n----- HTTP Response -----") + print(f"{resp.status_code} {resp.reason}") + print("Headers:", resp.headers) + if payload: + print("Body:", json.dumps(payload, indent=2)) + else: + print("Body: ") + print("------------------------") + if not (200 <= resp.status_code < 300): msg = payload.get("message") if isinstance(payload, dict) else resp.text raise HTTPError(resp.status_code, msg or "HTTP request failed", payload) @@ -233,3 +256,14 @@ def delete(self, namespace: str, document_id: str, **kwargs): """ path = f"/namespaces/{namespace}/documents/{document_id}" return self._request("DELETE", path, **kwargs) + + def search( + self, + namespace: str, + query_str: str, + top_k: Optional[int] = None, + filter: Optional[Dict[str, Any]] = None, + ) -> SearchDocumentsResponse: + return self._search_client.search( + namespace=namespace, query_str=query_str, top_k=top_k, filter=filter + ) diff --git a/pinecone/repository_data/repository_search.py b/pinecone/repository_data/repository_search.py new file mode 100644 index 00000000..f9c65d04 --- /dev/null +++ b/pinecone/repository_data/repository_search.py @@ -0,0 +1,123 @@ +import warnings +import logging +from typing import Optional, Dict, Any, TYPE_CHECKING + +from pinecone.config import ConfigBuilder + +from pinecone.openapi_support import ApiClient +from pinecone.core.openapi.repository_data.api.document_operations_api import DocumentOperationsApi +from pinecone.core.openapi.repository_data import API_VERSION +from pinecone.core.openapi.repository_data.models import SearchDocumentsResponse +from .request_factory import RepositoryRequestFactory +from ..utils import setup_openapi_client, validate_and_convert_errors, filter_dict +from pinecone.openapi_support import OPENAPI_ENDPOINT_PARAMS + +from multiprocessing import cpu_count + + +if TYPE_CHECKING: + from pinecone.config import Config, OpenApiConfiguration + + +logger = logging.getLogger(__name__) +""" :meta private: """ + + +class RepositorySearch: + """ + A client for interacting with a Pinecone Repository search endpoint. + """ + + def __init__( + self, + api_key: str, + host: str, + pool_threads: Optional[int] = None, + additional_headers: Optional[Dict[str, str]] = {}, + openapi_config=None, + **kwargs, + ): + self._config = ConfigBuilder.build( + api_key=api_key, host=host, additional_headers=additional_headers, **kwargs + ) + """ :meta private: """ + self._openapi_config = ConfigBuilder.build_openapi_config(self._config, openapi_config) + """ :meta private: """ + + if pool_threads is None: + self._pool_threads = 5 * cpu_count() + """ :meta private: """ + else: + self._pool_threads = pool_threads + """ :meta private: """ + + if kwargs.get("connection_pool_maxsize", None): + self._openapi_config.connection_pool_maxsize = kwargs.get("connection_pool_maxsize") + + self._repo_api = setup_openapi_client( + api_client_klass=ApiClient, + api_klass=DocumentOperationsApi, + config=self._config, + openapi_config=self._openapi_config, + pool_threads=self._pool_threads, + api_version=API_VERSION, + ) + + self._api_client = self._repo_api.api_client + + @property + def config(self) -> "Config": + """:meta private:""" + return self._config + + @property + def openapi_config(self) -> "OpenApiConfiguration": + """:meta private:""" + warnings.warn( + "The `openapi_config` property has been renamed to `_openapi_config`. It is considered private and should not be used directly. This warning will become an error in a future version of the Pinecone Python SDK.", + DeprecationWarning, + stacklevel=2, + ) + return self._openapi_config + + @property + def pool_threads(self) -> int: + """:meta private:""" + warnings.warn( + "The `pool_threads` property has been renamed to `_pool_threads`. It is considered private and should not be used directly. This warning will become an error in a future version of the Pinecone Python SDK.", + DeprecationWarning, + stacklevel=2, + ) + return self._pool_threads + + def _openapi_kwargs(self, kwargs: Dict[str, Any]) -> Dict[str, Any]: + return filter_dict(kwargs, OPENAPI_ENDPOINT_PARAMS) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self._repo_api.api_client.close() + + def close(self): + self._repo_api.api_client.close() + + @validate_and_convert_errors + def search( + self, + namespace: str, + query_str: str, + top_k: Optional[int] = 10, + filter: Optional[Dict[str, Any]] = None, + ) -> SearchDocumentsResponse: + if namespace is None: + raise Exception("Namespace is required when searching documents") + + if top_k is None: + top_k = 10 + + request = RepositoryRequestFactory.search_request( + query_str=query_str, top_k=top_k, filter=filter + ) + + return self._repo_api.search_documents(namespace, request) diff --git a/pinecone/repository_data/request_factory.py b/pinecone/repository_data/request_factory.py new file mode 100644 index 00000000..d1d21ae2 --- /dev/null +++ b/pinecone/repository_data/request_factory.py @@ -0,0 +1,32 @@ +import logging +from typing import Dict, Any, Optional + +from pinecone.core.openapi.repository_data.models import ( + QueryModel, + SearchDocuments, + QueryInputModel, +) + +from pinecone.openapi_support import OPENAPI_ENDPOINT_PARAMS + + +logger = logging.getLogger(__name__) +""" :meta private: """ + + +def non_openapi_kwargs(kwargs: Dict[str, Any]) -> Dict[str, Any]: + return {k: v for k, v in kwargs.items() if k not in OPENAPI_ENDPOINT_PARAMS} + + +class RepositoryRequestFactory: + @staticmethod + def search_request( + query_str: str, + top_k: int, + filter: Optional[Dict[str, Any]] = None, + # TODO, add options + ) -> SearchDocuments: + filter = {} if filter is None else filter + return SearchDocuments( + query=QueryModel(inputs=QueryInputModel(text=query_str), top_k=top_k, filter=filter) + ) diff --git a/pinecone/repository_data/types/__init__.py b/pinecone/repository_data/types/__init__.py new file mode 100644 index 00000000..05998ea0 --- /dev/null +++ b/pinecone/repository_data/types/__init__.py @@ -0,0 +1,3 @@ +from .search_query_typed_dict import SearchQueryTypedDict + +__all__ = ["SearchQueryTypedDict"] diff --git a/pinecone/repository_data/types/search_query_typed_dict.py b/pinecone/repository_data/types/search_query_typed_dict.py new file mode 100644 index 00000000..3c26a50a --- /dev/null +++ b/pinecone/repository_data/types/search_query_typed_dict.py @@ -0,0 +1,25 @@ +from typing import TypedDict, Optional, Dict, Any + + +class SearchQueryTypedDict(TypedDict): + """ + SearchQuery represents the query when searching within a specific namespace. + """ + + inputs: Dict[str, Any] + """ + The input data to search with. + Required. + """ + + top_k: int + """ + The number of results to return with each search. + Required. + """ + + filter: Optional[Dict[str, Any]] + """ + The filter to apply to the search. + Optional. + """