pinecone.data.index
1from tqdm.autonotebook import tqdm 2 3from typing import Union, List, Tuple, Optional, Dict, Any 4 5from pinecone.config import ConfigBuilder 6 7from pinecone.core.openapi.shared import API_VERSION 8from pinecone.core.openapi.data.models import SparseValues 9from pinecone.core.openapi.data import ApiClient 10from pinecone.core.openapi.data.models import ( 11 FetchResponse, 12 QueryRequest, 13 QueryResponse, 14 RpcStatus, 15 ScoredVector, 16 SingleQueryResults, 17 DescribeIndexStatsResponse, 18 UpsertRequest, 19 UpsertResponse, 20 UpdateRequest, 21 Vector, 22 DeleteRequest, 23 UpdateRequest, 24 DescribeIndexStatsRequest, 25 ListResponse, 26) 27from .features.bulk_import import ImportFeatureMixin 28from pinecone.core.openapi.data.api.data_plane_api import DataPlaneApi 29from ..utils import setup_openapi_client, parse_non_empty_args 30from .vector_factory import VectorFactory 31 32__all__ = [ 33 "Index", 34 "FetchResponse", 35 "QueryRequest", 36 "QueryResponse", 37 "RpcStatus", 38 "ScoredVector", 39 "SingleQueryResults", 40 "DescribeIndexStatsResponse", 41 "UpsertRequest", 42 "UpsertResponse", 43 "UpdateRequest", 44 "Vector", 45 "DeleteRequest", 46 "UpdateRequest", 47 "DescribeIndexStatsRequest", 48 "SparseValues", 49] 50 51from ..utils.error_handling import validate_and_convert_errors 52 53_OPENAPI_ENDPOINT_PARAMS = ( 54 "_return_http_data_only", 55 "_preload_content", 56 "_request_timeout", 57 "_check_input_type", 58 "_check_return_type", 59 "_host_index", 60 "async_req", 61) 62 63 64def parse_query_response(response: QueryResponse): 65 response._data_store.pop("results", None) 66 return response 67 68 69class Index(ImportFeatureMixin): 70 """ 71 A client for interacting with a Pinecone index via REST API. 72 For improved performance, use the Pinecone GRPC index client. 73 """ 74 75 def __init__( 76 self, 77 api_key: str, 78 host: str, 79 pool_threads: Optional[int] = 1, 80 additional_headers: Optional[Dict[str, str]] = {}, 81 openapi_config=None, 82 **kwargs, 83 ): 84 super().__init__( 85 api_key=api_key, 86 host=host, 87 pool_threads=pool_threads, 88 additional_headers=additional_headers, 89 openapi_config=openapi_config, 90 **kwargs, 91 ) 92 93 self._config = ConfigBuilder.build( 94 api_key=api_key, 95 host=host, 96 additional_headers=additional_headers, 97 **kwargs, 98 ) 99 openapi_config = ConfigBuilder.build_openapi_config(self._config, openapi_config) 100 101 self._vector_api = setup_openapi_client( 102 api_client_klass=ApiClient, 103 api_klass=DataPlaneApi, 104 config=self._config, 105 openapi_config=openapi_config, 106 pool_threads=pool_threads, 107 api_version=API_VERSION, 108 ) 109 110 def __enter__(self): 111 return self 112 113 def __exit__(self, exc_type, exc_value, traceback): 114 self._vector_api.api_client.close() 115 116 @validate_and_convert_errors 117 def upsert( 118 self, 119 vectors: Union[List[Vector], List[tuple], List[dict]], 120 namespace: Optional[str] = None, 121 batch_size: Optional[int] = None, 122 show_progress: bool = True, 123 **kwargs, 124 ) -> UpsertResponse: 125 """ 126 The upsert operation writes vectors into a namespace. 127 If a new value is upserted for an existing vector id, it will overwrite the previous value. 128 129 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 130 131 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 132 133 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 134 where id is a string, vector is a list of floats, metadata is a dict, 135 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 136 137 Examples: 138 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 139 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 140 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 141 142 If a Vector object is used, a Vector object must be of the form 143 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 144 arguments. 145 146 Examples: 147 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 148 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 149 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 150 151 **Note:** the dimension of each vector must match the dimension of the index. 152 153 If a dictionary is used, it must be in the form `{'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, 'metadata': dict}` 154 155 Examples: 156 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 157 >>> 158 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 159 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 160 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 161 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 162 163 API reference: https://docs.pinecone.io/reference/upsert 164 165 Args: 166 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 167 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 168 batch_size (int): The number of vectors to upsert in each batch. 169 If not specified, all vectors will be upserted in a single batch. [optional] 170 show_progress (bool): Whether to show a progress bar using tqdm. 171 Applied only if batch_size is provided. Default is True. 172 Keyword Args: 173 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 174 175 Returns: UpsertResponse, includes the number of vectors upserted. 176 """ 177 _check_type = kwargs.pop("_check_type", True) 178 179 if kwargs.get("async_req", False) and batch_size is not None: 180 raise ValueError( 181 "async_req is not supported when batch_size is provided." 182 "To upsert in parallel, please follow: " 183 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 184 ) 185 186 if batch_size is None: 187 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 188 189 if not isinstance(batch_size, int) or batch_size <= 0: 190 raise ValueError("batch_size must be a positive integer") 191 192 pbar = tqdm( 193 total=len(vectors), 194 disable=not show_progress, 195 desc="Upserted vectors", 196 ) 197 total_upserted = 0 198 for i in range(0, len(vectors), batch_size): 199 batch_result = self._upsert_batch(vectors[i : i + batch_size], namespace, _check_type, **kwargs) 200 pbar.update(batch_result.upserted_count) 201 # we can't use here pbar.n for the case show_progress=False 202 total_upserted += batch_result.upserted_count 203 204 return UpsertResponse(upserted_count=total_upserted) 205 206 def _upsert_batch( 207 self, 208 vectors: Union[List[Vector], List[tuple], List[dict]], 209 namespace: Optional[str], 210 _check_type: bool, 211 **kwargs, 212 ) -> UpsertResponse: 213 args_dict = parse_non_empty_args([("namespace", namespace)]) 214 vec_builder = lambda v: VectorFactory.build(v, check_type=_check_type) 215 216 return self._vector_api.upsert( 217 UpsertRequest( 218 vectors=list(map(vec_builder, vectors)), 219 **args_dict, 220 _check_type=_check_type, 221 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 222 ), 223 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 224 ) 225 226 @staticmethod 227 def _iter_dataframe(df, batch_size): 228 for i in range(0, len(df), batch_size): 229 batch = df.iloc[i : i + batch_size].to_dict(orient="records") 230 yield batch 231 232 def upsert_from_dataframe( 233 self, 234 df, 235 namespace: Optional[str] = None, 236 batch_size: int = 500, 237 show_progress: bool = True, 238 ) -> UpsertResponse: 239 """Upserts a dataframe into the index. 240 241 Args: 242 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 243 namespace: The namespace to upsert into. 244 batch_size: The number of rows to upsert in a single batch. 245 show_progress: Whether to show a progress bar. 246 """ 247 try: 248 import pandas as pd 249 except ImportError: 250 raise RuntimeError( 251 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 252 ) 253 254 if not isinstance(df, pd.DataFrame): 255 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 256 257 pbar = tqdm( 258 total=len(df), 259 disable=not show_progress, 260 desc="sending upsert requests", 261 ) 262 results = [] 263 for chunk in self._iter_dataframe(df, batch_size=batch_size): 264 res = self.upsert(vectors=chunk, namespace=namespace) 265 pbar.update(len(chunk)) 266 results.append(res) 267 268 upserted_count = 0 269 for res in results: 270 upserted_count += res.upserted_count 271 272 return UpsertResponse(upserted_count=upserted_count) 273 274 @validate_and_convert_errors 275 def delete( 276 self, 277 ids: Optional[List[str]] = None, 278 delete_all: Optional[bool] = None, 279 namespace: Optional[str] = None, 280 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 281 **kwargs, 282 ) -> Dict[str, Any]: 283 """ 284 The Delete operation deletes vectors from the index, from a single namespace. 285 No error raised if the vector id does not exist. 286 Note: for any delete call, if namespace is not specified, the default namespace is used. 287 288 Delete can occur in the following mutual exclusive ways: 289 1. Delete by ids from a single namespace 290 2. Delete all vectors from a single namespace by setting delete_all to True 291 3. Delete all vectors from a single namespace by specifying a metadata filter 292 (note that for this option delete all must be set to False) 293 294 API reference: https://docs.pinecone.io/reference/delete_post 295 296 Examples: 297 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 298 >>> index.delete(delete_all=True, namespace='my_namespace') 299 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 300 301 Args: 302 ids (List[str]): Vector ids to delete [optional] 303 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 304 Default is False. 305 namespace (str): The namespace to delete vectors from [optional] 306 If not specified, the default namespace is used. 307 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 308 If specified, the metadata filter here will be used to select the vectors to delete. 309 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 310 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 311 312 Keyword Args: 313 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 314 315 316 Returns: An empty dictionary if the delete operation was successful. 317 """ 318 _check_type = kwargs.pop("_check_type", False) 319 args_dict = parse_non_empty_args( 320 [ 321 ("ids", ids), 322 ("delete_all", delete_all), 323 ("namespace", namespace), 324 ("filter", filter), 325 ] 326 ) 327 328 return self._vector_api.delete( 329 DeleteRequest( 330 **args_dict, 331 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None}, 332 _check_type=_check_type, 333 ), 334 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 335 ) 336 337 @validate_and_convert_errors 338 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 339 """ 340 The fetch operation looks up and returns vectors, by ID, from a single namespace. 341 The returned vectors include the vector data and/or metadata. 342 343 API reference: https://docs.pinecone.io/reference/fetch 344 345 Examples: 346 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 347 >>> index.fetch(ids=['id1', 'id2']) 348 349 Args: 350 ids (List[str]): The vector IDs to fetch. 351 namespace (str): The namespace to fetch vectors from. 352 If not specified, the default namespace is used. [optional] 353 Keyword Args: 354 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 355 356 357 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 358 """ 359 args_dict = parse_non_empty_args([("namespace", namespace)]) 360 return self._vector_api.fetch(ids=ids, **args_dict, **kwargs) 361 362 @validate_and_convert_errors 363 def query( 364 self, 365 *args, 366 top_k: int, 367 vector: Optional[List[float]] = None, 368 id: Optional[str] = None, 369 namespace: Optional[str] = None, 370 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 371 include_values: Optional[bool] = None, 372 include_metadata: Optional[bool] = None, 373 sparse_vector: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 374 **kwargs, 375 ) -> QueryResponse: 376 """ 377 The Query operation searches a namespace, using a query vector. 378 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 379 380 API reference: https://docs.pinecone.io/reference/query 381 382 Examples: 383 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 384 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 385 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 386 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 387 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 388 >>> top_k=10, namespace='my_namespace') 389 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 390 >>> top_k=10, namespace='my_namespace') 391 392 Args: 393 vector (List[float]): The query vector. This should be the same length as the dimension of the index 394 being queried. Each `query()` request can contain only one of the parameters 395 `id` or `vector`.. [optional] 396 id (str): The unique ID of the vector to be used as a query vector. 397 Each `query()` request can contain only one of the parameters 398 `vector` or `id`. [optional] 399 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 400 namespace (str): The namespace to fetch vectors from. 401 If not specified, the default namespace is used. [optional] 402 filter (Dict[str, Union[str, float, int, bool, List, dict]): 403 The filter to apply. You can use vector metadata to limit your search. 404 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 405 include_values (bool): Indicates whether vector values are included in the response. 406 If omitted the server will use the default value of False [optional] 407 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 408 If omitted the server will use the default value of False [optional] 409 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 410 Expected to be either a SparseValues object or a dict of the form: 411 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 412 413 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 414 and namespace name. 415 """ 416 417 if len(args) > 0: 418 raise ValueError( 419 "The argument order for `query()` has changed; please use keyword arguments instead of positional arguments. Example: index.query(vector=[0.1, 0.2, 0.3], top_k=10, namespace='my_namespace')" 420 ) 421 422 if vector is not None and id is not None: 423 raise ValueError("Cannot specify both `id` and `vector`") 424 425 _check_type = kwargs.pop("_check_type", False) 426 427 sparse_vector = self._parse_sparse_values_arg(sparse_vector) 428 args_dict = parse_non_empty_args( 429 [ 430 ("vector", vector), 431 ("id", id), 432 ("queries", None), 433 ("top_k", top_k), 434 ("namespace", namespace), 435 ("filter", filter), 436 ("include_values", include_values), 437 ("include_metadata", include_metadata), 438 ("sparse_vector", sparse_vector), 439 ] 440 ) 441 response = self._vector_api.query( 442 QueryRequest( 443 **args_dict, 444 _check_type=_check_type, 445 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 446 ), 447 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 448 ) 449 return parse_query_response(response) 450 451 @validate_and_convert_errors 452 def update( 453 self, 454 id: str, 455 values: Optional[List[float]] = None, 456 set_metadata: Optional[ 457 Dict[ 458 str, 459 Union[str, float, int, bool, List[int], List[float], List[str]], 460 ] 461 ] = None, 462 namespace: Optional[str] = None, 463 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 464 **kwargs, 465 ) -> Dict[str, Any]: 466 """ 467 The Update operation updates vector in a namespace. 468 If a value is included, it will overwrite the previous value. 469 If a set_metadata is included, 470 the values of the fields specified in it will be added or overwrite the previous value. 471 472 API reference: https://docs.pinecone.io/reference/update 473 474 Examples: 475 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 476 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 477 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 478 >>> namespace='my_namespace') 479 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 480 >>> namespace='my_namespace') 481 482 Args: 483 id (str): Vector's unique id. 484 values (List[float]): vector values to set. [optional] 485 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 486 metadata to set for vector. [optional] 487 namespace (str): Namespace name where to update the vector.. [optional] 488 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 489 Expected to be either a SparseValues object or a dict of the form: 490 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 491 492 Keyword Args: 493 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 494 495 Returns: An empty dictionary if the update was successful. 496 """ 497 _check_type = kwargs.pop("_check_type", False) 498 sparse_values = self._parse_sparse_values_arg(sparse_values) 499 args_dict = parse_non_empty_args( 500 [ 501 ("values", values), 502 ("set_metadata", set_metadata), 503 ("namespace", namespace), 504 ("sparse_values", sparse_values), 505 ] 506 ) 507 return self._vector_api.update( 508 UpdateRequest( 509 id=id, 510 **args_dict, 511 _check_type=_check_type, 512 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 513 ), 514 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 515 ) 516 517 @validate_and_convert_errors 518 def describe_index_stats( 519 self, 520 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 521 **kwargs, 522 ) -> DescribeIndexStatsResponse: 523 """ 524 The DescribeIndexStats operation returns statistics about the index's contents. 525 For example: The vector count per namespace and the number of dimensions. 526 527 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 528 529 Examples: 530 >>> index.describe_index_stats() 531 >>> index.describe_index_stats(filter={'key': 'value'}) 532 533 Args: 534 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 535 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 536 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 537 538 Returns: DescribeIndexStatsResponse object which contains stats about the index. 539 """ 540 _check_type = kwargs.pop("_check_type", False) 541 args_dict = parse_non_empty_args([("filter", filter)]) 542 543 return self._vector_api.describe_index_stats( 544 DescribeIndexStatsRequest( 545 **args_dict, 546 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 547 _check_type=_check_type, 548 ), 549 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 550 ) 551 552 @validate_and_convert_errors 553 def list_paginated( 554 self, 555 prefix: Optional[str] = None, 556 limit: Optional[int] = None, 557 pagination_token: Optional[str] = None, 558 namespace: Optional[str] = None, 559 **kwargs, 560 ) -> ListResponse: 561 """ 562 The list_paginated operation finds vectors based on an id prefix within a single namespace. 563 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 564 This id list can then be passed to fetch or delete operations, depending on your use case. 565 566 Consider using the `list` method to avoid having to handle pagination tokens manually. 567 568 Examples: 569 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 570 >>> [v.id for v in results.vectors] 571 ['99', '990', '991', '992', '993'] 572 >>> results.pagination.next 573 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 574 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 575 576 Args: 577 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 578 be used with the effect of listing all ids in a namespace [optional] 579 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 580 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 581 in the response if additional results are available. [optional] 582 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 583 584 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 585 """ 586 args_dict = parse_non_empty_args( 587 [ 588 ("prefix", prefix), 589 ("limit", limit), 590 ("namespace", namespace), 591 ("pagination_token", pagination_token), 592 ] 593 ) 594 return self._vector_api.list(**args_dict, **kwargs) 595 596 @validate_and_convert_errors 597 def list(self, **kwargs): 598 """ 599 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 600 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 601 behalf. 602 603 Examples: 604 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 605 >>> print(ids) 606 ['99', '990', '991', '992', '993'] 607 ['994', '995', '996', '997', '998'] 608 ['999'] 609 610 Args: 611 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 612 be used with the effect of listing all ids in a namespace [optional] 613 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 614 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 615 in the response if additional results are available. [optional] 616 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 617 """ 618 done = False 619 while not done: 620 results = self.list_paginated(**kwargs) 621 if len(results.vectors) > 0: 622 yield [v.id for v in results.vectors] 623 624 if results.pagination: 625 kwargs.update({"pagination_token": results.pagination.next}) 626 else: 627 done = True 628 629 @staticmethod 630 def _parse_sparse_values_arg( 631 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] 632 ) -> Optional[SparseValues]: 633 if sparse_values is None: 634 return None 635 636 if isinstance(sparse_values, SparseValues): 637 return sparse_values 638 639 if not isinstance(sparse_values, dict) or "indices" not in sparse_values or "values" not in sparse_values: 640 raise ValueError( 641 "Invalid sparse values argument. Expected a dict of: {'indices': List[int], 'values': List[float]}." 642 f"Received: {sparse_values}" 643 ) 644 645 return SparseValues(indices=sparse_values["indices"], values=sparse_values["values"])
70class Index(ImportFeatureMixin): 71 """ 72 A client for interacting with a Pinecone index via REST API. 73 For improved performance, use the Pinecone GRPC index client. 74 """ 75 76 def __init__( 77 self, 78 api_key: str, 79 host: str, 80 pool_threads: Optional[int] = 1, 81 additional_headers: Optional[Dict[str, str]] = {}, 82 openapi_config=None, 83 **kwargs, 84 ): 85 super().__init__( 86 api_key=api_key, 87 host=host, 88 pool_threads=pool_threads, 89 additional_headers=additional_headers, 90 openapi_config=openapi_config, 91 **kwargs, 92 ) 93 94 self._config = ConfigBuilder.build( 95 api_key=api_key, 96 host=host, 97 additional_headers=additional_headers, 98 **kwargs, 99 ) 100 openapi_config = ConfigBuilder.build_openapi_config(self._config, openapi_config) 101 102 self._vector_api = setup_openapi_client( 103 api_client_klass=ApiClient, 104 api_klass=DataPlaneApi, 105 config=self._config, 106 openapi_config=openapi_config, 107 pool_threads=pool_threads, 108 api_version=API_VERSION, 109 ) 110 111 def __enter__(self): 112 return self 113 114 def __exit__(self, exc_type, exc_value, traceback): 115 self._vector_api.api_client.close() 116 117 @validate_and_convert_errors 118 def upsert( 119 self, 120 vectors: Union[List[Vector], List[tuple], List[dict]], 121 namespace: Optional[str] = None, 122 batch_size: Optional[int] = None, 123 show_progress: bool = True, 124 **kwargs, 125 ) -> UpsertResponse: 126 """ 127 The upsert operation writes vectors into a namespace. 128 If a new value is upserted for an existing vector id, it will overwrite the previous value. 129 130 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 131 132 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 133 134 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 135 where id is a string, vector is a list of floats, metadata is a dict, 136 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 137 138 Examples: 139 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 140 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 141 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 142 143 If a Vector object is used, a Vector object must be of the form 144 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 145 arguments. 146 147 Examples: 148 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 149 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 150 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 151 152 **Note:** the dimension of each vector must match the dimension of the index. 153 154 If a dictionary is used, it must be in the form `{'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, 'metadata': dict}` 155 156 Examples: 157 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 158 >>> 159 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 160 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 161 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 162 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 163 164 API reference: https://docs.pinecone.io/reference/upsert 165 166 Args: 167 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 168 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 169 batch_size (int): The number of vectors to upsert in each batch. 170 If not specified, all vectors will be upserted in a single batch. [optional] 171 show_progress (bool): Whether to show a progress bar using tqdm. 172 Applied only if batch_size is provided. Default is True. 173 Keyword Args: 174 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 175 176 Returns: UpsertResponse, includes the number of vectors upserted. 177 """ 178 _check_type = kwargs.pop("_check_type", True) 179 180 if kwargs.get("async_req", False) and batch_size is not None: 181 raise ValueError( 182 "async_req is not supported when batch_size is provided." 183 "To upsert in parallel, please follow: " 184 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 185 ) 186 187 if batch_size is None: 188 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 189 190 if not isinstance(batch_size, int) or batch_size <= 0: 191 raise ValueError("batch_size must be a positive integer") 192 193 pbar = tqdm( 194 total=len(vectors), 195 disable=not show_progress, 196 desc="Upserted vectors", 197 ) 198 total_upserted = 0 199 for i in range(0, len(vectors), batch_size): 200 batch_result = self._upsert_batch(vectors[i : i + batch_size], namespace, _check_type, **kwargs) 201 pbar.update(batch_result.upserted_count) 202 # we can't use here pbar.n for the case show_progress=False 203 total_upserted += batch_result.upserted_count 204 205 return UpsertResponse(upserted_count=total_upserted) 206 207 def _upsert_batch( 208 self, 209 vectors: Union[List[Vector], List[tuple], List[dict]], 210 namespace: Optional[str], 211 _check_type: bool, 212 **kwargs, 213 ) -> UpsertResponse: 214 args_dict = parse_non_empty_args([("namespace", namespace)]) 215 vec_builder = lambda v: VectorFactory.build(v, check_type=_check_type) 216 217 return self._vector_api.upsert( 218 UpsertRequest( 219 vectors=list(map(vec_builder, vectors)), 220 **args_dict, 221 _check_type=_check_type, 222 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 223 ), 224 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 225 ) 226 227 @staticmethod 228 def _iter_dataframe(df, batch_size): 229 for i in range(0, len(df), batch_size): 230 batch = df.iloc[i : i + batch_size].to_dict(orient="records") 231 yield batch 232 233 def upsert_from_dataframe( 234 self, 235 df, 236 namespace: Optional[str] = None, 237 batch_size: int = 500, 238 show_progress: bool = True, 239 ) -> UpsertResponse: 240 """Upserts a dataframe into the index. 241 242 Args: 243 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 244 namespace: The namespace to upsert into. 245 batch_size: The number of rows to upsert in a single batch. 246 show_progress: Whether to show a progress bar. 247 """ 248 try: 249 import pandas as pd 250 except ImportError: 251 raise RuntimeError( 252 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 253 ) 254 255 if not isinstance(df, pd.DataFrame): 256 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 257 258 pbar = tqdm( 259 total=len(df), 260 disable=not show_progress, 261 desc="sending upsert requests", 262 ) 263 results = [] 264 for chunk in self._iter_dataframe(df, batch_size=batch_size): 265 res = self.upsert(vectors=chunk, namespace=namespace) 266 pbar.update(len(chunk)) 267 results.append(res) 268 269 upserted_count = 0 270 for res in results: 271 upserted_count += res.upserted_count 272 273 return UpsertResponse(upserted_count=upserted_count) 274 275 @validate_and_convert_errors 276 def delete( 277 self, 278 ids: Optional[List[str]] = None, 279 delete_all: Optional[bool] = None, 280 namespace: Optional[str] = None, 281 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 282 **kwargs, 283 ) -> Dict[str, Any]: 284 """ 285 The Delete operation deletes vectors from the index, from a single namespace. 286 No error raised if the vector id does not exist. 287 Note: for any delete call, if namespace is not specified, the default namespace is used. 288 289 Delete can occur in the following mutual exclusive ways: 290 1. Delete by ids from a single namespace 291 2. Delete all vectors from a single namespace by setting delete_all to True 292 3. Delete all vectors from a single namespace by specifying a metadata filter 293 (note that for this option delete all must be set to False) 294 295 API reference: https://docs.pinecone.io/reference/delete_post 296 297 Examples: 298 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 299 >>> index.delete(delete_all=True, namespace='my_namespace') 300 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 301 302 Args: 303 ids (List[str]): Vector ids to delete [optional] 304 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 305 Default is False. 306 namespace (str): The namespace to delete vectors from [optional] 307 If not specified, the default namespace is used. 308 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 309 If specified, the metadata filter here will be used to select the vectors to delete. 310 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 311 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 312 313 Keyword Args: 314 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 315 316 317 Returns: An empty dictionary if the delete operation was successful. 318 """ 319 _check_type = kwargs.pop("_check_type", False) 320 args_dict = parse_non_empty_args( 321 [ 322 ("ids", ids), 323 ("delete_all", delete_all), 324 ("namespace", namespace), 325 ("filter", filter), 326 ] 327 ) 328 329 return self._vector_api.delete( 330 DeleteRequest( 331 **args_dict, 332 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None}, 333 _check_type=_check_type, 334 ), 335 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 336 ) 337 338 @validate_and_convert_errors 339 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 340 """ 341 The fetch operation looks up and returns vectors, by ID, from a single namespace. 342 The returned vectors include the vector data and/or metadata. 343 344 API reference: https://docs.pinecone.io/reference/fetch 345 346 Examples: 347 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 348 >>> index.fetch(ids=['id1', 'id2']) 349 350 Args: 351 ids (List[str]): The vector IDs to fetch. 352 namespace (str): The namespace to fetch vectors from. 353 If not specified, the default namespace is used. [optional] 354 Keyword Args: 355 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 356 357 358 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 359 """ 360 args_dict = parse_non_empty_args([("namespace", namespace)]) 361 return self._vector_api.fetch(ids=ids, **args_dict, **kwargs) 362 363 @validate_and_convert_errors 364 def query( 365 self, 366 *args, 367 top_k: int, 368 vector: Optional[List[float]] = None, 369 id: Optional[str] = None, 370 namespace: Optional[str] = None, 371 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 372 include_values: Optional[bool] = None, 373 include_metadata: Optional[bool] = None, 374 sparse_vector: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 375 **kwargs, 376 ) -> QueryResponse: 377 """ 378 The Query operation searches a namespace, using a query vector. 379 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 380 381 API reference: https://docs.pinecone.io/reference/query 382 383 Examples: 384 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 385 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 386 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 387 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 388 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 389 >>> top_k=10, namespace='my_namespace') 390 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 391 >>> top_k=10, namespace='my_namespace') 392 393 Args: 394 vector (List[float]): The query vector. This should be the same length as the dimension of the index 395 being queried. Each `query()` request can contain only one of the parameters 396 `id` or `vector`.. [optional] 397 id (str): The unique ID of the vector to be used as a query vector. 398 Each `query()` request can contain only one of the parameters 399 `vector` or `id`. [optional] 400 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 401 namespace (str): The namespace to fetch vectors from. 402 If not specified, the default namespace is used. [optional] 403 filter (Dict[str, Union[str, float, int, bool, List, dict]): 404 The filter to apply. You can use vector metadata to limit your search. 405 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 406 include_values (bool): Indicates whether vector values are included in the response. 407 If omitted the server will use the default value of False [optional] 408 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 409 If omitted the server will use the default value of False [optional] 410 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 411 Expected to be either a SparseValues object or a dict of the form: 412 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 413 414 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 415 and namespace name. 416 """ 417 418 if len(args) > 0: 419 raise ValueError( 420 "The argument order for `query()` has changed; please use keyword arguments instead of positional arguments. Example: index.query(vector=[0.1, 0.2, 0.3], top_k=10, namespace='my_namespace')" 421 ) 422 423 if vector is not None and id is not None: 424 raise ValueError("Cannot specify both `id` and `vector`") 425 426 _check_type = kwargs.pop("_check_type", False) 427 428 sparse_vector = self._parse_sparse_values_arg(sparse_vector) 429 args_dict = parse_non_empty_args( 430 [ 431 ("vector", vector), 432 ("id", id), 433 ("queries", None), 434 ("top_k", top_k), 435 ("namespace", namespace), 436 ("filter", filter), 437 ("include_values", include_values), 438 ("include_metadata", include_metadata), 439 ("sparse_vector", sparse_vector), 440 ] 441 ) 442 response = self._vector_api.query( 443 QueryRequest( 444 **args_dict, 445 _check_type=_check_type, 446 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 447 ), 448 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 449 ) 450 return parse_query_response(response) 451 452 @validate_and_convert_errors 453 def update( 454 self, 455 id: str, 456 values: Optional[List[float]] = None, 457 set_metadata: Optional[ 458 Dict[ 459 str, 460 Union[str, float, int, bool, List[int], List[float], List[str]], 461 ] 462 ] = None, 463 namespace: Optional[str] = None, 464 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 465 **kwargs, 466 ) -> Dict[str, Any]: 467 """ 468 The Update operation updates vector in a namespace. 469 If a value is included, it will overwrite the previous value. 470 If a set_metadata is included, 471 the values of the fields specified in it will be added or overwrite the previous value. 472 473 API reference: https://docs.pinecone.io/reference/update 474 475 Examples: 476 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 477 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 478 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 479 >>> namespace='my_namespace') 480 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 481 >>> namespace='my_namespace') 482 483 Args: 484 id (str): Vector's unique id. 485 values (List[float]): vector values to set. [optional] 486 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 487 metadata to set for vector. [optional] 488 namespace (str): Namespace name where to update the vector.. [optional] 489 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 490 Expected to be either a SparseValues object or a dict of the form: 491 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 492 493 Keyword Args: 494 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 495 496 Returns: An empty dictionary if the update was successful. 497 """ 498 _check_type = kwargs.pop("_check_type", False) 499 sparse_values = self._parse_sparse_values_arg(sparse_values) 500 args_dict = parse_non_empty_args( 501 [ 502 ("values", values), 503 ("set_metadata", set_metadata), 504 ("namespace", namespace), 505 ("sparse_values", sparse_values), 506 ] 507 ) 508 return self._vector_api.update( 509 UpdateRequest( 510 id=id, 511 **args_dict, 512 _check_type=_check_type, 513 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 514 ), 515 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 516 ) 517 518 @validate_and_convert_errors 519 def describe_index_stats( 520 self, 521 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 522 **kwargs, 523 ) -> DescribeIndexStatsResponse: 524 """ 525 The DescribeIndexStats operation returns statistics about the index's contents. 526 For example: The vector count per namespace and the number of dimensions. 527 528 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 529 530 Examples: 531 >>> index.describe_index_stats() 532 >>> index.describe_index_stats(filter={'key': 'value'}) 533 534 Args: 535 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 536 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 537 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 538 539 Returns: DescribeIndexStatsResponse object which contains stats about the index. 540 """ 541 _check_type = kwargs.pop("_check_type", False) 542 args_dict = parse_non_empty_args([("filter", filter)]) 543 544 return self._vector_api.describe_index_stats( 545 DescribeIndexStatsRequest( 546 **args_dict, 547 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 548 _check_type=_check_type, 549 ), 550 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 551 ) 552 553 @validate_and_convert_errors 554 def list_paginated( 555 self, 556 prefix: Optional[str] = None, 557 limit: Optional[int] = None, 558 pagination_token: Optional[str] = None, 559 namespace: Optional[str] = None, 560 **kwargs, 561 ) -> ListResponse: 562 """ 563 The list_paginated operation finds vectors based on an id prefix within a single namespace. 564 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 565 This id list can then be passed to fetch or delete operations, depending on your use case. 566 567 Consider using the `list` method to avoid having to handle pagination tokens manually. 568 569 Examples: 570 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 571 >>> [v.id for v in results.vectors] 572 ['99', '990', '991', '992', '993'] 573 >>> results.pagination.next 574 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 575 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 576 577 Args: 578 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 579 be used with the effect of listing all ids in a namespace [optional] 580 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 581 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 582 in the response if additional results are available. [optional] 583 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 584 585 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 586 """ 587 args_dict = parse_non_empty_args( 588 [ 589 ("prefix", prefix), 590 ("limit", limit), 591 ("namespace", namespace), 592 ("pagination_token", pagination_token), 593 ] 594 ) 595 return self._vector_api.list(**args_dict, **kwargs) 596 597 @validate_and_convert_errors 598 def list(self, **kwargs): 599 """ 600 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 601 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 602 behalf. 603 604 Examples: 605 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 606 >>> print(ids) 607 ['99', '990', '991', '992', '993'] 608 ['994', '995', '996', '997', '998'] 609 ['999'] 610 611 Args: 612 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 613 be used with the effect of listing all ids in a namespace [optional] 614 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 615 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 616 in the response if additional results are available. [optional] 617 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 618 """ 619 done = False 620 while not done: 621 results = self.list_paginated(**kwargs) 622 if len(results.vectors) > 0: 623 yield [v.id for v in results.vectors] 624 625 if results.pagination: 626 kwargs.update({"pagination_token": results.pagination.next}) 627 else: 628 done = True 629 630 @staticmethod 631 def _parse_sparse_values_arg( 632 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] 633 ) -> Optional[SparseValues]: 634 if sparse_values is None: 635 return None 636 637 if isinstance(sparse_values, SparseValues): 638 return sparse_values 639 640 if not isinstance(sparse_values, dict) or "indices" not in sparse_values or "values" not in sparse_values: 641 raise ValueError( 642 "Invalid sparse values argument. Expected a dict of: {'indices': List[int], 'values': List[float]}." 643 f"Received: {sparse_values}" 644 ) 645 646 return SparseValues(indices=sparse_values["indices"], values=sparse_values["values"])
A client for interacting with a Pinecone index via REST API. For improved performance, use the Pinecone GRPC index client.
76 def __init__( 77 self, 78 api_key: str, 79 host: str, 80 pool_threads: Optional[int] = 1, 81 additional_headers: Optional[Dict[str, str]] = {}, 82 openapi_config=None, 83 **kwargs, 84 ): 85 super().__init__( 86 api_key=api_key, 87 host=host, 88 pool_threads=pool_threads, 89 additional_headers=additional_headers, 90 openapi_config=openapi_config, 91 **kwargs, 92 ) 93 94 self._config = ConfigBuilder.build( 95 api_key=api_key, 96 host=host, 97 additional_headers=additional_headers, 98 **kwargs, 99 ) 100 openapi_config = ConfigBuilder.build_openapi_config(self._config, openapi_config) 101 102 self._vector_api = setup_openapi_client( 103 api_client_klass=ApiClient, 104 api_klass=DataPlaneApi, 105 config=self._config, 106 openapi_config=openapi_config, 107 pool_threads=pool_threads, 108 api_version=API_VERSION, 109 )
117 @validate_and_convert_errors 118 def upsert( 119 self, 120 vectors: Union[List[Vector], List[tuple], List[dict]], 121 namespace: Optional[str] = None, 122 batch_size: Optional[int] = None, 123 show_progress: bool = True, 124 **kwargs, 125 ) -> UpsertResponse: 126 """ 127 The upsert operation writes vectors into a namespace. 128 If a new value is upserted for an existing vector id, it will overwrite the previous value. 129 130 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 131 132 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 133 134 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 135 where id is a string, vector is a list of floats, metadata is a dict, 136 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 137 138 Examples: 139 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 140 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 141 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 142 143 If a Vector object is used, a Vector object must be of the form 144 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 145 arguments. 146 147 Examples: 148 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 149 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 150 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 151 152 **Note:** the dimension of each vector must match the dimension of the index. 153 154 If a dictionary is used, it must be in the form `{'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, 'metadata': dict}` 155 156 Examples: 157 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 158 >>> 159 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 160 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 161 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 162 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 163 164 API reference: https://docs.pinecone.io/reference/upsert 165 166 Args: 167 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 168 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 169 batch_size (int): The number of vectors to upsert in each batch. 170 If not specified, all vectors will be upserted in a single batch. [optional] 171 show_progress (bool): Whether to show a progress bar using tqdm. 172 Applied only if batch_size is provided. Default is True. 173 Keyword Args: 174 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 175 176 Returns: UpsertResponse, includes the number of vectors upserted. 177 """ 178 _check_type = kwargs.pop("_check_type", True) 179 180 if kwargs.get("async_req", False) and batch_size is not None: 181 raise ValueError( 182 "async_req is not supported when batch_size is provided." 183 "To upsert in parallel, please follow: " 184 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 185 ) 186 187 if batch_size is None: 188 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 189 190 if not isinstance(batch_size, int) or batch_size <= 0: 191 raise ValueError("batch_size must be a positive integer") 192 193 pbar = tqdm( 194 total=len(vectors), 195 disable=not show_progress, 196 desc="Upserted vectors", 197 ) 198 total_upserted = 0 199 for i in range(0, len(vectors), batch_size): 200 batch_result = self._upsert_batch(vectors[i : i + batch_size], namespace, _check_type, **kwargs) 201 pbar.update(batch_result.upserted_count) 202 # we can't use here pbar.n for the case show_progress=False 203 total_upserted += batch_result.upserted_count 204 205 return UpsertResponse(upserted_count=total_upserted)
The upsert operation writes vectors into a namespace. If a new value is upserted for an existing vector id, it will overwrite the previous value.
To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel
A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary
If a tuple is used, it must be of the form (id, values, metadata)
or (id, values)
.
where id is a string, vector is a list of floats, metadata is a dict,
and sparse_values is a dict of the form {'indices': List[int], 'values': List[float]}
.
Examples:
>>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])
If a Vector object is used, a Vector object must be of the form
Vector(id, values, metadata, sparse_values)
, where metadata and sparse_values are optional
arguments.
Examples:
>>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))
Note: the dimension of each vector must match the dimension of the index.
If a dictionary is used, it must be in the form {'id': str, 'values': List[float], 'sparse_values': {'indices': List[int], 'values': List[float]}, 'metadata': dict}
Examples:
>>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) >>> >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))])
API reference: https://docs.pinecone.io/reference/upsert
Arguments:
- vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert.
- namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional]
- batch_size (int): The number of vectors to upsert in each batch. If not specified, all vectors will be upserted in a single batch. [optional]
- show_progress (bool): Whether to show a progress bar using tqdm. Applied only if batch_size is provided. Default is True.
Keyword Args:
Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details.
Returns: UpsertResponse, includes the number of vectors upserted.
233 def upsert_from_dataframe( 234 self, 235 df, 236 namespace: Optional[str] = None, 237 batch_size: int = 500, 238 show_progress: bool = True, 239 ) -> UpsertResponse: 240 """Upserts a dataframe into the index. 241 242 Args: 243 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 244 namespace: The namespace to upsert into. 245 batch_size: The number of rows to upsert in a single batch. 246 show_progress: Whether to show a progress bar. 247 """ 248 try: 249 import pandas as pd 250 except ImportError: 251 raise RuntimeError( 252 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 253 ) 254 255 if not isinstance(df, pd.DataFrame): 256 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 257 258 pbar = tqdm( 259 total=len(df), 260 disable=not show_progress, 261 desc="sending upsert requests", 262 ) 263 results = [] 264 for chunk in self._iter_dataframe(df, batch_size=batch_size): 265 res = self.upsert(vectors=chunk, namespace=namespace) 266 pbar.update(len(chunk)) 267 results.append(res) 268 269 upserted_count = 0 270 for res in results: 271 upserted_count += res.upserted_count 272 273 return UpsertResponse(upserted_count=upserted_count)
Upserts a dataframe into the index.
Arguments:
- df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata.
- namespace: The namespace to upsert into.
- batch_size: The number of rows to upsert in a single batch.
- show_progress: Whether to show a progress bar.
275 @validate_and_convert_errors 276 def delete( 277 self, 278 ids: Optional[List[str]] = None, 279 delete_all: Optional[bool] = None, 280 namespace: Optional[str] = None, 281 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 282 **kwargs, 283 ) -> Dict[str, Any]: 284 """ 285 The Delete operation deletes vectors from the index, from a single namespace. 286 No error raised if the vector id does not exist. 287 Note: for any delete call, if namespace is not specified, the default namespace is used. 288 289 Delete can occur in the following mutual exclusive ways: 290 1. Delete by ids from a single namespace 291 2. Delete all vectors from a single namespace by setting delete_all to True 292 3. Delete all vectors from a single namespace by specifying a metadata filter 293 (note that for this option delete all must be set to False) 294 295 API reference: https://docs.pinecone.io/reference/delete_post 296 297 Examples: 298 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 299 >>> index.delete(delete_all=True, namespace='my_namespace') 300 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 301 302 Args: 303 ids (List[str]): Vector ids to delete [optional] 304 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 305 Default is False. 306 namespace (str): The namespace to delete vectors from [optional] 307 If not specified, the default namespace is used. 308 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 309 If specified, the metadata filter here will be used to select the vectors to delete. 310 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 311 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 312 313 Keyword Args: 314 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 315 316 317 Returns: An empty dictionary if the delete operation was successful. 318 """ 319 _check_type = kwargs.pop("_check_type", False) 320 args_dict = parse_non_empty_args( 321 [ 322 ("ids", ids), 323 ("delete_all", delete_all), 324 ("namespace", namespace), 325 ("filter", filter), 326 ] 327 ) 328 329 return self._vector_api.delete( 330 DeleteRequest( 331 **args_dict, 332 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None}, 333 _check_type=_check_type, 334 ), 335 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 336 )
The Delete operation deletes vectors from the index, from a single namespace. No error raised if the vector id does not exist. Note: for any delete call, if namespace is not specified, the default namespace is used.
Delete can occur in the following mutual exclusive ways:
- Delete by ids from a single namespace
- Delete all vectors from a single namespace by setting delete_all to True
- Delete all vectors from a single namespace by specifying a metadata filter (note that for this option delete all must be set to False)
API reference: https://docs.pinecone.io/reference/delete_post
Examples:
>>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') >>> index.delete(delete_all=True, namespace='my_namespace') >>> index.delete(filter={'key': 'value'}, namespace='my_namespace')
Arguments:
- ids (List[str]): Vector ids to delete [optional]
- delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] Default is False.
- namespace (str): The namespace to delete vectors from [optional] If not specified, the default namespace is used.
- filter (Dict[str, Union[str, float, int, bool, List, dict]]): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See https://www.pinecone.io/docs/metadata-filtering/.. [optional]
Keyword Args:
Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details.
Returns: An empty dictionary if the delete operation was successful.
338 @validate_and_convert_errors 339 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 340 """ 341 The fetch operation looks up and returns vectors, by ID, from a single namespace. 342 The returned vectors include the vector data and/or metadata. 343 344 API reference: https://docs.pinecone.io/reference/fetch 345 346 Examples: 347 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 348 >>> index.fetch(ids=['id1', 'id2']) 349 350 Args: 351 ids (List[str]): The vector IDs to fetch. 352 namespace (str): The namespace to fetch vectors from. 353 If not specified, the default namespace is used. [optional] 354 Keyword Args: 355 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 356 357 358 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 359 """ 360 args_dict = parse_non_empty_args([("namespace", namespace)]) 361 return self._vector_api.fetch(ids=ids, **args_dict, **kwargs)
The fetch operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata.
API reference: https://docs.pinecone.io/reference/fetch
Examples:
>>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') >>> index.fetch(ids=['id1', 'id2'])
Arguments:
- ids (List[str]): The vector IDs to fetch.
- namespace (str): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional]
Keyword Args:
Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details.
Returns: FetchResponse object which contains the list of Vector objects, and namespace name.
363 @validate_and_convert_errors 364 def query( 365 self, 366 *args, 367 top_k: int, 368 vector: Optional[List[float]] = None, 369 id: Optional[str] = None, 370 namespace: Optional[str] = None, 371 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 372 include_values: Optional[bool] = None, 373 include_metadata: Optional[bool] = None, 374 sparse_vector: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 375 **kwargs, 376 ) -> QueryResponse: 377 """ 378 The Query operation searches a namespace, using a query vector. 379 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 380 381 API reference: https://docs.pinecone.io/reference/query 382 383 Examples: 384 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 385 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 386 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 387 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 388 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 389 >>> top_k=10, namespace='my_namespace') 390 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 391 >>> top_k=10, namespace='my_namespace') 392 393 Args: 394 vector (List[float]): The query vector. This should be the same length as the dimension of the index 395 being queried. Each `query()` request can contain only one of the parameters 396 `id` or `vector`.. [optional] 397 id (str): The unique ID of the vector to be used as a query vector. 398 Each `query()` request can contain only one of the parameters 399 `vector` or `id`. [optional] 400 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 401 namespace (str): The namespace to fetch vectors from. 402 If not specified, the default namespace is used. [optional] 403 filter (Dict[str, Union[str, float, int, bool, List, dict]): 404 The filter to apply. You can use vector metadata to limit your search. 405 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 406 include_values (bool): Indicates whether vector values are included in the response. 407 If omitted the server will use the default value of False [optional] 408 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 409 If omitted the server will use the default value of False [optional] 410 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 411 Expected to be either a SparseValues object or a dict of the form: 412 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 413 414 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 415 and namespace name. 416 """ 417 418 if len(args) > 0: 419 raise ValueError( 420 "The argument order for `query()` has changed; please use keyword arguments instead of positional arguments. Example: index.query(vector=[0.1, 0.2, 0.3], top_k=10, namespace='my_namespace')" 421 ) 422 423 if vector is not None and id is not None: 424 raise ValueError("Cannot specify both `id` and `vector`") 425 426 _check_type = kwargs.pop("_check_type", False) 427 428 sparse_vector = self._parse_sparse_values_arg(sparse_vector) 429 args_dict = parse_non_empty_args( 430 [ 431 ("vector", vector), 432 ("id", id), 433 ("queries", None), 434 ("top_k", top_k), 435 ("namespace", namespace), 436 ("filter", filter), 437 ("include_values", include_values), 438 ("include_metadata", include_metadata), 439 ("sparse_vector", sparse_vector), 440 ] 441 ) 442 response = self._vector_api.query( 443 QueryRequest( 444 **args_dict, 445 _check_type=_check_type, 446 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 447 ), 448 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 449 ) 450 return parse_query_response(response)
The Query operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores.
API reference: https://docs.pinecone.io/reference/query
Examples:
>>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') >>> index.query(id='id1', top_k=10, namespace='my_namespace') >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, >>> top_k=10, namespace='my_namespace') >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), >>> top_k=10, namespace='my_namespace')
Arguments:
- vector (List[float]): The query vector. This should be the same length as the dimension of the index
being queried. Each
query()
request can contain only one of the parametersid
orvector
.. [optional] - id (str): The unique ID of the vector to be used as a query vector.
Each
query()
request can contain only one of the parametersvector
orid
. [optional] - top_k (int): The number of results to return for each query. Must be an integer greater than 1.
- namespace (str): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional]
- filter (Dict[str, Union[str, float, int, bool, List, dict]): The filter to apply. You can use vector metadata to limit your search. See https://www.pinecone.io/docs/metadata-filtering/.. [optional]
- include_values (bool): Indicates whether vector values are included in the response. If omitted the server will use the default value of False [optional]
- include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. If omitted the server will use the default value of False [optional]
- sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. Expected to be either a SparseValues object or a dict of the form: {'indices': List[int], 'values': List[float]}, where the lists each have the same length.
Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, and namespace name.
452 @validate_and_convert_errors 453 def update( 454 self, 455 id: str, 456 values: Optional[List[float]] = None, 457 set_metadata: Optional[ 458 Dict[ 459 str, 460 Union[str, float, int, bool, List[int], List[float], List[str]], 461 ] 462 ] = None, 463 namespace: Optional[str] = None, 464 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]] = None, 465 **kwargs, 466 ) -> Dict[str, Any]: 467 """ 468 The Update operation updates vector in a namespace. 469 If a value is included, it will overwrite the previous value. 470 If a set_metadata is included, 471 the values of the fields specified in it will be added or overwrite the previous value. 472 473 API reference: https://docs.pinecone.io/reference/update 474 475 Examples: 476 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 477 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 478 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 479 >>> namespace='my_namespace') 480 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 481 >>> namespace='my_namespace') 482 483 Args: 484 id (str): Vector's unique id. 485 values (List[float]): vector values to set. [optional] 486 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 487 metadata to set for vector. [optional] 488 namespace (str): Namespace name where to update the vector.. [optional] 489 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 490 Expected to be either a SparseValues object or a dict of the form: 491 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 492 493 Keyword Args: 494 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 495 496 Returns: An empty dictionary if the update was successful. 497 """ 498 _check_type = kwargs.pop("_check_type", False) 499 sparse_values = self._parse_sparse_values_arg(sparse_values) 500 args_dict = parse_non_empty_args( 501 [ 502 ("values", values), 503 ("set_metadata", set_metadata), 504 ("namespace", namespace), 505 ("sparse_values", sparse_values), 506 ] 507 ) 508 return self._vector_api.update( 509 UpdateRequest( 510 id=id, 511 **args_dict, 512 _check_type=_check_type, 513 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 514 ), 515 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 516 )
The Update operation updates vector in a namespace. If a value is included, it will overwrite the previous value. If a set_metadata is included, the values of the fields specified in it will be added or overwrite the previous value.
API reference: https://docs.pinecone.io/reference/update
Examples:
>>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, >>> namespace='my_namespace') >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), >>> namespace='my_namespace')
Arguments:
- id (str): Vector's unique id.
- values (List[float]): vector values to set. [optional]
- set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): metadata to set for vector. [optional]
- namespace (str): Namespace name where to update the vector.. [optional]
- sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. Expected to be either a SparseValues object or a dict of the form: {'indices': List[int], 'values': List[float]} where the lists each have the same length.
Keyword Args:
Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details.
Returns: An empty dictionary if the update was successful.
518 @validate_and_convert_errors 519 def describe_index_stats( 520 self, 521 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 522 **kwargs, 523 ) -> DescribeIndexStatsResponse: 524 """ 525 The DescribeIndexStats operation returns statistics about the index's contents. 526 For example: The vector count per namespace and the number of dimensions. 527 528 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 529 530 Examples: 531 >>> index.describe_index_stats() 532 >>> index.describe_index_stats(filter={'key': 'value'}) 533 534 Args: 535 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 536 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 537 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 538 539 Returns: DescribeIndexStatsResponse object which contains stats about the index. 540 """ 541 _check_type = kwargs.pop("_check_type", False) 542 args_dict = parse_non_empty_args([("filter", filter)]) 543 544 return self._vector_api.describe_index_stats( 545 DescribeIndexStatsRequest( 546 **args_dict, 547 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 548 _check_type=_check_type, 549 ), 550 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 551 )
The DescribeIndexStats operation returns statistics about the index's contents. For example: The vector count per namespace and the number of dimensions.
API reference: https://docs.pinecone.io/reference/describe_index_stats_post
Examples:
>>> index.describe_index_stats() >>> index.describe_index_stats(filter={'key': 'value'})
Arguments:
- filter (Dict[str, Union[str, float, int, bool, List, dict]]):
- If this parameter is present, the operation only returns statistics for vectors that satisfy the filter.
- See https: //www.pinecone.io/docs/metadata-filtering/.. [optional]
Returns: DescribeIndexStatsResponse object which contains stats about the index.
553 @validate_and_convert_errors 554 def list_paginated( 555 self, 556 prefix: Optional[str] = None, 557 limit: Optional[int] = None, 558 pagination_token: Optional[str] = None, 559 namespace: Optional[str] = None, 560 **kwargs, 561 ) -> ListResponse: 562 """ 563 The list_paginated operation finds vectors based on an id prefix within a single namespace. 564 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 565 This id list can then be passed to fetch or delete operations, depending on your use case. 566 567 Consider using the `list` method to avoid having to handle pagination tokens manually. 568 569 Examples: 570 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 571 >>> [v.id for v in results.vectors] 572 ['99', '990', '991', '992', '993'] 573 >>> results.pagination.next 574 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 575 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 576 577 Args: 578 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 579 be used with the effect of listing all ids in a namespace [optional] 580 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 581 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 582 in the response if additional results are available. [optional] 583 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 584 585 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 586 """ 587 args_dict = parse_non_empty_args( 588 [ 589 ("prefix", prefix), 590 ("limit", limit), 591 ("namespace", namespace), 592 ("pagination_token", pagination_token), 593 ] 594 ) 595 return self._vector_api.list(**args_dict, **kwargs)
The list_paginated operation finds vectors based on an id prefix within a single namespace. It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. This id list can then be passed to fetch or delete operations, depending on your use case.
Consider using the list
method to avoid having to handle pagination tokens manually.
Examples:
>>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') >>> [v.id for v in results.vectors] ['99', '990', '991', '992', '993'] >>> results.pagination.next eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next)
Arguments:
- prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will be used with the effect of listing all ids in a namespace [optional]
- limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional]
- pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned in the response if additional results are available. [optional]
- namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional]
Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed.
597 @validate_and_convert_errors 598 def list(self, **kwargs): 599 """ 600 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 601 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 602 behalf. 603 604 Examples: 605 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 606 >>> print(ids) 607 ['99', '990', '991', '992', '993'] 608 ['994', '995', '996', '997', '998'] 609 ['999'] 610 611 Args: 612 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 613 be used with the effect of listing all ids in a namespace [optional] 614 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 615 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 616 in the response if additional results are available. [optional] 617 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 618 """ 619 done = False 620 while not done: 621 results = self.list_paginated(**kwargs) 622 if len(results.vectors) > 0: 623 yield [v.id for v in results.vectors] 624 625 if results.pagination: 626 kwargs.update({"pagination_token": results.pagination.next}) 627 else: 628 done = True
The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your behalf.
Examples:
>>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): >>> print(ids) ['99', '990', '991', '992', '993'] ['994', '995', '996', '997', '998'] ['999']
Arguments:
- prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will be used with the effect of listing all ids in a namespace [optional]
- limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional]
- pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned in the response if additional results are available. [optional]
- namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional]
41class FetchResponse(ModelNormal): 42 """NOTE: This class is auto generated by OpenAPI Generator. 43 Ref: https://openapi-generator.tech 44 45 Do not edit the class manually. 46 47 Attributes: 48 allowed_values (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 with a capitalized key describing the allowed value and an allowed 51 value. These dicts store the allowed enum values. 52 attribute_map (dict): The key is attribute name 53 and the value is json key in definition. 54 discriminator_value_class_map (dict): A dict to go from the discriminator 55 variable value to the discriminator class name. 56 validations (dict): The key is the tuple path to the attribute 57 and the for var_name this is (var_name,). The value is a dict 58 that stores validations for max_length, min_length, max_items, 59 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 60 inclusive_minimum, and regex. 61 additional_properties_type (tuple): A tuple of classes accepted 62 as additional properties values. 63 """ 64 65 allowed_values = {} 66 67 validations = {} 68 69 @cached_property 70 def additional_properties_type(): 71 """ 72 This must be a method because a model may have properties that are 73 of type self, this must run after the class is loaded 74 """ 75 lazy_import() 76 return ( 77 bool, 78 dict, 79 float, 80 int, 81 list, 82 str, 83 none_type, 84 ) # noqa: E501 85 86 _nullable = False 87 88 @cached_property 89 def openapi_types(): 90 """ 91 This must be a method because a model may have properties that are 92 of type self, this must run after the class is loaded 93 94 Returns 95 openapi_types (dict): The key is attribute name 96 and the value is attribute type. 97 """ 98 lazy_import() 99 return { 100 "vectors": ({str: (Vector,)},), # noqa: E501 101 "namespace": (str,), # noqa: E501 102 "usage": (Usage,), # noqa: E501 103 } 104 105 @cached_property 106 def discriminator(): 107 return None 108 109 attribute_map = { 110 "vectors": "vectors", # noqa: E501 111 "namespace": "namespace", # noqa: E501 112 "usage": "usage", # noqa: E501 113 } 114 115 read_only_vars = {} 116 117 _composed_schemas = {} 118 119 @classmethod 120 @convert_js_args_to_python_args 121 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 122 """FetchResponse - a model defined in OpenAPI 123 124 Keyword Args: 125 _check_type (bool): if True, values for parameters in openapi_types 126 will be type checked and a TypeError will be 127 raised if the wrong type is input. 128 Defaults to True 129 _path_to_item (tuple/list): This is a list of keys or values to 130 drill down to the model in received_data 131 when deserializing a response 132 _spec_property_naming (bool): True if the variable names in the input data 133 are serialized names, as specified in the OpenAPI document. 134 False if the variable names in the input data 135 are pythonic names, e.g. snake case (default) 136 _configuration (Configuration): the instance to use when 137 deserializing a file_type parameter. 138 If passed, type conversion is attempted 139 If omitted no type conversion is done. 140 _visited_composed_classes (tuple): This stores a tuple of 141 classes that we have traveled through so that 142 if we see that class again we will not use its 143 discriminator again. 144 When traveling through a discriminator, the 145 composed schema that is 146 is traveled through is added to this set. 147 For example if Animal has a discriminator 148 petType and we pass in "Dog", and the class Dog 149 allOf includes Animal, we move through Animal 150 once using the discriminator, and pick Dog. 151 Then in Dog, we will make an instance of the 152 Animal class but this time we won't travel 153 through its discriminator because we passed in 154 _visited_composed_classes = (Animal,) 155 vectors ({str: (Vector,)}): [optional] # noqa: E501 156 namespace (str): The namespace of the vectors.. [optional] # noqa: E501 157 usage (Usage): [optional] # noqa: E501 158 """ 159 160 _check_type = kwargs.pop("_check_type", True) 161 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 162 _path_to_item = kwargs.pop("_path_to_item", ()) 163 _configuration = kwargs.pop("_configuration", None) 164 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 165 166 self = super(OpenApiModel, cls).__new__(cls) 167 168 if args: 169 raise PineconeApiTypeError( 170 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 171 % ( 172 args, 173 self.__class__.__name__, 174 ), 175 path_to_item=_path_to_item, 176 valid_classes=(self.__class__,), 177 ) 178 179 self._data_store = {} 180 self._check_type = _check_type 181 self._spec_property_naming = _spec_property_naming 182 self._path_to_item = _path_to_item 183 self._configuration = _configuration 184 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 185 186 for var_name, var_value in kwargs.items(): 187 if ( 188 var_name not in self.attribute_map 189 and self._configuration is not None 190 and self._configuration.discard_unknown_keys 191 and self.additional_properties_type is None 192 ): 193 # discard variable. 194 continue 195 setattr(self, var_name, var_value) 196 return self 197 198 required_properties = set( 199 [ 200 "_data_store", 201 "_check_type", 202 "_spec_property_naming", 203 "_path_to_item", 204 "_configuration", 205 "_visited_composed_classes", 206 ] 207 ) 208 209 @convert_js_args_to_python_args 210 def __init__(self, *args, **kwargs): # noqa: E501 211 """FetchResponse - a model defined in OpenAPI 212 213 Keyword Args: 214 _check_type (bool): if True, values for parameters in openapi_types 215 will be type checked and a TypeError will be 216 raised if the wrong type is input. 217 Defaults to True 218 _path_to_item (tuple/list): This is a list of keys or values to 219 drill down to the model in received_data 220 when deserializing a response 221 _spec_property_naming (bool): True if the variable names in the input data 222 are serialized names, as specified in the OpenAPI document. 223 False if the variable names in the input data 224 are pythonic names, e.g. snake case (default) 225 _configuration (Configuration): the instance to use when 226 deserializing a file_type parameter. 227 If passed, type conversion is attempted 228 If omitted no type conversion is done. 229 _visited_composed_classes (tuple): This stores a tuple of 230 classes that we have traveled through so that 231 if we see that class again we will not use its 232 discriminator again. 233 When traveling through a discriminator, the 234 composed schema that is 235 is traveled through is added to this set. 236 For example if Animal has a discriminator 237 petType and we pass in "Dog", and the class Dog 238 allOf includes Animal, we move through Animal 239 once using the discriminator, and pick Dog. 240 Then in Dog, we will make an instance of the 241 Animal class but this time we won't travel 242 through its discriminator because we passed in 243 _visited_composed_classes = (Animal,) 244 vectors ({str: (Vector,)}): [optional] # noqa: E501 245 namespace (str): The namespace of the vectors.. [optional] # noqa: E501 246 usage (Usage): [optional] # noqa: E501 247 """ 248 249 _check_type = kwargs.pop("_check_type", True) 250 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 251 _path_to_item = kwargs.pop("_path_to_item", ()) 252 _configuration = kwargs.pop("_configuration", None) 253 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 254 255 if args: 256 raise PineconeApiTypeError( 257 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 258 % ( 259 args, 260 self.__class__.__name__, 261 ), 262 path_to_item=_path_to_item, 263 valid_classes=(self.__class__,), 264 ) 265 266 self._data_store = {} 267 self._check_type = _check_type 268 self._spec_property_naming = _spec_property_naming 269 self._path_to_item = _path_to_item 270 self._configuration = _configuration 271 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 272 273 for var_name, var_value in kwargs.items(): 274 if ( 275 var_name not in self.attribute_map 276 and self._configuration is not None 277 and self._configuration.discard_unknown_keys 278 and self.additional_properties_type is None 279 ): 280 # discard variable. 281 continue 282 setattr(self, var_name, var_value) 283 if var_name in self.read_only_vars: 284 raise PineconeApiAttributeError( 285 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 286 f"class with read only attributes." 287 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
209 @convert_js_args_to_python_args 210 def __init__(self, *args, **kwargs): # noqa: E501 211 """FetchResponse - a model defined in OpenAPI 212 213 Keyword Args: 214 _check_type (bool): if True, values for parameters in openapi_types 215 will be type checked and a TypeError will be 216 raised if the wrong type is input. 217 Defaults to True 218 _path_to_item (tuple/list): This is a list of keys or values to 219 drill down to the model in received_data 220 when deserializing a response 221 _spec_property_naming (bool): True if the variable names in the input data 222 are serialized names, as specified in the OpenAPI document. 223 False if the variable names in the input data 224 are pythonic names, e.g. snake case (default) 225 _configuration (Configuration): the instance to use when 226 deserializing a file_type parameter. 227 If passed, type conversion is attempted 228 If omitted no type conversion is done. 229 _visited_composed_classes (tuple): This stores a tuple of 230 classes that we have traveled through so that 231 if we see that class again we will not use its 232 discriminator again. 233 When traveling through a discriminator, the 234 composed schema that is 235 is traveled through is added to this set. 236 For example if Animal has a discriminator 237 petType and we pass in "Dog", and the class Dog 238 allOf includes Animal, we move through Animal 239 once using the discriminator, and pick Dog. 240 Then in Dog, we will make an instance of the 241 Animal class but this time we won't travel 242 through its discriminator because we passed in 243 _visited_composed_classes = (Animal,) 244 vectors ({str: (Vector,)}): [optional] # noqa: E501 245 namespace (str): The namespace of the vectors.. [optional] # noqa: E501 246 usage (Usage): [optional] # noqa: E501 247 """ 248 249 _check_type = kwargs.pop("_check_type", True) 250 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 251 _path_to_item = kwargs.pop("_path_to_item", ()) 252 _configuration = kwargs.pop("_configuration", None) 253 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 254 255 if args: 256 raise PineconeApiTypeError( 257 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 258 % ( 259 args, 260 self.__class__.__name__, 261 ), 262 path_to_item=_path_to_item, 263 valid_classes=(self.__class__,), 264 ) 265 266 self._data_store = {} 267 self._check_type = _check_type 268 self._spec_property_naming = _spec_property_naming 269 self._path_to_item = _path_to_item 270 self._configuration = _configuration 271 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 272 273 for var_name, var_value in kwargs.items(): 274 if ( 275 var_name not in self.attribute_map 276 and self._configuration is not None 277 and self._configuration.discard_unknown_keys 278 and self.additional_properties_type is None 279 ): 280 # discard variable. 281 continue 282 setattr(self, var_name, var_value) 283 if var_name in self.read_only_vars: 284 raise PineconeApiAttributeError( 285 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 286 f"class with read only attributes." 287 )
FetchResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) vectors ({str: (Vector,)}): [optional] # noqa: E501 namespace (str): The namespace of the vectors.. [optional] # noqa: E501 usage (Usage): [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
41class QueryRequest(ModelNormal): 42 """NOTE: This class is auto generated by OpenAPI Generator. 43 Ref: https://openapi-generator.tech 44 45 Do not edit the class manually. 46 47 Attributes: 48 allowed_values (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 with a capitalized key describing the allowed value and an allowed 51 value. These dicts store the allowed enum values. 52 attribute_map (dict): The key is attribute name 53 and the value is json key in definition. 54 discriminator_value_class_map (dict): A dict to go from the discriminator 55 variable value to the discriminator class name. 56 validations (dict): The key is the tuple path to the attribute 57 and the for var_name this is (var_name,). The value is a dict 58 that stores validations for max_length, min_length, max_items, 59 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 60 inclusive_minimum, and regex. 61 additional_properties_type (tuple): A tuple of classes accepted 62 as additional properties values. 63 """ 64 65 allowed_values = {} 66 67 validations = { 68 ("top_k",): { 69 "inclusive_maximum": 10000, 70 "inclusive_minimum": 1, 71 }, 72 ("queries",): {}, 73 ("vector",): {}, 74 ("id",): { 75 "max_length": 512, 76 }, 77 } 78 79 @cached_property 80 def additional_properties_type(): 81 """ 82 This must be a method because a model may have properties that are 83 of type self, this must run after the class is loaded 84 """ 85 lazy_import() 86 return ( 87 bool, 88 dict, 89 float, 90 int, 91 list, 92 str, 93 none_type, 94 ) # noqa: E501 95 96 _nullable = False 97 98 @cached_property 99 def openapi_types(): 100 """ 101 This must be a method because a model may have properties that are 102 of type self, this must run after the class is loaded 103 104 Returns 105 openapi_types (dict): The key is attribute name 106 and the value is attribute type. 107 """ 108 lazy_import() 109 return { 110 "top_k": (int,), # noqa: E501 111 "namespace": (str,), # noqa: E501 112 "filter": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 113 "include_values": (bool,), # noqa: E501 114 "include_metadata": (bool,), # noqa: E501 115 "queries": ([QueryVector],), # noqa: E501 116 "vector": ([float],), # noqa: E501 117 "sparse_vector": (SparseValues,), # noqa: E501 118 "id": (str,), # noqa: E501 119 } 120 121 @cached_property 122 def discriminator(): 123 return None 124 125 attribute_map = { 126 "top_k": "topK", # noqa: E501 127 "namespace": "namespace", # noqa: E501 128 "filter": "filter", # noqa: E501 129 "include_values": "includeValues", # noqa: E501 130 "include_metadata": "includeMetadata", # noqa: E501 131 "queries": "queries", # noqa: E501 132 "vector": "vector", # noqa: E501 133 "sparse_vector": "sparseVector", # noqa: E501 134 "id": "id", # noqa: E501 135 } 136 137 read_only_vars = {} 138 139 _composed_schemas = {} 140 141 @classmethod 142 @convert_js_args_to_python_args 143 def _from_openapi_data(cls, top_k, *args, **kwargs): # noqa: E501 144 """QueryRequest - a model defined in OpenAPI 145 146 Args: 147 top_k (int): The number of results to return for each query. 148 149 Keyword Args: 150 _check_type (bool): if True, values for parameters in openapi_types 151 will be type checked and a TypeError will be 152 raised if the wrong type is input. 153 Defaults to True 154 _path_to_item (tuple/list): This is a list of keys or values to 155 drill down to the model in received_data 156 when deserializing a response 157 _spec_property_naming (bool): True if the variable names in the input data 158 are serialized names, as specified in the OpenAPI document. 159 False if the variable names in the input data 160 are pythonic names, e.g. snake case (default) 161 _configuration (Configuration): the instance to use when 162 deserializing a file_type parameter. 163 If passed, type conversion is attempted 164 If omitted no type conversion is done. 165 _visited_composed_classes (tuple): This stores a tuple of 166 classes that we have traveled through so that 167 if we see that class again we will not use its 168 discriminator again. 169 When traveling through a discriminator, the 170 composed schema that is 171 is traveled through is added to this set. 172 For example if Animal has a discriminator 173 petType and we pass in "Dog", and the class Dog 174 allOf includes Animal, we move through Animal 175 once using the discriminator, and pick Dog. 176 Then in Dog, we will make an instance of the 177 Animal class but this time we won't travel 178 through its discriminator because we passed in 179 _visited_composed_classes = (Animal,) 180 namespace (str): The namespace to query.. [optional] # noqa: E501 181 filter ({str: (bool, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata).. [optional] # noqa: E501 182 include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 183 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 184 queries ([QueryVector]): DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 185 vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.. [optional] # noqa: E501 186 sparse_vector (SparseValues): [optional] # noqa: E501 187 id (str): The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 188 """ 189 190 _check_type = kwargs.pop("_check_type", True) 191 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 192 _path_to_item = kwargs.pop("_path_to_item", ()) 193 _configuration = kwargs.pop("_configuration", None) 194 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 195 196 self = super(OpenApiModel, cls).__new__(cls) 197 198 if args: 199 raise PineconeApiTypeError( 200 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 201 % ( 202 args, 203 self.__class__.__name__, 204 ), 205 path_to_item=_path_to_item, 206 valid_classes=(self.__class__,), 207 ) 208 209 self._data_store = {} 210 self._check_type = _check_type 211 self._spec_property_naming = _spec_property_naming 212 self._path_to_item = _path_to_item 213 self._configuration = _configuration 214 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 215 216 self.top_k = top_k 217 for var_name, var_value in kwargs.items(): 218 if ( 219 var_name not in self.attribute_map 220 and self._configuration is not None 221 and self._configuration.discard_unknown_keys 222 and self.additional_properties_type is None 223 ): 224 # discard variable. 225 continue 226 setattr(self, var_name, var_value) 227 return self 228 229 required_properties = set( 230 [ 231 "_data_store", 232 "_check_type", 233 "_spec_property_naming", 234 "_path_to_item", 235 "_configuration", 236 "_visited_composed_classes", 237 ] 238 ) 239 240 @convert_js_args_to_python_args 241 def __init__(self, top_k, *args, **kwargs): # noqa: E501 242 """QueryRequest - a model defined in OpenAPI 243 244 Args: 245 top_k (int): The number of results to return for each query. 246 247 Keyword Args: 248 _check_type (bool): if True, values for parameters in openapi_types 249 will be type checked and a TypeError will be 250 raised if the wrong type is input. 251 Defaults to True 252 _path_to_item (tuple/list): This is a list of keys or values to 253 drill down to the model in received_data 254 when deserializing a response 255 _spec_property_naming (bool): True if the variable names in the input data 256 are serialized names, as specified in the OpenAPI document. 257 False if the variable names in the input data 258 are pythonic names, e.g. snake case (default) 259 _configuration (Configuration): the instance to use when 260 deserializing a file_type parameter. 261 If passed, type conversion is attempted 262 If omitted no type conversion is done. 263 _visited_composed_classes (tuple): This stores a tuple of 264 classes that we have traveled through so that 265 if we see that class again we will not use its 266 discriminator again. 267 When traveling through a discriminator, the 268 composed schema that is 269 is traveled through is added to this set. 270 For example if Animal has a discriminator 271 petType and we pass in "Dog", and the class Dog 272 allOf includes Animal, we move through Animal 273 once using the discriminator, and pick Dog. 274 Then in Dog, we will make an instance of the 275 Animal class but this time we won't travel 276 through its discriminator because we passed in 277 _visited_composed_classes = (Animal,) 278 namespace (str): The namespace to query.. [optional] # noqa: E501 279 filter ({str: (bool, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata).. [optional] # noqa: E501 280 include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 281 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 282 queries ([QueryVector]): DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 283 vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.. [optional] # noqa: E501 284 sparse_vector (SparseValues): [optional] # noqa: E501 285 id (str): The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 286 """ 287 288 _check_type = kwargs.pop("_check_type", True) 289 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 290 _path_to_item = kwargs.pop("_path_to_item", ()) 291 _configuration = kwargs.pop("_configuration", None) 292 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 293 294 if args: 295 raise PineconeApiTypeError( 296 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 297 % ( 298 args, 299 self.__class__.__name__, 300 ), 301 path_to_item=_path_to_item, 302 valid_classes=(self.__class__,), 303 ) 304 305 self._data_store = {} 306 self._check_type = _check_type 307 self._spec_property_naming = _spec_property_naming 308 self._path_to_item = _path_to_item 309 self._configuration = _configuration 310 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 311 312 self.top_k = top_k 313 for var_name, var_value in kwargs.items(): 314 if ( 315 var_name not in self.attribute_map 316 and self._configuration is not None 317 and self._configuration.discard_unknown_keys 318 and self.additional_properties_type is None 319 ): 320 # discard variable. 321 continue 322 setattr(self, var_name, var_value) 323 if var_name in self.read_only_vars: 324 raise PineconeApiAttributeError( 325 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 326 f"class with read only attributes." 327 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
240 @convert_js_args_to_python_args 241 def __init__(self, top_k, *args, **kwargs): # noqa: E501 242 """QueryRequest - a model defined in OpenAPI 243 244 Args: 245 top_k (int): The number of results to return for each query. 246 247 Keyword Args: 248 _check_type (bool): if True, values for parameters in openapi_types 249 will be type checked and a TypeError will be 250 raised if the wrong type is input. 251 Defaults to True 252 _path_to_item (tuple/list): This is a list of keys or values to 253 drill down to the model in received_data 254 when deserializing a response 255 _spec_property_naming (bool): True if the variable names in the input data 256 are serialized names, as specified in the OpenAPI document. 257 False if the variable names in the input data 258 are pythonic names, e.g. snake case (default) 259 _configuration (Configuration): the instance to use when 260 deserializing a file_type parameter. 261 If passed, type conversion is attempted 262 If omitted no type conversion is done. 263 _visited_composed_classes (tuple): This stores a tuple of 264 classes that we have traveled through so that 265 if we see that class again we will not use its 266 discriminator again. 267 When traveling through a discriminator, the 268 composed schema that is 269 is traveled through is added to this set. 270 For example if Animal has a discriminator 271 petType and we pass in "Dog", and the class Dog 272 allOf includes Animal, we move through Animal 273 once using the discriminator, and pick Dog. 274 Then in Dog, we will make an instance of the 275 Animal class but this time we won't travel 276 through its discriminator because we passed in 277 _visited_composed_classes = (Animal,) 278 namespace (str): The namespace to query.. [optional] # noqa: E501 279 filter ({str: (bool, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata).. [optional] # noqa: E501 280 include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 281 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 282 queries ([QueryVector]): DEPRECATED. The query vectors. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 283 vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Each `query()` request can contain only one of the parameters `id` or `vector`.. [optional] # noqa: E501 284 sparse_vector (SparseValues): [optional] # noqa: E501 285 id (str): The unique ID of the vector to be used as a query vector. Each `query()` request can contain only one of the parameters `queries`, `vector`, or `id`.. [optional] # noqa: E501 286 """ 287 288 _check_type = kwargs.pop("_check_type", True) 289 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 290 _path_to_item = kwargs.pop("_path_to_item", ()) 291 _configuration = kwargs.pop("_configuration", None) 292 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 293 294 if args: 295 raise PineconeApiTypeError( 296 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 297 % ( 298 args, 299 self.__class__.__name__, 300 ), 301 path_to_item=_path_to_item, 302 valid_classes=(self.__class__,), 303 ) 304 305 self._data_store = {} 306 self._check_type = _check_type 307 self._spec_property_naming = _spec_property_naming 308 self._path_to_item = _path_to_item 309 self._configuration = _configuration 310 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 311 312 self.top_k = top_k 313 for var_name, var_value in kwargs.items(): 314 if ( 315 var_name not in self.attribute_map 316 and self._configuration is not None 317 and self._configuration.discard_unknown_keys 318 and self.additional_properties_type is None 319 ): 320 # discard variable. 321 continue 322 setattr(self, var_name, var_value) 323 if var_name in self.read_only_vars: 324 raise PineconeApiAttributeError( 325 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 326 f"class with read only attributes." 327 )
QueryRequest - a model defined in OpenAPI
Arguments:
- top_k (int): The number of results to return for each query.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) namespace (str): The namespace to query.. [optional] # noqa: E501 filter ({str: (bool, dict, float, int, list, str, none_type)}): The filter to apply. You can use vector metadata to limit your search. See Filter with metadata.. [optional] # noqa: E501 include_values (bool): Indicates whether vector values are included in the response.. [optional] if omitted the server will use the default value of False # noqa: E501 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids.. [optional] if omitted the server will use the default value of False # noqa: E501 queries ([QueryVector]): DEPRECATED. The query vectors. Each
query()
request can contain only one of the parametersqueries
,vector
, orid
.. [optional] # noqa: E501 vector ([float]): The query vector. This should be the same length as the dimension of the index being queried. Eachquery()
request can contain only one of the parametersid
orvector
.. [optional] # noqa: E501 sparse_vector (SparseValues): [optional] # noqa: E501 id (str): The unique ID of the vector to be used as a query vector. Eachquery()
request can contain only one of the parametersqueries
,vector
, orid
.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
43class QueryResponse(ModelNormal): 44 """NOTE: This class is auto generated by OpenAPI Generator. 45 Ref: https://openapi-generator.tech 46 47 Do not edit the class manually. 48 49 Attributes: 50 allowed_values (dict): The key is the tuple path to the attribute 51 and the for var_name this is (var_name,). The value is a dict 52 with a capitalized key describing the allowed value and an allowed 53 value. These dicts store the allowed enum values. 54 attribute_map (dict): The key is attribute name 55 and the value is json key in definition. 56 discriminator_value_class_map (dict): A dict to go from the discriminator 57 variable value to the discriminator class name. 58 validations (dict): The key is the tuple path to the attribute 59 and the for var_name this is (var_name,). The value is a dict 60 that stores validations for max_length, min_length, max_items, 61 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 62 inclusive_minimum, and regex. 63 additional_properties_type (tuple): A tuple of classes accepted 64 as additional properties values. 65 """ 66 67 allowed_values = {} 68 69 validations = {} 70 71 @cached_property 72 def additional_properties_type(): 73 """ 74 This must be a method because a model may have properties that are 75 of type self, this must run after the class is loaded 76 """ 77 lazy_import() 78 return ( 79 bool, 80 dict, 81 float, 82 int, 83 list, 84 str, 85 none_type, 86 ) # noqa: E501 87 88 _nullable = False 89 90 @cached_property 91 def openapi_types(): 92 """ 93 This must be a method because a model may have properties that are 94 of type self, this must run after the class is loaded 95 96 Returns 97 openapi_types (dict): The key is attribute name 98 and the value is attribute type. 99 """ 100 lazy_import() 101 return { 102 "results": ([SingleQueryResults],), # noqa: E501 103 "matches": ([ScoredVector],), # noqa: E501 104 "namespace": (str,), # noqa: E501 105 "usage": (Usage,), # noqa: E501 106 } 107 108 @cached_property 109 def discriminator(): 110 return None 111 112 attribute_map = { 113 "results": "results", # noqa: E501 114 "matches": "matches", # noqa: E501 115 "namespace": "namespace", # noqa: E501 116 "usage": "usage", # noqa: E501 117 } 118 119 read_only_vars = {} 120 121 _composed_schemas = {} 122 123 @classmethod 124 @convert_js_args_to_python_args 125 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 126 """QueryResponse - a model defined in OpenAPI 127 128 Keyword Args: 129 _check_type (bool): if True, values for parameters in openapi_types 130 will be type checked and a TypeError will be 131 raised if the wrong type is input. 132 Defaults to True 133 _path_to_item (tuple/list): This is a list of keys or values to 134 drill down to the model in received_data 135 when deserializing a response 136 _spec_property_naming (bool): True if the variable names in the input data 137 are serialized names, as specified in the OpenAPI document. 138 False if the variable names in the input data 139 are pythonic names, e.g. snake case (default) 140 _configuration (Configuration): the instance to use when 141 deserializing a file_type parameter. 142 If passed, type conversion is attempted 143 If omitted no type conversion is done. 144 _visited_composed_classes (tuple): This stores a tuple of 145 classes that we have traveled through so that 146 if we see that class again we will not use its 147 discriminator again. 148 When traveling through a discriminator, the 149 composed schema that is 150 is traveled through is added to this set. 151 For example if Animal has a discriminator 152 petType and we pass in "Dog", and the class Dog 153 allOf includes Animal, we move through Animal 154 once using the discriminator, and pick Dog. 155 Then in Dog, we will make an instance of the 156 Animal class but this time we won't travel 157 through its discriminator because we passed in 158 _visited_composed_classes = (Animal,) 159 results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.. [optional] # noqa: E501 160 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 161 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 162 usage (Usage): [optional] # noqa: E501 163 """ 164 165 _check_type = kwargs.pop("_check_type", True) 166 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 167 _path_to_item = kwargs.pop("_path_to_item", ()) 168 _configuration = kwargs.pop("_configuration", None) 169 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 170 171 self = super(OpenApiModel, cls).__new__(cls) 172 173 if args: 174 raise PineconeApiTypeError( 175 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 176 % ( 177 args, 178 self.__class__.__name__, 179 ), 180 path_to_item=_path_to_item, 181 valid_classes=(self.__class__,), 182 ) 183 184 self._data_store = {} 185 self._check_type = _check_type 186 self._spec_property_naming = _spec_property_naming 187 self._path_to_item = _path_to_item 188 self._configuration = _configuration 189 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 190 191 for var_name, var_value in kwargs.items(): 192 if ( 193 var_name not in self.attribute_map 194 and self._configuration is not None 195 and self._configuration.discard_unknown_keys 196 and self.additional_properties_type is None 197 ): 198 # discard variable. 199 continue 200 setattr(self, var_name, var_value) 201 return self 202 203 required_properties = set( 204 [ 205 "_data_store", 206 "_check_type", 207 "_spec_property_naming", 208 "_path_to_item", 209 "_configuration", 210 "_visited_composed_classes", 211 ] 212 ) 213 214 @convert_js_args_to_python_args 215 def __init__(self, *args, **kwargs): # noqa: E501 216 """QueryResponse - a model defined in OpenAPI 217 218 Keyword Args: 219 _check_type (bool): if True, values for parameters in openapi_types 220 will be type checked and a TypeError will be 221 raised if the wrong type is input. 222 Defaults to True 223 _path_to_item (tuple/list): This is a list of keys or values to 224 drill down to the model in received_data 225 when deserializing a response 226 _spec_property_naming (bool): True if the variable names in the input data 227 are serialized names, as specified in the OpenAPI document. 228 False if the variable names in the input data 229 are pythonic names, e.g. snake case (default) 230 _configuration (Configuration): the instance to use when 231 deserializing a file_type parameter. 232 If passed, type conversion is attempted 233 If omitted no type conversion is done. 234 _visited_composed_classes (tuple): This stores a tuple of 235 classes that we have traveled through so that 236 if we see that class again we will not use its 237 discriminator again. 238 When traveling through a discriminator, the 239 composed schema that is 240 is traveled through is added to this set. 241 For example if Animal has a discriminator 242 petType and we pass in "Dog", and the class Dog 243 allOf includes Animal, we move through Animal 244 once using the discriminator, and pick Dog. 245 Then in Dog, we will make an instance of the 246 Animal class but this time we won't travel 247 through its discriminator because we passed in 248 _visited_composed_classes = (Animal,) 249 results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.. [optional] # noqa: E501 250 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 251 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 252 usage (Usage): [optional] # noqa: E501 253 """ 254 255 _check_type = kwargs.pop("_check_type", True) 256 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 257 _path_to_item = kwargs.pop("_path_to_item", ()) 258 _configuration = kwargs.pop("_configuration", None) 259 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 260 261 if args: 262 raise PineconeApiTypeError( 263 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 264 % ( 265 args, 266 self.__class__.__name__, 267 ), 268 path_to_item=_path_to_item, 269 valid_classes=(self.__class__,), 270 ) 271 272 self._data_store = {} 273 self._check_type = _check_type 274 self._spec_property_naming = _spec_property_naming 275 self._path_to_item = _path_to_item 276 self._configuration = _configuration 277 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 278 279 for var_name, var_value in kwargs.items(): 280 if ( 281 var_name not in self.attribute_map 282 and self._configuration is not None 283 and self._configuration.discard_unknown_keys 284 and self.additional_properties_type is None 285 ): 286 # discard variable. 287 continue 288 setattr(self, var_name, var_value) 289 if var_name in self.read_only_vars: 290 raise PineconeApiAttributeError( 291 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 292 f"class with read only attributes." 293 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
214 @convert_js_args_to_python_args 215 def __init__(self, *args, **kwargs): # noqa: E501 216 """QueryResponse - a model defined in OpenAPI 217 218 Keyword Args: 219 _check_type (bool): if True, values for parameters in openapi_types 220 will be type checked and a TypeError will be 221 raised if the wrong type is input. 222 Defaults to True 223 _path_to_item (tuple/list): This is a list of keys or values to 224 drill down to the model in received_data 225 when deserializing a response 226 _spec_property_naming (bool): True if the variable names in the input data 227 are serialized names, as specified in the OpenAPI document. 228 False if the variable names in the input data 229 are pythonic names, e.g. snake case (default) 230 _configuration (Configuration): the instance to use when 231 deserializing a file_type parameter. 232 If passed, type conversion is attempted 233 If omitted no type conversion is done. 234 _visited_composed_classes (tuple): This stores a tuple of 235 classes that we have traveled through so that 236 if we see that class again we will not use its 237 discriminator again. 238 When traveling through a discriminator, the 239 composed schema that is 240 is traveled through is added to this set. 241 For example if Animal has a discriminator 242 petType and we pass in "Dog", and the class Dog 243 allOf includes Animal, we move through Animal 244 once using the discriminator, and pick Dog. 245 Then in Dog, we will make an instance of the 246 Animal class but this time we won't travel 247 through its discriminator because we passed in 248 _visited_composed_classes = (Animal,) 249 results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as `QueryRequest.queries`.. [optional] # noqa: E501 250 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 251 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 252 usage (Usage): [optional] # noqa: E501 253 """ 254 255 _check_type = kwargs.pop("_check_type", True) 256 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 257 _path_to_item = kwargs.pop("_path_to_item", ()) 258 _configuration = kwargs.pop("_configuration", None) 259 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 260 261 if args: 262 raise PineconeApiTypeError( 263 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 264 % ( 265 args, 266 self.__class__.__name__, 267 ), 268 path_to_item=_path_to_item, 269 valid_classes=(self.__class__,), 270 ) 271 272 self._data_store = {} 273 self._check_type = _check_type 274 self._spec_property_naming = _spec_property_naming 275 self._path_to_item = _path_to_item 276 self._configuration = _configuration 277 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 278 279 for var_name, var_value in kwargs.items(): 280 if ( 281 var_name not in self.attribute_map 282 and self._configuration is not None 283 and self._configuration.discard_unknown_keys 284 and self.additional_properties_type is None 285 ): 286 # discard variable. 287 continue 288 setattr(self, var_name, var_value) 289 if var_name in self.read_only_vars: 290 raise PineconeApiAttributeError( 291 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 292 f"class with read only attributes." 293 )
QueryResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) results ([SingleQueryResults]): DEPRECATED. The results of each query. The order is the same as
QueryRequest.queries
.. [optional] # noqa: E501 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 usage (Usage): [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class RpcStatus(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = {} 66 67 @cached_property 68 def additional_properties_type(): 69 """ 70 This must be a method because a model may have properties that are 71 of type self, this must run after the class is loaded 72 """ 73 lazy_import() 74 return ( 75 bool, 76 dict, 77 float, 78 int, 79 list, 80 str, 81 none_type, 82 ) # noqa: E501 83 84 _nullable = False 85 86 @cached_property 87 def openapi_types(): 88 """ 89 This must be a method because a model may have properties that are 90 of type self, this must run after the class is loaded 91 92 Returns 93 openapi_types (dict): The key is attribute name 94 and the value is attribute type. 95 """ 96 lazy_import() 97 return { 98 "code": (int,), # noqa: E501 99 "message": (str,), # noqa: E501 100 "details": ([ProtobufAny],), # noqa: E501 101 } 102 103 @cached_property 104 def discriminator(): 105 return None 106 107 attribute_map = { 108 "code": "code", # noqa: E501 109 "message": "message", # noqa: E501 110 "details": "details", # noqa: E501 111 } 112 113 read_only_vars = {} 114 115 _composed_schemas = {} 116 117 @classmethod 118 @convert_js_args_to_python_args 119 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 120 """RpcStatus - a model defined in OpenAPI 121 122 Keyword Args: 123 _check_type (bool): if True, values for parameters in openapi_types 124 will be type checked and a TypeError will be 125 raised if the wrong type is input. 126 Defaults to True 127 _path_to_item (tuple/list): This is a list of keys or values to 128 drill down to the model in received_data 129 when deserializing a response 130 _spec_property_naming (bool): True if the variable names in the input data 131 are serialized names, as specified in the OpenAPI document. 132 False if the variable names in the input data 133 are pythonic names, e.g. snake case (default) 134 _configuration (Configuration): the instance to use when 135 deserializing a file_type parameter. 136 If passed, type conversion is attempted 137 If omitted no type conversion is done. 138 _visited_composed_classes (tuple): This stores a tuple of 139 classes that we have traveled through so that 140 if we see that class again we will not use its 141 discriminator again. 142 When traveling through a discriminator, the 143 composed schema that is 144 is traveled through is added to this set. 145 For example if Animal has a discriminator 146 petType and we pass in "Dog", and the class Dog 147 allOf includes Animal, we move through Animal 148 once using the discriminator, and pick Dog. 149 Then in Dog, we will make an instance of the 150 Animal class but this time we won't travel 151 through its discriminator because we passed in 152 _visited_composed_classes = (Animal,) 153 code (int): [optional] # noqa: E501 154 message (str): [optional] # noqa: E501 155 details ([ProtobufAny]): [optional] # noqa: E501 156 """ 157 158 _check_type = kwargs.pop("_check_type", True) 159 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 160 _path_to_item = kwargs.pop("_path_to_item", ()) 161 _configuration = kwargs.pop("_configuration", None) 162 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 163 164 self = super(OpenApiModel, cls).__new__(cls) 165 166 if args: 167 raise PineconeApiTypeError( 168 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 169 % ( 170 args, 171 self.__class__.__name__, 172 ), 173 path_to_item=_path_to_item, 174 valid_classes=(self.__class__,), 175 ) 176 177 self._data_store = {} 178 self._check_type = _check_type 179 self._spec_property_naming = _spec_property_naming 180 self._path_to_item = _path_to_item 181 self._configuration = _configuration 182 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 183 184 for var_name, var_value in kwargs.items(): 185 if ( 186 var_name not in self.attribute_map 187 and self._configuration is not None 188 and self._configuration.discard_unknown_keys 189 and self.additional_properties_type is None 190 ): 191 # discard variable. 192 continue 193 setattr(self, var_name, var_value) 194 return self 195 196 required_properties = set( 197 [ 198 "_data_store", 199 "_check_type", 200 "_spec_property_naming", 201 "_path_to_item", 202 "_configuration", 203 "_visited_composed_classes", 204 ] 205 ) 206 207 @convert_js_args_to_python_args 208 def __init__(self, *args, **kwargs): # noqa: E501 209 """RpcStatus - a model defined in OpenAPI 210 211 Keyword Args: 212 _check_type (bool): if True, values for parameters in openapi_types 213 will be type checked and a TypeError will be 214 raised if the wrong type is input. 215 Defaults to True 216 _path_to_item (tuple/list): This is a list of keys or values to 217 drill down to the model in received_data 218 when deserializing a response 219 _spec_property_naming (bool): True if the variable names in the input data 220 are serialized names, as specified in the OpenAPI document. 221 False if the variable names in the input data 222 are pythonic names, e.g. snake case (default) 223 _configuration (Configuration): the instance to use when 224 deserializing a file_type parameter. 225 If passed, type conversion is attempted 226 If omitted no type conversion is done. 227 _visited_composed_classes (tuple): This stores a tuple of 228 classes that we have traveled through so that 229 if we see that class again we will not use its 230 discriminator again. 231 When traveling through a discriminator, the 232 composed schema that is 233 is traveled through is added to this set. 234 For example if Animal has a discriminator 235 petType and we pass in "Dog", and the class Dog 236 allOf includes Animal, we move through Animal 237 once using the discriminator, and pick Dog. 238 Then in Dog, we will make an instance of the 239 Animal class but this time we won't travel 240 through its discriminator because we passed in 241 _visited_composed_classes = (Animal,) 242 code (int): [optional] # noqa: E501 243 message (str): [optional] # noqa: E501 244 details ([ProtobufAny]): [optional] # noqa: E501 245 """ 246 247 _check_type = kwargs.pop("_check_type", True) 248 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 249 _path_to_item = kwargs.pop("_path_to_item", ()) 250 _configuration = kwargs.pop("_configuration", None) 251 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 252 253 if args: 254 raise PineconeApiTypeError( 255 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 256 % ( 257 args, 258 self.__class__.__name__, 259 ), 260 path_to_item=_path_to_item, 261 valid_classes=(self.__class__,), 262 ) 263 264 self._data_store = {} 265 self._check_type = _check_type 266 self._spec_property_naming = _spec_property_naming 267 self._path_to_item = _path_to_item 268 self._configuration = _configuration 269 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 270 271 for var_name, var_value in kwargs.items(): 272 if ( 273 var_name not in self.attribute_map 274 and self._configuration is not None 275 and self._configuration.discard_unknown_keys 276 and self.additional_properties_type is None 277 ): 278 # discard variable. 279 continue 280 setattr(self, var_name, var_value) 281 if var_name in self.read_only_vars: 282 raise PineconeApiAttributeError( 283 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 284 f"class with read only attributes." 285 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
207 @convert_js_args_to_python_args 208 def __init__(self, *args, **kwargs): # noqa: E501 209 """RpcStatus - a model defined in OpenAPI 210 211 Keyword Args: 212 _check_type (bool): if True, values for parameters in openapi_types 213 will be type checked and a TypeError will be 214 raised if the wrong type is input. 215 Defaults to True 216 _path_to_item (tuple/list): This is a list of keys or values to 217 drill down to the model in received_data 218 when deserializing a response 219 _spec_property_naming (bool): True if the variable names in the input data 220 are serialized names, as specified in the OpenAPI document. 221 False if the variable names in the input data 222 are pythonic names, e.g. snake case (default) 223 _configuration (Configuration): the instance to use when 224 deserializing a file_type parameter. 225 If passed, type conversion is attempted 226 If omitted no type conversion is done. 227 _visited_composed_classes (tuple): This stores a tuple of 228 classes that we have traveled through so that 229 if we see that class again we will not use its 230 discriminator again. 231 When traveling through a discriminator, the 232 composed schema that is 233 is traveled through is added to this set. 234 For example if Animal has a discriminator 235 petType and we pass in "Dog", and the class Dog 236 allOf includes Animal, we move through Animal 237 once using the discriminator, and pick Dog. 238 Then in Dog, we will make an instance of the 239 Animal class but this time we won't travel 240 through its discriminator because we passed in 241 _visited_composed_classes = (Animal,) 242 code (int): [optional] # noqa: E501 243 message (str): [optional] # noqa: E501 244 details ([ProtobufAny]): [optional] # noqa: E501 245 """ 246 247 _check_type = kwargs.pop("_check_type", True) 248 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 249 _path_to_item = kwargs.pop("_path_to_item", ()) 250 _configuration = kwargs.pop("_configuration", None) 251 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 252 253 if args: 254 raise PineconeApiTypeError( 255 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 256 % ( 257 args, 258 self.__class__.__name__, 259 ), 260 path_to_item=_path_to_item, 261 valid_classes=(self.__class__,), 262 ) 263 264 self._data_store = {} 265 self._check_type = _check_type 266 self._spec_property_naming = _spec_property_naming 267 self._path_to_item = _path_to_item 268 self._configuration = _configuration 269 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 270 271 for var_name, var_value in kwargs.items(): 272 if ( 273 var_name not in self.attribute_map 274 and self._configuration is not None 275 and self._configuration.discard_unknown_keys 276 and self.additional_properties_type is None 277 ): 278 # discard variable. 279 continue 280 setattr(self, var_name, var_value) 281 if var_name in self.read_only_vars: 282 raise PineconeApiAttributeError( 283 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 284 f"class with read only attributes." 285 )
RpcStatus - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) code (int): [optional] # noqa: E501 message (str): [optional] # noqa: E501 details ([ProtobufAny]): [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class ScoredVector(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = { 66 ("id",): { 67 "max_length": 512, 68 "min_length": 1, 69 }, 70 } 71 72 @cached_property 73 def additional_properties_type(): 74 """ 75 This must be a method because a model may have properties that are 76 of type self, this must run after the class is loaded 77 """ 78 lazy_import() 79 return ( 80 bool, 81 dict, 82 float, 83 int, 84 list, 85 str, 86 none_type, 87 ) # noqa: E501 88 89 _nullable = False 90 91 @cached_property 92 def openapi_types(): 93 """ 94 This must be a method because a model may have properties that are 95 of type self, this must run after the class is loaded 96 97 Returns 98 openapi_types (dict): The key is attribute name 99 and the value is attribute type. 100 """ 101 lazy_import() 102 return { 103 "id": (str,), # noqa: E501 104 "score": (float,), # noqa: E501 105 "values": ([float],), # noqa: E501 106 "sparse_values": (SparseValues,), # noqa: E501 107 "metadata": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 108 } 109 110 @cached_property 111 def discriminator(): 112 return None 113 114 attribute_map = { 115 "id": "id", # noqa: E501 116 "score": "score", # noqa: E501 117 "values": "values", # noqa: E501 118 "sparse_values": "sparseValues", # noqa: E501 119 "metadata": "metadata", # noqa: E501 120 } 121 122 read_only_vars = {} 123 124 _composed_schemas = {} 125 126 @classmethod 127 @convert_js_args_to_python_args 128 def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 129 """ScoredVector - a model defined in OpenAPI 130 131 Args: 132 id (str): This is the vector's unique id. 133 134 Keyword Args: 135 _check_type (bool): if True, values for parameters in openapi_types 136 will be type checked and a TypeError will be 137 raised if the wrong type is input. 138 Defaults to True 139 _path_to_item (tuple/list): This is a list of keys or values to 140 drill down to the model in received_data 141 when deserializing a response 142 _spec_property_naming (bool): True if the variable names in the input data 143 are serialized names, as specified in the OpenAPI document. 144 False if the variable names in the input data 145 are pythonic names, e.g. snake case (default) 146 _configuration (Configuration): the instance to use when 147 deserializing a file_type parameter. 148 If passed, type conversion is attempted 149 If omitted no type conversion is done. 150 _visited_composed_classes (tuple): This stores a tuple of 151 classes that we have traveled through so that 152 if we see that class again we will not use its 153 discriminator again. 154 When traveling through a discriminator, the 155 composed schema that is 156 is traveled through is added to this set. 157 For example if Animal has a discriminator 158 petType and we pass in "Dog", and the class Dog 159 allOf includes Animal, we move through Animal 160 once using the discriminator, and pick Dog. 161 Then in Dog, we will make an instance of the 162 Animal class but this time we won't travel 163 through its discriminator because we passed in 164 _visited_composed_classes = (Animal,) 165 score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 166 values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 167 sparse_values (SparseValues): [optional] # noqa: E501 168 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501 169 """ 170 171 _check_type = kwargs.pop("_check_type", True) 172 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 173 _path_to_item = kwargs.pop("_path_to_item", ()) 174 _configuration = kwargs.pop("_configuration", None) 175 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 176 177 self = super(OpenApiModel, cls).__new__(cls) 178 179 if args: 180 raise PineconeApiTypeError( 181 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 182 % ( 183 args, 184 self.__class__.__name__, 185 ), 186 path_to_item=_path_to_item, 187 valid_classes=(self.__class__,), 188 ) 189 190 self._data_store = {} 191 self._check_type = _check_type 192 self._spec_property_naming = _spec_property_naming 193 self._path_to_item = _path_to_item 194 self._configuration = _configuration 195 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 196 197 self.id = id 198 for var_name, var_value in kwargs.items(): 199 if ( 200 var_name not in self.attribute_map 201 and self._configuration is not None 202 and self._configuration.discard_unknown_keys 203 and self.additional_properties_type is None 204 ): 205 # discard variable. 206 continue 207 setattr(self, var_name, var_value) 208 return self 209 210 required_properties = set( 211 [ 212 "_data_store", 213 "_check_type", 214 "_spec_property_naming", 215 "_path_to_item", 216 "_configuration", 217 "_visited_composed_classes", 218 ] 219 ) 220 221 @convert_js_args_to_python_args 222 def __init__(self, id, *args, **kwargs): # noqa: E501 223 """ScoredVector - a model defined in OpenAPI 224 225 Args: 226 id (str): This is the vector's unique id. 227 228 Keyword Args: 229 _check_type (bool): if True, values for parameters in openapi_types 230 will be type checked and a TypeError will be 231 raised if the wrong type is input. 232 Defaults to True 233 _path_to_item (tuple/list): This is a list of keys or values to 234 drill down to the model in received_data 235 when deserializing a response 236 _spec_property_naming (bool): True if the variable names in the input data 237 are serialized names, as specified in the OpenAPI document. 238 False if the variable names in the input data 239 are pythonic names, e.g. snake case (default) 240 _configuration (Configuration): the instance to use when 241 deserializing a file_type parameter. 242 If passed, type conversion is attempted 243 If omitted no type conversion is done. 244 _visited_composed_classes (tuple): This stores a tuple of 245 classes that we have traveled through so that 246 if we see that class again we will not use its 247 discriminator again. 248 When traveling through a discriminator, the 249 composed schema that is 250 is traveled through is added to this set. 251 For example if Animal has a discriminator 252 petType and we pass in "Dog", and the class Dog 253 allOf includes Animal, we move through Animal 254 once using the discriminator, and pick Dog. 255 Then in Dog, we will make an instance of the 256 Animal class but this time we won't travel 257 through its discriminator because we passed in 258 _visited_composed_classes = (Animal,) 259 score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 260 values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 261 sparse_values (SparseValues): [optional] # noqa: E501 262 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501 263 """ 264 265 _check_type = kwargs.pop("_check_type", True) 266 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 267 _path_to_item = kwargs.pop("_path_to_item", ()) 268 _configuration = kwargs.pop("_configuration", None) 269 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 270 271 if args: 272 raise PineconeApiTypeError( 273 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 274 % ( 275 args, 276 self.__class__.__name__, 277 ), 278 path_to_item=_path_to_item, 279 valid_classes=(self.__class__,), 280 ) 281 282 self._data_store = {} 283 self._check_type = _check_type 284 self._spec_property_naming = _spec_property_naming 285 self._path_to_item = _path_to_item 286 self._configuration = _configuration 287 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 288 289 self.id = id 290 for var_name, var_value in kwargs.items(): 291 if ( 292 var_name not in self.attribute_map 293 and self._configuration is not None 294 and self._configuration.discard_unknown_keys 295 and self.additional_properties_type is None 296 ): 297 # discard variable. 298 continue 299 setattr(self, var_name, var_value) 300 if var_name in self.read_only_vars: 301 raise PineconeApiAttributeError( 302 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 303 f"class with read only attributes." 304 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
221 @convert_js_args_to_python_args 222 def __init__(self, id, *args, **kwargs): # noqa: E501 223 """ScoredVector - a model defined in OpenAPI 224 225 Args: 226 id (str): This is the vector's unique id. 227 228 Keyword Args: 229 _check_type (bool): if True, values for parameters in openapi_types 230 will be type checked and a TypeError will be 231 raised if the wrong type is input. 232 Defaults to True 233 _path_to_item (tuple/list): This is a list of keys or values to 234 drill down to the model in received_data 235 when deserializing a response 236 _spec_property_naming (bool): True if the variable names in the input data 237 are serialized names, as specified in the OpenAPI document. 238 False if the variable names in the input data 239 are pythonic names, e.g. snake case (default) 240 _configuration (Configuration): the instance to use when 241 deserializing a file_type parameter. 242 If passed, type conversion is attempted 243 If omitted no type conversion is done. 244 _visited_composed_classes (tuple): This stores a tuple of 245 classes that we have traveled through so that 246 if we see that class again we will not use its 247 discriminator again. 248 When traveling through a discriminator, the 249 composed schema that is 250 is traveled through is added to this set. 251 For example if Animal has a discriminator 252 petType and we pass in "Dog", and the class Dog 253 allOf includes Animal, we move through Animal 254 once using the discriminator, and pick Dog. 255 Then in Dog, we will make an instance of the 256 Animal class but this time we won't travel 257 through its discriminator because we passed in 258 _visited_composed_classes = (Animal,) 259 score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 260 values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 261 sparse_values (SparseValues): [optional] # noqa: E501 262 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501 263 """ 264 265 _check_type = kwargs.pop("_check_type", True) 266 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 267 _path_to_item = kwargs.pop("_path_to_item", ()) 268 _configuration = kwargs.pop("_configuration", None) 269 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 270 271 if args: 272 raise PineconeApiTypeError( 273 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 274 % ( 275 args, 276 self.__class__.__name__, 277 ), 278 path_to_item=_path_to_item, 279 valid_classes=(self.__class__,), 280 ) 281 282 self._data_store = {} 283 self._check_type = _check_type 284 self._spec_property_naming = _spec_property_naming 285 self._path_to_item = _path_to_item 286 self._configuration = _configuration 287 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 288 289 self.id = id 290 for var_name, var_value in kwargs.items(): 291 if ( 292 var_name not in self.attribute_map 293 and self._configuration is not None 294 and self._configuration.discard_unknown_keys 295 and self.additional_properties_type is None 296 ): 297 # discard variable. 298 continue 299 setattr(self, var_name, var_value) 300 if var_name in self.read_only_vars: 301 raise PineconeApiAttributeError( 302 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 303 f"class with read only attributes." 304 )
ScoredVector - a model defined in OpenAPI
Arguments:
- id (str): This is the vector's unique id.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) score (float): This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar.. [optional] # noqa: E501 values ([float]): This is the vector data, if it is requested.. [optional] # noqa: E501 sparse_values (SparseValues): [optional] # noqa: E501 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata, if it is requested.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class SingleQueryResults(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = {} 66 67 @cached_property 68 def additional_properties_type(): 69 """ 70 This must be a method because a model may have properties that are 71 of type self, this must run after the class is loaded 72 """ 73 lazy_import() 74 return ( 75 bool, 76 dict, 77 float, 78 int, 79 list, 80 str, 81 none_type, 82 ) # noqa: E501 83 84 _nullable = False 85 86 @cached_property 87 def openapi_types(): 88 """ 89 This must be a method because a model may have properties that are 90 of type self, this must run after the class is loaded 91 92 Returns 93 openapi_types (dict): The key is attribute name 94 and the value is attribute type. 95 """ 96 lazy_import() 97 return { 98 "matches": ([ScoredVector],), # noqa: E501 99 "namespace": (str,), # noqa: E501 100 } 101 102 @cached_property 103 def discriminator(): 104 return None 105 106 attribute_map = { 107 "matches": "matches", # noqa: E501 108 "namespace": "namespace", # noqa: E501 109 } 110 111 read_only_vars = {} 112 113 _composed_schemas = {} 114 115 @classmethod 116 @convert_js_args_to_python_args 117 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 118 """SingleQueryResults - a model defined in OpenAPI 119 120 Keyword Args: 121 _check_type (bool): if True, values for parameters in openapi_types 122 will be type checked and a TypeError will be 123 raised if the wrong type is input. 124 Defaults to True 125 _path_to_item (tuple/list): This is a list of keys or values to 126 drill down to the model in received_data 127 when deserializing a response 128 _spec_property_naming (bool): True if the variable names in the input data 129 are serialized names, as specified in the OpenAPI document. 130 False if the variable names in the input data 131 are pythonic names, e.g. snake case (default) 132 _configuration (Configuration): the instance to use when 133 deserializing a file_type parameter. 134 If passed, type conversion is attempted 135 If omitted no type conversion is done. 136 _visited_composed_classes (tuple): This stores a tuple of 137 classes that we have traveled through so that 138 if we see that class again we will not use its 139 discriminator again. 140 When traveling through a discriminator, the 141 composed schema that is 142 is traveled through is added to this set. 143 For example if Animal has a discriminator 144 petType and we pass in "Dog", and the class Dog 145 allOf includes Animal, we move through Animal 146 once using the discriminator, and pick Dog. 147 Then in Dog, we will make an instance of the 148 Animal class but this time we won't travel 149 through its discriminator because we passed in 150 _visited_composed_classes = (Animal,) 151 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 152 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 153 """ 154 155 _check_type = kwargs.pop("_check_type", True) 156 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 157 _path_to_item = kwargs.pop("_path_to_item", ()) 158 _configuration = kwargs.pop("_configuration", None) 159 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 160 161 self = super(OpenApiModel, cls).__new__(cls) 162 163 if args: 164 raise PineconeApiTypeError( 165 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 166 % ( 167 args, 168 self.__class__.__name__, 169 ), 170 path_to_item=_path_to_item, 171 valid_classes=(self.__class__,), 172 ) 173 174 self._data_store = {} 175 self._check_type = _check_type 176 self._spec_property_naming = _spec_property_naming 177 self._path_to_item = _path_to_item 178 self._configuration = _configuration 179 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 180 181 for var_name, var_value in kwargs.items(): 182 if ( 183 var_name not in self.attribute_map 184 and self._configuration is not None 185 and self._configuration.discard_unknown_keys 186 and self.additional_properties_type is None 187 ): 188 # discard variable. 189 continue 190 setattr(self, var_name, var_value) 191 return self 192 193 required_properties = set( 194 [ 195 "_data_store", 196 "_check_type", 197 "_spec_property_naming", 198 "_path_to_item", 199 "_configuration", 200 "_visited_composed_classes", 201 ] 202 ) 203 204 @convert_js_args_to_python_args 205 def __init__(self, *args, **kwargs): # noqa: E501 206 """SingleQueryResults - a model defined in OpenAPI 207 208 Keyword Args: 209 _check_type (bool): if True, values for parameters in openapi_types 210 will be type checked and a TypeError will be 211 raised if the wrong type is input. 212 Defaults to True 213 _path_to_item (tuple/list): This is a list of keys or values to 214 drill down to the model in received_data 215 when deserializing a response 216 _spec_property_naming (bool): True if the variable names in the input data 217 are serialized names, as specified in the OpenAPI document. 218 False if the variable names in the input data 219 are pythonic names, e.g. snake case (default) 220 _configuration (Configuration): the instance to use when 221 deserializing a file_type parameter. 222 If passed, type conversion is attempted 223 If omitted no type conversion is done. 224 _visited_composed_classes (tuple): This stores a tuple of 225 classes that we have traveled through so that 226 if we see that class again we will not use its 227 discriminator again. 228 When traveling through a discriminator, the 229 composed schema that is 230 is traveled through is added to this set. 231 For example if Animal has a discriminator 232 petType and we pass in "Dog", and the class Dog 233 allOf includes Animal, we move through Animal 234 once using the discriminator, and pick Dog. 235 Then in Dog, we will make an instance of the 236 Animal class but this time we won't travel 237 through its discriminator because we passed in 238 _visited_composed_classes = (Animal,) 239 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 240 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 241 """ 242 243 _check_type = kwargs.pop("_check_type", True) 244 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 245 _path_to_item = kwargs.pop("_path_to_item", ()) 246 _configuration = kwargs.pop("_configuration", None) 247 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 248 249 if args: 250 raise PineconeApiTypeError( 251 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 252 % ( 253 args, 254 self.__class__.__name__, 255 ), 256 path_to_item=_path_to_item, 257 valid_classes=(self.__class__,), 258 ) 259 260 self._data_store = {} 261 self._check_type = _check_type 262 self._spec_property_naming = _spec_property_naming 263 self._path_to_item = _path_to_item 264 self._configuration = _configuration 265 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 266 267 for var_name, var_value in kwargs.items(): 268 if ( 269 var_name not in self.attribute_map 270 and self._configuration is not None 271 and self._configuration.discard_unknown_keys 272 and self.additional_properties_type is None 273 ): 274 # discard variable. 275 continue 276 setattr(self, var_name, var_value) 277 if var_name in self.read_only_vars: 278 raise PineconeApiAttributeError( 279 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 280 f"class with read only attributes." 281 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
204 @convert_js_args_to_python_args 205 def __init__(self, *args, **kwargs): # noqa: E501 206 """SingleQueryResults - a model defined in OpenAPI 207 208 Keyword Args: 209 _check_type (bool): if True, values for parameters in openapi_types 210 will be type checked and a TypeError will be 211 raised if the wrong type is input. 212 Defaults to True 213 _path_to_item (tuple/list): This is a list of keys or values to 214 drill down to the model in received_data 215 when deserializing a response 216 _spec_property_naming (bool): True if the variable names in the input data 217 are serialized names, as specified in the OpenAPI document. 218 False if the variable names in the input data 219 are pythonic names, e.g. snake case (default) 220 _configuration (Configuration): the instance to use when 221 deserializing a file_type parameter. 222 If passed, type conversion is attempted 223 If omitted no type conversion is done. 224 _visited_composed_classes (tuple): This stores a tuple of 225 classes that we have traveled through so that 226 if we see that class again we will not use its 227 discriminator again. 228 When traveling through a discriminator, the 229 composed schema that is 230 is traveled through is added to this set. 231 For example if Animal has a discriminator 232 petType and we pass in "Dog", and the class Dog 233 allOf includes Animal, we move through Animal 234 once using the discriminator, and pick Dog. 235 Then in Dog, we will make an instance of the 236 Animal class but this time we won't travel 237 through its discriminator because we passed in 238 _visited_composed_classes = (Animal,) 239 matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 240 namespace (str): The namespace for the vectors.. [optional] # noqa: E501 241 """ 242 243 _check_type = kwargs.pop("_check_type", True) 244 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 245 _path_to_item = kwargs.pop("_path_to_item", ()) 246 _configuration = kwargs.pop("_configuration", None) 247 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 248 249 if args: 250 raise PineconeApiTypeError( 251 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 252 % ( 253 args, 254 self.__class__.__name__, 255 ), 256 path_to_item=_path_to_item, 257 valid_classes=(self.__class__,), 258 ) 259 260 self._data_store = {} 261 self._check_type = _check_type 262 self._spec_property_naming = _spec_property_naming 263 self._path_to_item = _path_to_item 264 self._configuration = _configuration 265 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 266 267 for var_name, var_value in kwargs.items(): 268 if ( 269 var_name not in self.attribute_map 270 and self._configuration is not None 271 and self._configuration.discard_unknown_keys 272 and self.additional_properties_type is None 273 ): 274 # discard variable. 275 continue 276 setattr(self, var_name, var_value) 277 if var_name in self.read_only_vars: 278 raise PineconeApiAttributeError( 279 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 280 f"class with read only attributes." 281 )
SingleQueryResults - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) matches ([ScoredVector]): The matches for the vectors.. [optional] # noqa: E501 namespace (str): The namespace for the vectors.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class DescribeIndexStatsResponse(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = {} 66 67 @cached_property 68 def additional_properties_type(): 69 """ 70 This must be a method because a model may have properties that are 71 of type self, this must run after the class is loaded 72 """ 73 lazy_import() 74 return ( 75 bool, 76 dict, 77 float, 78 int, 79 list, 80 str, 81 none_type, 82 ) # noqa: E501 83 84 _nullable = False 85 86 @cached_property 87 def openapi_types(): 88 """ 89 This must be a method because a model may have properties that are 90 of type self, this must run after the class is loaded 91 92 Returns 93 openapi_types (dict): The key is attribute name 94 and the value is attribute type. 95 """ 96 lazy_import() 97 return { 98 "namespaces": ({str: (NamespaceSummary,)},), # noqa: E501 99 "dimension": (int,), # noqa: E501 100 "index_fullness": (float,), # noqa: E501 101 "total_vector_count": (int,), # noqa: E501 102 } 103 104 @cached_property 105 def discriminator(): 106 return None 107 108 attribute_map = { 109 "namespaces": "namespaces", # noqa: E501 110 "dimension": "dimension", # noqa: E501 111 "index_fullness": "indexFullness", # noqa: E501 112 "total_vector_count": "totalVectorCount", # noqa: E501 113 } 114 115 read_only_vars = {} 116 117 _composed_schemas = {} 118 119 @classmethod 120 @convert_js_args_to_python_args 121 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 122 """DescribeIndexStatsResponse - a model defined in OpenAPI 123 124 Keyword Args: 125 _check_type (bool): if True, values for parameters in openapi_types 126 will be type checked and a TypeError will be 127 raised if the wrong type is input. 128 Defaults to True 129 _path_to_item (tuple/list): This is a list of keys or values to 130 drill down to the model in received_data 131 when deserializing a response 132 _spec_property_naming (bool): True if the variable names in the input data 133 are serialized names, as specified in the OpenAPI document. 134 False if the variable names in the input data 135 are pythonic names, e.g. snake case (default) 136 _configuration (Configuration): the instance to use when 137 deserializing a file_type parameter. 138 If passed, type conversion is attempted 139 If omitted no type conversion is done. 140 _visited_composed_classes (tuple): This stores a tuple of 141 classes that we have traveled through so that 142 if we see that class again we will not use its 143 discriminator again. 144 When traveling through a discriminator, the 145 composed schema that is 146 is traveled through is added to this set. 147 For example if Animal has a discriminator 148 petType and we pass in "Dog", and the class Dog 149 allOf includes Animal, we move through Animal 150 once using the discriminator, and pick Dog. 151 Then in Dog, we will make an instance of the 152 Animal class but this time we won't travel 153 through its discriminator because we passed in 154 _visited_composed_classes = (Animal,) 155 namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 156 dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 157 index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). . [optional] # noqa: E501 158 total_vector_count (int): The total number of vectors in the index, regardless of whether a metadata filter expression was passed. [optional] # noqa: E501 159 """ 160 161 _check_type = kwargs.pop("_check_type", True) 162 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 163 _path_to_item = kwargs.pop("_path_to_item", ()) 164 _configuration = kwargs.pop("_configuration", None) 165 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 166 167 self = super(OpenApiModel, cls).__new__(cls) 168 169 if args: 170 raise PineconeApiTypeError( 171 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 172 % ( 173 args, 174 self.__class__.__name__, 175 ), 176 path_to_item=_path_to_item, 177 valid_classes=(self.__class__,), 178 ) 179 180 self._data_store = {} 181 self._check_type = _check_type 182 self._spec_property_naming = _spec_property_naming 183 self._path_to_item = _path_to_item 184 self._configuration = _configuration 185 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 186 187 for var_name, var_value in kwargs.items(): 188 if ( 189 var_name not in self.attribute_map 190 and self._configuration is not None 191 and self._configuration.discard_unknown_keys 192 and self.additional_properties_type is None 193 ): 194 # discard variable. 195 continue 196 setattr(self, var_name, var_value) 197 return self 198 199 required_properties = set( 200 [ 201 "_data_store", 202 "_check_type", 203 "_spec_property_naming", 204 "_path_to_item", 205 "_configuration", 206 "_visited_composed_classes", 207 ] 208 ) 209 210 @convert_js_args_to_python_args 211 def __init__(self, *args, **kwargs): # noqa: E501 212 """DescribeIndexStatsResponse - a model defined in OpenAPI 213 214 Keyword Args: 215 _check_type (bool): if True, values for parameters in openapi_types 216 will be type checked and a TypeError will be 217 raised if the wrong type is input. 218 Defaults to True 219 _path_to_item (tuple/list): This is a list of keys or values to 220 drill down to the model in received_data 221 when deserializing a response 222 _spec_property_naming (bool): True if the variable names in the input data 223 are serialized names, as specified in the OpenAPI document. 224 False if the variable names in the input data 225 are pythonic names, e.g. snake case (default) 226 _configuration (Configuration): the instance to use when 227 deserializing a file_type parameter. 228 If passed, type conversion is attempted 229 If omitted no type conversion is done. 230 _visited_composed_classes (tuple): This stores a tuple of 231 classes that we have traveled through so that 232 if we see that class again we will not use its 233 discriminator again. 234 When traveling through a discriminator, the 235 composed schema that is 236 is traveled through is added to this set. 237 For example if Animal has a discriminator 238 petType and we pass in "Dog", and the class Dog 239 allOf includes Animal, we move through Animal 240 once using the discriminator, and pick Dog. 241 Then in Dog, we will make an instance of the 242 Animal class but this time we won't travel 243 through its discriminator because we passed in 244 _visited_composed_classes = (Animal,) 245 namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 246 dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 247 index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). . [optional] # noqa: E501 248 total_vector_count (int): The total number of vectors in the index, regardless of whether a metadata filter expression was passed. [optional] # noqa: E501 249 """ 250 251 _check_type = kwargs.pop("_check_type", True) 252 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 253 _path_to_item = kwargs.pop("_path_to_item", ()) 254 _configuration = kwargs.pop("_configuration", None) 255 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 256 257 if args: 258 raise PineconeApiTypeError( 259 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 260 % ( 261 args, 262 self.__class__.__name__, 263 ), 264 path_to_item=_path_to_item, 265 valid_classes=(self.__class__,), 266 ) 267 268 self._data_store = {} 269 self._check_type = _check_type 270 self._spec_property_naming = _spec_property_naming 271 self._path_to_item = _path_to_item 272 self._configuration = _configuration 273 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 274 275 for var_name, var_value in kwargs.items(): 276 if ( 277 var_name not in self.attribute_map 278 and self._configuration is not None 279 and self._configuration.discard_unknown_keys 280 and self.additional_properties_type is None 281 ): 282 # discard variable. 283 continue 284 setattr(self, var_name, var_value) 285 if var_name in self.read_only_vars: 286 raise PineconeApiAttributeError( 287 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 288 f"class with read only attributes." 289 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
210 @convert_js_args_to_python_args 211 def __init__(self, *args, **kwargs): # noqa: E501 212 """DescribeIndexStatsResponse - a model defined in OpenAPI 213 214 Keyword Args: 215 _check_type (bool): if True, values for parameters in openapi_types 216 will be type checked and a TypeError will be 217 raised if the wrong type is input. 218 Defaults to True 219 _path_to_item (tuple/list): This is a list of keys or values to 220 drill down to the model in received_data 221 when deserializing a response 222 _spec_property_naming (bool): True if the variable names in the input data 223 are serialized names, as specified in the OpenAPI document. 224 False if the variable names in the input data 225 are pythonic names, e.g. snake case (default) 226 _configuration (Configuration): the instance to use when 227 deserializing a file_type parameter. 228 If passed, type conversion is attempted 229 If omitted no type conversion is done. 230 _visited_composed_classes (tuple): This stores a tuple of 231 classes that we have traveled through so that 232 if we see that class again we will not use its 233 discriminator again. 234 When traveling through a discriminator, the 235 composed schema that is 236 is traveled through is added to this set. 237 For example if Animal has a discriminator 238 petType and we pass in "Dog", and the class Dog 239 allOf includes Animal, we move through Animal 240 once using the discriminator, and pick Dog. 241 Then in Dog, we will make an instance of the 242 Animal class but this time we won't travel 243 through its discriminator because we passed in 244 _visited_composed_classes = (Animal,) 245 namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 246 dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 247 index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). . [optional] # noqa: E501 248 total_vector_count (int): The total number of vectors in the index, regardless of whether a metadata filter expression was passed. [optional] # noqa: E501 249 """ 250 251 _check_type = kwargs.pop("_check_type", True) 252 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 253 _path_to_item = kwargs.pop("_path_to_item", ()) 254 _configuration = kwargs.pop("_configuration", None) 255 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 256 257 if args: 258 raise PineconeApiTypeError( 259 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 260 % ( 261 args, 262 self.__class__.__name__, 263 ), 264 path_to_item=_path_to_item, 265 valid_classes=(self.__class__,), 266 ) 267 268 self._data_store = {} 269 self._check_type = _check_type 270 self._spec_property_naming = _spec_property_naming 271 self._path_to_item = _path_to_item 272 self._configuration = _configuration 273 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 274 275 for var_name, var_value in kwargs.items(): 276 if ( 277 var_name not in self.attribute_map 278 and self._configuration is not None 279 and self._configuration.discard_unknown_keys 280 and self.additional_properties_type is None 281 ): 282 # discard variable. 283 continue 284 setattr(self, var_name, var_value) 285 if var_name in self.read_only_vars: 286 raise PineconeApiAttributeError( 287 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 288 f"class with read only attributes." 289 )
DescribeIndexStatsResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) namespaces ({str: (NamespaceSummary,)}): A mapping for each namespace in the index from the namespace name to a summary of its contents. If a metadata filter expression is present, the summary will reflect only vectors matching that expression.. [optional] # noqa: E501 dimension (int): The dimension of the indexed vectors.. [optional] # noqa: E501 index_fullness (float): The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use
describe_index
. . [optional] # noqa: E501 total_vector_count (int): The total number of vectors in the index, regardless of whether a metadata filter expression was passed. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class UpsertRequest(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = { 66 ("vectors",): {}, 67 } 68 69 @cached_property 70 def additional_properties_type(): 71 """ 72 This must be a method because a model may have properties that are 73 of type self, this must run after the class is loaded 74 """ 75 lazy_import() 76 return ( 77 bool, 78 dict, 79 float, 80 int, 81 list, 82 str, 83 none_type, 84 ) # noqa: E501 85 86 _nullable = False 87 88 @cached_property 89 def openapi_types(): 90 """ 91 This must be a method because a model may have properties that are 92 of type self, this must run after the class is loaded 93 94 Returns 95 openapi_types (dict): The key is attribute name 96 and the value is attribute type. 97 """ 98 lazy_import() 99 return { 100 "vectors": ([Vector],), # noqa: E501 101 "namespace": (str,), # noqa: E501 102 } 103 104 @cached_property 105 def discriminator(): 106 return None 107 108 attribute_map = { 109 "vectors": "vectors", # noqa: E501 110 "namespace": "namespace", # noqa: E501 111 } 112 113 read_only_vars = {} 114 115 _composed_schemas = {} 116 117 @classmethod 118 @convert_js_args_to_python_args 119 def _from_openapi_data(cls, vectors, *args, **kwargs): # noqa: E501 120 """UpsertRequest - a model defined in OpenAPI 121 122 Args: 123 vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors. 124 125 Keyword Args: 126 _check_type (bool): if True, values for parameters in openapi_types 127 will be type checked and a TypeError will be 128 raised if the wrong type is input. 129 Defaults to True 130 _path_to_item (tuple/list): This is a list of keys or values to 131 drill down to the model in received_data 132 when deserializing a response 133 _spec_property_naming (bool): True if the variable names in the input data 134 are serialized names, as specified in the OpenAPI document. 135 False if the variable names in the input data 136 are pythonic names, e.g. snake case (default) 137 _configuration (Configuration): the instance to use when 138 deserializing a file_type parameter. 139 If passed, type conversion is attempted 140 If omitted no type conversion is done. 141 _visited_composed_classes (tuple): This stores a tuple of 142 classes that we have traveled through so that 143 if we see that class again we will not use its 144 discriminator again. 145 When traveling through a discriminator, the 146 composed schema that is 147 is traveled through is added to this set. 148 For example if Animal has a discriminator 149 petType and we pass in "Dog", and the class Dog 150 allOf includes Animal, we move through Animal 151 once using the discriminator, and pick Dog. 152 Then in Dog, we will make an instance of the 153 Animal class but this time we won't travel 154 through its discriminator because we passed in 155 _visited_composed_classes = (Animal,) 156 namespace (str): The namespace where you upsert vectors.. [optional] # noqa: E501 157 """ 158 159 _check_type = kwargs.pop("_check_type", True) 160 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 161 _path_to_item = kwargs.pop("_path_to_item", ()) 162 _configuration = kwargs.pop("_configuration", None) 163 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 164 165 self = super(OpenApiModel, cls).__new__(cls) 166 167 if args: 168 raise PineconeApiTypeError( 169 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 170 % ( 171 args, 172 self.__class__.__name__, 173 ), 174 path_to_item=_path_to_item, 175 valid_classes=(self.__class__,), 176 ) 177 178 self._data_store = {} 179 self._check_type = _check_type 180 self._spec_property_naming = _spec_property_naming 181 self._path_to_item = _path_to_item 182 self._configuration = _configuration 183 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 184 185 self.vectors = vectors 186 for var_name, var_value in kwargs.items(): 187 if ( 188 var_name not in self.attribute_map 189 and self._configuration is not None 190 and self._configuration.discard_unknown_keys 191 and self.additional_properties_type is None 192 ): 193 # discard variable. 194 continue 195 setattr(self, var_name, var_value) 196 return self 197 198 required_properties = set( 199 [ 200 "_data_store", 201 "_check_type", 202 "_spec_property_naming", 203 "_path_to_item", 204 "_configuration", 205 "_visited_composed_classes", 206 ] 207 ) 208 209 @convert_js_args_to_python_args 210 def __init__(self, vectors, *args, **kwargs): # noqa: E501 211 """UpsertRequest - a model defined in OpenAPI 212 213 Args: 214 vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors. 215 216 Keyword Args: 217 _check_type (bool): if True, values for parameters in openapi_types 218 will be type checked and a TypeError will be 219 raised if the wrong type is input. 220 Defaults to True 221 _path_to_item (tuple/list): This is a list of keys or values to 222 drill down to the model in received_data 223 when deserializing a response 224 _spec_property_naming (bool): True if the variable names in the input data 225 are serialized names, as specified in the OpenAPI document. 226 False if the variable names in the input data 227 are pythonic names, e.g. snake case (default) 228 _configuration (Configuration): the instance to use when 229 deserializing a file_type parameter. 230 If passed, type conversion is attempted 231 If omitted no type conversion is done. 232 _visited_composed_classes (tuple): This stores a tuple of 233 classes that we have traveled through so that 234 if we see that class again we will not use its 235 discriminator again. 236 When traveling through a discriminator, the 237 composed schema that is 238 is traveled through is added to this set. 239 For example if Animal has a discriminator 240 petType and we pass in "Dog", and the class Dog 241 allOf includes Animal, we move through Animal 242 once using the discriminator, and pick Dog. 243 Then in Dog, we will make an instance of the 244 Animal class but this time we won't travel 245 through its discriminator because we passed in 246 _visited_composed_classes = (Animal,) 247 namespace (str): The namespace where you upsert vectors.. [optional] # noqa: E501 248 """ 249 250 _check_type = kwargs.pop("_check_type", True) 251 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 252 _path_to_item = kwargs.pop("_path_to_item", ()) 253 _configuration = kwargs.pop("_configuration", None) 254 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 255 256 if args: 257 raise PineconeApiTypeError( 258 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 259 % ( 260 args, 261 self.__class__.__name__, 262 ), 263 path_to_item=_path_to_item, 264 valid_classes=(self.__class__,), 265 ) 266 267 self._data_store = {} 268 self._check_type = _check_type 269 self._spec_property_naming = _spec_property_naming 270 self._path_to_item = _path_to_item 271 self._configuration = _configuration 272 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 273 274 self.vectors = vectors 275 for var_name, var_value in kwargs.items(): 276 if ( 277 var_name not in self.attribute_map 278 and self._configuration is not None 279 and self._configuration.discard_unknown_keys 280 and self.additional_properties_type is None 281 ): 282 # discard variable. 283 continue 284 setattr(self, var_name, var_value) 285 if var_name in self.read_only_vars: 286 raise PineconeApiAttributeError( 287 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 288 f"class with read only attributes." 289 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
209 @convert_js_args_to_python_args 210 def __init__(self, vectors, *args, **kwargs): # noqa: E501 211 """UpsertRequest - a model defined in OpenAPI 212 213 Args: 214 vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors. 215 216 Keyword Args: 217 _check_type (bool): if True, values for parameters in openapi_types 218 will be type checked and a TypeError will be 219 raised if the wrong type is input. 220 Defaults to True 221 _path_to_item (tuple/list): This is a list of keys or values to 222 drill down to the model in received_data 223 when deserializing a response 224 _spec_property_naming (bool): True if the variable names in the input data 225 are serialized names, as specified in the OpenAPI document. 226 False if the variable names in the input data 227 are pythonic names, e.g. snake case (default) 228 _configuration (Configuration): the instance to use when 229 deserializing a file_type parameter. 230 If passed, type conversion is attempted 231 If omitted no type conversion is done. 232 _visited_composed_classes (tuple): This stores a tuple of 233 classes that we have traveled through so that 234 if we see that class again we will not use its 235 discriminator again. 236 When traveling through a discriminator, the 237 composed schema that is 238 is traveled through is added to this set. 239 For example if Animal has a discriminator 240 petType and we pass in "Dog", and the class Dog 241 allOf includes Animal, we move through Animal 242 once using the discriminator, and pick Dog. 243 Then in Dog, we will make an instance of the 244 Animal class but this time we won't travel 245 through its discriminator because we passed in 246 _visited_composed_classes = (Animal,) 247 namespace (str): The namespace where you upsert vectors.. [optional] # noqa: E501 248 """ 249 250 _check_type = kwargs.pop("_check_type", True) 251 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 252 _path_to_item = kwargs.pop("_path_to_item", ()) 253 _configuration = kwargs.pop("_configuration", None) 254 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 255 256 if args: 257 raise PineconeApiTypeError( 258 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 259 % ( 260 args, 261 self.__class__.__name__, 262 ), 263 path_to_item=_path_to_item, 264 valid_classes=(self.__class__,), 265 ) 266 267 self._data_store = {} 268 self._check_type = _check_type 269 self._spec_property_naming = _spec_property_naming 270 self._path_to_item = _path_to_item 271 self._configuration = _configuration 272 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 273 274 self.vectors = vectors 275 for var_name, var_value in kwargs.items(): 276 if ( 277 var_name not in self.attribute_map 278 and self._configuration is not None 279 and self._configuration.discard_unknown_keys 280 and self.additional_properties_type is None 281 ): 282 # discard variable. 283 continue 284 setattr(self, var_name, var_value) 285 if var_name in self.read_only_vars: 286 raise PineconeApiAttributeError( 287 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 288 f"class with read only attributes." 289 )
UpsertRequest - a model defined in OpenAPI
Arguments:
- vectors ([Vector]): An array containing the vectors to upsert. Recommended batch limit is 100 vectors.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) namespace (str): The namespace where you upsert vectors.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
33class UpsertResponse(ModelNormal): 34 """NOTE: This class is auto generated by OpenAPI Generator. 35 Ref: https://openapi-generator.tech 36 37 Do not edit the class manually. 38 39 Attributes: 40 allowed_values (dict): The key is the tuple path to the attribute 41 and the for var_name this is (var_name,). The value is a dict 42 with a capitalized key describing the allowed value and an allowed 43 value. These dicts store the allowed enum values. 44 attribute_map (dict): The key is attribute name 45 and the value is json key in definition. 46 discriminator_value_class_map (dict): A dict to go from the discriminator 47 variable value to the discriminator class name. 48 validations (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 that stores validations for max_length, min_length, max_items, 51 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 52 inclusive_minimum, and regex. 53 additional_properties_type (tuple): A tuple of classes accepted 54 as additional properties values. 55 """ 56 57 allowed_values = {} 58 59 validations = {} 60 61 @cached_property 62 def additional_properties_type(): 63 """ 64 This must be a method because a model may have properties that are 65 of type self, this must run after the class is loaded 66 """ 67 return ( 68 bool, 69 dict, 70 float, 71 int, 72 list, 73 str, 74 none_type, 75 ) # noqa: E501 76 77 _nullable = False 78 79 @cached_property 80 def openapi_types(): 81 """ 82 This must be a method because a model may have properties that are 83 of type self, this must run after the class is loaded 84 85 Returns 86 openapi_types (dict): The key is attribute name 87 and the value is attribute type. 88 """ 89 return { 90 "upserted_count": (int,), # noqa: E501 91 } 92 93 @cached_property 94 def discriminator(): 95 return None 96 97 attribute_map = { 98 "upserted_count": "upsertedCount", # noqa: E501 99 } 100 101 read_only_vars = {} 102 103 _composed_schemas = {} 104 105 @classmethod 106 @convert_js_args_to_python_args 107 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 108 """UpsertResponse - a model defined in OpenAPI 109 110 Keyword Args: 111 _check_type (bool): if True, values for parameters in openapi_types 112 will be type checked and a TypeError will be 113 raised if the wrong type is input. 114 Defaults to True 115 _path_to_item (tuple/list): This is a list of keys or values to 116 drill down to the model in received_data 117 when deserializing a response 118 _spec_property_naming (bool): True if the variable names in the input data 119 are serialized names, as specified in the OpenAPI document. 120 False if the variable names in the input data 121 are pythonic names, e.g. snake case (default) 122 _configuration (Configuration): the instance to use when 123 deserializing a file_type parameter. 124 If passed, type conversion is attempted 125 If omitted no type conversion is done. 126 _visited_composed_classes (tuple): This stores a tuple of 127 classes that we have traveled through so that 128 if we see that class again we will not use its 129 discriminator again. 130 When traveling through a discriminator, the 131 composed schema that is 132 is traveled through is added to this set. 133 For example if Animal has a discriminator 134 petType and we pass in "Dog", and the class Dog 135 allOf includes Animal, we move through Animal 136 once using the discriminator, and pick Dog. 137 Then in Dog, we will make an instance of the 138 Animal class but this time we won't travel 139 through its discriminator because we passed in 140 _visited_composed_classes = (Animal,) 141 upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501 142 """ 143 144 _check_type = kwargs.pop("_check_type", True) 145 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 146 _path_to_item = kwargs.pop("_path_to_item", ()) 147 _configuration = kwargs.pop("_configuration", None) 148 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 149 150 self = super(OpenApiModel, cls).__new__(cls) 151 152 if args: 153 raise PineconeApiTypeError( 154 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 155 % ( 156 args, 157 self.__class__.__name__, 158 ), 159 path_to_item=_path_to_item, 160 valid_classes=(self.__class__,), 161 ) 162 163 self._data_store = {} 164 self._check_type = _check_type 165 self._spec_property_naming = _spec_property_naming 166 self._path_to_item = _path_to_item 167 self._configuration = _configuration 168 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 169 170 for var_name, var_value in kwargs.items(): 171 if ( 172 var_name not in self.attribute_map 173 and self._configuration is not None 174 and self._configuration.discard_unknown_keys 175 and self.additional_properties_type is None 176 ): 177 # discard variable. 178 continue 179 setattr(self, var_name, var_value) 180 return self 181 182 required_properties = set( 183 [ 184 "_data_store", 185 "_check_type", 186 "_spec_property_naming", 187 "_path_to_item", 188 "_configuration", 189 "_visited_composed_classes", 190 ] 191 ) 192 193 @convert_js_args_to_python_args 194 def __init__(self, *args, **kwargs): # noqa: E501 195 """UpsertResponse - a model defined in OpenAPI 196 197 Keyword Args: 198 _check_type (bool): if True, values for parameters in openapi_types 199 will be type checked and a TypeError will be 200 raised if the wrong type is input. 201 Defaults to True 202 _path_to_item (tuple/list): This is a list of keys or values to 203 drill down to the model in received_data 204 when deserializing a response 205 _spec_property_naming (bool): True if the variable names in the input data 206 are serialized names, as specified in the OpenAPI document. 207 False if the variable names in the input data 208 are pythonic names, e.g. snake case (default) 209 _configuration (Configuration): the instance to use when 210 deserializing a file_type parameter. 211 If passed, type conversion is attempted 212 If omitted no type conversion is done. 213 _visited_composed_classes (tuple): This stores a tuple of 214 classes that we have traveled through so that 215 if we see that class again we will not use its 216 discriminator again. 217 When traveling through a discriminator, the 218 composed schema that is 219 is traveled through is added to this set. 220 For example if Animal has a discriminator 221 petType and we pass in "Dog", and the class Dog 222 allOf includes Animal, we move through Animal 223 once using the discriminator, and pick Dog. 224 Then in Dog, we will make an instance of the 225 Animal class but this time we won't travel 226 through its discriminator because we passed in 227 _visited_composed_classes = (Animal,) 228 upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501 229 """ 230 231 _check_type = kwargs.pop("_check_type", True) 232 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 233 _path_to_item = kwargs.pop("_path_to_item", ()) 234 _configuration = kwargs.pop("_configuration", None) 235 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 236 237 if args: 238 raise PineconeApiTypeError( 239 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 240 % ( 241 args, 242 self.__class__.__name__, 243 ), 244 path_to_item=_path_to_item, 245 valid_classes=(self.__class__,), 246 ) 247 248 self._data_store = {} 249 self._check_type = _check_type 250 self._spec_property_naming = _spec_property_naming 251 self._path_to_item = _path_to_item 252 self._configuration = _configuration 253 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 254 255 for var_name, var_value in kwargs.items(): 256 if ( 257 var_name not in self.attribute_map 258 and self._configuration is not None 259 and self._configuration.discard_unknown_keys 260 and self.additional_properties_type is None 261 ): 262 # discard variable. 263 continue 264 setattr(self, var_name, var_value) 265 if var_name in self.read_only_vars: 266 raise PineconeApiAttributeError( 267 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 268 f"class with read only attributes." 269 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
193 @convert_js_args_to_python_args 194 def __init__(self, *args, **kwargs): # noqa: E501 195 """UpsertResponse - a model defined in OpenAPI 196 197 Keyword Args: 198 _check_type (bool): if True, values for parameters in openapi_types 199 will be type checked and a TypeError will be 200 raised if the wrong type is input. 201 Defaults to True 202 _path_to_item (tuple/list): This is a list of keys or values to 203 drill down to the model in received_data 204 when deserializing a response 205 _spec_property_naming (bool): True if the variable names in the input data 206 are serialized names, as specified in the OpenAPI document. 207 False if the variable names in the input data 208 are pythonic names, e.g. snake case (default) 209 _configuration (Configuration): the instance to use when 210 deserializing a file_type parameter. 211 If passed, type conversion is attempted 212 If omitted no type conversion is done. 213 _visited_composed_classes (tuple): This stores a tuple of 214 classes that we have traveled through so that 215 if we see that class again we will not use its 216 discriminator again. 217 When traveling through a discriminator, the 218 composed schema that is 219 is traveled through is added to this set. 220 For example if Animal has a discriminator 221 petType and we pass in "Dog", and the class Dog 222 allOf includes Animal, we move through Animal 223 once using the discriminator, and pick Dog. 224 Then in Dog, we will make an instance of the 225 Animal class but this time we won't travel 226 through its discriminator because we passed in 227 _visited_composed_classes = (Animal,) 228 upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501 229 """ 230 231 _check_type = kwargs.pop("_check_type", True) 232 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 233 _path_to_item = kwargs.pop("_path_to_item", ()) 234 _configuration = kwargs.pop("_configuration", None) 235 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 236 237 if args: 238 raise PineconeApiTypeError( 239 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 240 % ( 241 args, 242 self.__class__.__name__, 243 ), 244 path_to_item=_path_to_item, 245 valid_classes=(self.__class__,), 246 ) 247 248 self._data_store = {} 249 self._check_type = _check_type 250 self._spec_property_naming = _spec_property_naming 251 self._path_to_item = _path_to_item 252 self._configuration = _configuration 253 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 254 255 for var_name, var_value in kwargs.items(): 256 if ( 257 var_name not in self.attribute_map 258 and self._configuration is not None 259 and self._configuration.discard_unknown_keys 260 and self.additional_properties_type is None 261 ): 262 # discard variable. 263 continue 264 setattr(self, var_name, var_value) 265 if var_name in self.read_only_vars: 266 raise PineconeApiAttributeError( 267 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 268 f"class with read only attributes." 269 )
UpsertResponse - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) upserted_count (int): The number of vectors upserted.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class UpdateRequest(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = { 66 ("id",): { 67 "max_length": 512, 68 "min_length": 1, 69 }, 70 ("values",): {}, 71 } 72 73 @cached_property 74 def additional_properties_type(): 75 """ 76 This must be a method because a model may have properties that are 77 of type self, this must run after the class is loaded 78 """ 79 lazy_import() 80 return ( 81 bool, 82 dict, 83 float, 84 int, 85 list, 86 str, 87 none_type, 88 ) # noqa: E501 89 90 _nullable = False 91 92 @cached_property 93 def openapi_types(): 94 """ 95 This must be a method because a model may have properties that are 96 of type self, this must run after the class is loaded 97 98 Returns 99 openapi_types (dict): The key is attribute name 100 and the value is attribute type. 101 """ 102 lazy_import() 103 return { 104 "id": (str,), # noqa: E501 105 "values": ([float],), # noqa: E501 106 "sparse_values": (SparseValues,), # noqa: E501 107 "set_metadata": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 108 "namespace": (str,), # noqa: E501 109 } 110 111 @cached_property 112 def discriminator(): 113 return None 114 115 attribute_map = { 116 "id": "id", # noqa: E501 117 "values": "values", # noqa: E501 118 "sparse_values": "sparseValues", # noqa: E501 119 "set_metadata": "setMetadata", # noqa: E501 120 "namespace": "namespace", # noqa: E501 121 } 122 123 read_only_vars = {} 124 125 _composed_schemas = {} 126 127 @classmethod 128 @convert_js_args_to_python_args 129 def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 130 """UpdateRequest - a model defined in OpenAPI 131 132 Args: 133 id (str): Vector's unique id. 134 135 Keyword Args: 136 _check_type (bool): if True, values for parameters in openapi_types 137 will be type checked and a TypeError will be 138 raised if the wrong type is input. 139 Defaults to True 140 _path_to_item (tuple/list): This is a list of keys or values to 141 drill down to the model in received_data 142 when deserializing a response 143 _spec_property_naming (bool): True if the variable names in the input data 144 are serialized names, as specified in the OpenAPI document. 145 False if the variable names in the input data 146 are pythonic names, e.g. snake case (default) 147 _configuration (Configuration): the instance to use when 148 deserializing a file_type parameter. 149 If passed, type conversion is attempted 150 If omitted no type conversion is done. 151 _visited_composed_classes (tuple): This stores a tuple of 152 classes that we have traveled through so that 153 if we see that class again we will not use its 154 discriminator again. 155 When traveling through a discriminator, the 156 composed schema that is 157 is traveled through is added to this set. 158 For example if Animal has a discriminator 159 petType and we pass in "Dog", and the class Dog 160 allOf includes Animal, we move through Animal 161 once using the discriminator, and pick Dog. 162 Then in Dog, we will make an instance of the 163 Animal class but this time we won't travel 164 through its discriminator because we passed in 165 _visited_composed_classes = (Animal,) 166 values ([float]): Vector data.. [optional] # noqa: E501 167 sparse_values (SparseValues): [optional] # noqa: E501 168 set_metadata ({str: (bool, dict, float, int, list, str, none_type)}): Metadata to set for the vector.. [optional] # noqa: E501 169 namespace (str): The namespace containing the vector to update.. [optional] # noqa: E501 170 """ 171 172 _check_type = kwargs.pop("_check_type", True) 173 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 174 _path_to_item = kwargs.pop("_path_to_item", ()) 175 _configuration = kwargs.pop("_configuration", None) 176 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 177 178 self = super(OpenApiModel, cls).__new__(cls) 179 180 if args: 181 raise PineconeApiTypeError( 182 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 183 % ( 184 args, 185 self.__class__.__name__, 186 ), 187 path_to_item=_path_to_item, 188 valid_classes=(self.__class__,), 189 ) 190 191 self._data_store = {} 192 self._check_type = _check_type 193 self._spec_property_naming = _spec_property_naming 194 self._path_to_item = _path_to_item 195 self._configuration = _configuration 196 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 197 198 self.id = id 199 for var_name, var_value in kwargs.items(): 200 if ( 201 var_name not in self.attribute_map 202 and self._configuration is not None 203 and self._configuration.discard_unknown_keys 204 and self.additional_properties_type is None 205 ): 206 # discard variable. 207 continue 208 setattr(self, var_name, var_value) 209 return self 210 211 required_properties = set( 212 [ 213 "_data_store", 214 "_check_type", 215 "_spec_property_naming", 216 "_path_to_item", 217 "_configuration", 218 "_visited_composed_classes", 219 ] 220 ) 221 222 @convert_js_args_to_python_args 223 def __init__(self, id, *args, **kwargs): # noqa: E501 224 """UpdateRequest - a model defined in OpenAPI 225 226 Args: 227 id (str): Vector's unique id. 228 229 Keyword Args: 230 _check_type (bool): if True, values for parameters in openapi_types 231 will be type checked and a TypeError will be 232 raised if the wrong type is input. 233 Defaults to True 234 _path_to_item (tuple/list): This is a list of keys or values to 235 drill down to the model in received_data 236 when deserializing a response 237 _spec_property_naming (bool): True if the variable names in the input data 238 are serialized names, as specified in the OpenAPI document. 239 False if the variable names in the input data 240 are pythonic names, e.g. snake case (default) 241 _configuration (Configuration): the instance to use when 242 deserializing a file_type parameter. 243 If passed, type conversion is attempted 244 If omitted no type conversion is done. 245 _visited_composed_classes (tuple): This stores a tuple of 246 classes that we have traveled through so that 247 if we see that class again we will not use its 248 discriminator again. 249 When traveling through a discriminator, the 250 composed schema that is 251 is traveled through is added to this set. 252 For example if Animal has a discriminator 253 petType and we pass in "Dog", and the class Dog 254 allOf includes Animal, we move through Animal 255 once using the discriminator, and pick Dog. 256 Then in Dog, we will make an instance of the 257 Animal class but this time we won't travel 258 through its discriminator because we passed in 259 _visited_composed_classes = (Animal,) 260 values ([float]): Vector data.. [optional] # noqa: E501 261 sparse_values (SparseValues): [optional] # noqa: E501 262 set_metadata ({str: (bool, dict, float, int, list, str, none_type)}): Metadata to set for the vector.. [optional] # noqa: E501 263 namespace (str): The namespace containing the vector to update.. [optional] # noqa: E501 264 """ 265 266 _check_type = kwargs.pop("_check_type", True) 267 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 268 _path_to_item = kwargs.pop("_path_to_item", ()) 269 _configuration = kwargs.pop("_configuration", None) 270 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 271 272 if args: 273 raise PineconeApiTypeError( 274 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 275 % ( 276 args, 277 self.__class__.__name__, 278 ), 279 path_to_item=_path_to_item, 280 valid_classes=(self.__class__,), 281 ) 282 283 self._data_store = {} 284 self._check_type = _check_type 285 self._spec_property_naming = _spec_property_naming 286 self._path_to_item = _path_to_item 287 self._configuration = _configuration 288 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 289 290 self.id = id 291 for var_name, var_value in kwargs.items(): 292 if ( 293 var_name not in self.attribute_map 294 and self._configuration is not None 295 and self._configuration.discard_unknown_keys 296 and self.additional_properties_type is None 297 ): 298 # discard variable. 299 continue 300 setattr(self, var_name, var_value) 301 if var_name in self.read_only_vars: 302 raise PineconeApiAttributeError( 303 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 304 f"class with read only attributes." 305 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
222 @convert_js_args_to_python_args 223 def __init__(self, id, *args, **kwargs): # noqa: E501 224 """UpdateRequest - a model defined in OpenAPI 225 226 Args: 227 id (str): Vector's unique id. 228 229 Keyword Args: 230 _check_type (bool): if True, values for parameters in openapi_types 231 will be type checked and a TypeError will be 232 raised if the wrong type is input. 233 Defaults to True 234 _path_to_item (tuple/list): This is a list of keys or values to 235 drill down to the model in received_data 236 when deserializing a response 237 _spec_property_naming (bool): True if the variable names in the input data 238 are serialized names, as specified in the OpenAPI document. 239 False if the variable names in the input data 240 are pythonic names, e.g. snake case (default) 241 _configuration (Configuration): the instance to use when 242 deserializing a file_type parameter. 243 If passed, type conversion is attempted 244 If omitted no type conversion is done. 245 _visited_composed_classes (tuple): This stores a tuple of 246 classes that we have traveled through so that 247 if we see that class again we will not use its 248 discriminator again. 249 When traveling through a discriminator, the 250 composed schema that is 251 is traveled through is added to this set. 252 For example if Animal has a discriminator 253 petType and we pass in "Dog", and the class Dog 254 allOf includes Animal, we move through Animal 255 once using the discriminator, and pick Dog. 256 Then in Dog, we will make an instance of the 257 Animal class but this time we won't travel 258 through its discriminator because we passed in 259 _visited_composed_classes = (Animal,) 260 values ([float]): Vector data.. [optional] # noqa: E501 261 sparse_values (SparseValues): [optional] # noqa: E501 262 set_metadata ({str: (bool, dict, float, int, list, str, none_type)}): Metadata to set for the vector.. [optional] # noqa: E501 263 namespace (str): The namespace containing the vector to update.. [optional] # noqa: E501 264 """ 265 266 _check_type = kwargs.pop("_check_type", True) 267 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 268 _path_to_item = kwargs.pop("_path_to_item", ()) 269 _configuration = kwargs.pop("_configuration", None) 270 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 271 272 if args: 273 raise PineconeApiTypeError( 274 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 275 % ( 276 args, 277 self.__class__.__name__, 278 ), 279 path_to_item=_path_to_item, 280 valid_classes=(self.__class__,), 281 ) 282 283 self._data_store = {} 284 self._check_type = _check_type 285 self._spec_property_naming = _spec_property_naming 286 self._path_to_item = _path_to_item 287 self._configuration = _configuration 288 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 289 290 self.id = id 291 for var_name, var_value in kwargs.items(): 292 if ( 293 var_name not in self.attribute_map 294 and self._configuration is not None 295 and self._configuration.discard_unknown_keys 296 and self.additional_properties_type is None 297 ): 298 # discard variable. 299 continue 300 setattr(self, var_name, var_value) 301 if var_name in self.read_only_vars: 302 raise PineconeApiAttributeError( 303 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 304 f"class with read only attributes." 305 )
UpdateRequest - a model defined in OpenAPI
Arguments:
- id (str): Vector's unique id.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) values ([float]): Vector data.. [optional] # noqa: E501 sparse_values (SparseValues): [optional] # noqa: E501 set_metadata ({str: (bool, dict, float, int, list, str, none_type)}): Metadata to set for the vector.. [optional] # noqa: E501 namespace (str): The namespace containing the vector to update.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
39class Vector(ModelNormal): 40 """NOTE: This class is auto generated by OpenAPI Generator. 41 Ref: https://openapi-generator.tech 42 43 Do not edit the class manually. 44 45 Attributes: 46 allowed_values (dict): The key is the tuple path to the attribute 47 and the for var_name this is (var_name,). The value is a dict 48 with a capitalized key describing the allowed value and an allowed 49 value. These dicts store the allowed enum values. 50 attribute_map (dict): The key is attribute name 51 and the value is json key in definition. 52 discriminator_value_class_map (dict): A dict to go from the discriminator 53 variable value to the discriminator class name. 54 validations (dict): The key is the tuple path to the attribute 55 and the for var_name this is (var_name,). The value is a dict 56 that stores validations for max_length, min_length, max_items, 57 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 58 inclusive_minimum, and regex. 59 additional_properties_type (tuple): A tuple of classes accepted 60 as additional properties values. 61 """ 62 63 allowed_values = {} 64 65 validations = { 66 ("id",): { 67 "max_length": 512, 68 "min_length": 1, 69 }, 70 ("values",): {}, 71 } 72 73 @cached_property 74 def additional_properties_type(): 75 """ 76 This must be a method because a model may have properties that are 77 of type self, this must run after the class is loaded 78 """ 79 lazy_import() 80 return ( 81 bool, 82 dict, 83 float, 84 int, 85 list, 86 str, 87 none_type, 88 ) # noqa: E501 89 90 _nullable = False 91 92 @cached_property 93 def openapi_types(): 94 """ 95 This must be a method because a model may have properties that are 96 of type self, this must run after the class is loaded 97 98 Returns 99 openapi_types (dict): The key is attribute name 100 and the value is attribute type. 101 """ 102 lazy_import() 103 return { 104 "id": (str,), # noqa: E501 105 "values": ([float],), # noqa: E501 106 "sparse_values": (SparseValues,), # noqa: E501 107 "metadata": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 108 } 109 110 @cached_property 111 def discriminator(): 112 return None 113 114 attribute_map = { 115 "id": "id", # noqa: E501 116 "values": "values", # noqa: E501 117 "sparse_values": "sparseValues", # noqa: E501 118 "metadata": "metadata", # noqa: E501 119 } 120 121 read_only_vars = {} 122 123 _composed_schemas = {} 124 125 @classmethod 126 @convert_js_args_to_python_args 127 def _from_openapi_data(cls, id, values, *args, **kwargs): # noqa: E501 128 """Vector - a model defined in OpenAPI 129 130 Args: 131 id (str): This is the vector's unique id. 132 values ([float]): This is the vector data included in the request. 133 134 Keyword Args: 135 _check_type (bool): if True, values for parameters in openapi_types 136 will be type checked and a TypeError will be 137 raised if the wrong type is input. 138 Defaults to True 139 _path_to_item (tuple/list): This is a list of keys or values to 140 drill down to the model in received_data 141 when deserializing a response 142 _spec_property_naming (bool): True if the variable names in the input data 143 are serialized names, as specified in the OpenAPI document. 144 False if the variable names in the input data 145 are pythonic names, e.g. snake case (default) 146 _configuration (Configuration): the instance to use when 147 deserializing a file_type parameter. 148 If passed, type conversion is attempted 149 If omitted no type conversion is done. 150 _visited_composed_classes (tuple): This stores a tuple of 151 classes that we have traveled through so that 152 if we see that class again we will not use its 153 discriminator again. 154 When traveling through a discriminator, the 155 composed schema that is 156 is traveled through is added to this set. 157 For example if Animal has a discriminator 158 petType and we pass in "Dog", and the class Dog 159 allOf includes Animal, we move through Animal 160 once using the discriminator, and pick Dog. 161 Then in Dog, we will make an instance of the 162 Animal class but this time we won't travel 163 through its discriminator because we passed in 164 _visited_composed_classes = (Animal,) 165 sparse_values (SparseValues): [optional] # noqa: E501 166 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501 167 """ 168 169 _check_type = kwargs.pop("_check_type", True) 170 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 171 _path_to_item = kwargs.pop("_path_to_item", ()) 172 _configuration = kwargs.pop("_configuration", None) 173 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 174 175 self = super(OpenApiModel, cls).__new__(cls) 176 177 if args: 178 raise PineconeApiTypeError( 179 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 180 % ( 181 args, 182 self.__class__.__name__, 183 ), 184 path_to_item=_path_to_item, 185 valid_classes=(self.__class__,), 186 ) 187 188 self._data_store = {} 189 self._check_type = _check_type 190 self._spec_property_naming = _spec_property_naming 191 self._path_to_item = _path_to_item 192 self._configuration = _configuration 193 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 194 195 self.id = id 196 self.values = values 197 for var_name, var_value in kwargs.items(): 198 if ( 199 var_name not in self.attribute_map 200 and self._configuration is not None 201 and self._configuration.discard_unknown_keys 202 and self.additional_properties_type is None 203 ): 204 # discard variable. 205 continue 206 setattr(self, var_name, var_value) 207 return self 208 209 required_properties = set( 210 [ 211 "_data_store", 212 "_check_type", 213 "_spec_property_naming", 214 "_path_to_item", 215 "_configuration", 216 "_visited_composed_classes", 217 ] 218 ) 219 220 @convert_js_args_to_python_args 221 def __init__(self, id, values, *args, **kwargs): # noqa: E501 222 """Vector - a model defined in OpenAPI 223 224 Args: 225 id (str): This is the vector's unique id. 226 values ([float]): This is the vector data included in the request. 227 228 Keyword Args: 229 _check_type (bool): if True, values for parameters in openapi_types 230 will be type checked and a TypeError will be 231 raised if the wrong type is input. 232 Defaults to True 233 _path_to_item (tuple/list): This is a list of keys or values to 234 drill down to the model in received_data 235 when deserializing a response 236 _spec_property_naming (bool): True if the variable names in the input data 237 are serialized names, as specified in the OpenAPI document. 238 False if the variable names in the input data 239 are pythonic names, e.g. snake case (default) 240 _configuration (Configuration): the instance to use when 241 deserializing a file_type parameter. 242 If passed, type conversion is attempted 243 If omitted no type conversion is done. 244 _visited_composed_classes (tuple): This stores a tuple of 245 classes that we have traveled through so that 246 if we see that class again we will not use its 247 discriminator again. 248 When traveling through a discriminator, the 249 composed schema that is 250 is traveled through is added to this set. 251 For example if Animal has a discriminator 252 petType and we pass in "Dog", and the class Dog 253 allOf includes Animal, we move through Animal 254 once using the discriminator, and pick Dog. 255 Then in Dog, we will make an instance of the 256 Animal class but this time we won't travel 257 through its discriminator because we passed in 258 _visited_composed_classes = (Animal,) 259 sparse_values (SparseValues): [optional] # noqa: E501 260 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501 261 """ 262 263 _check_type = kwargs.pop("_check_type", True) 264 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 265 _path_to_item = kwargs.pop("_path_to_item", ()) 266 _configuration = kwargs.pop("_configuration", None) 267 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 268 269 if args: 270 raise PineconeApiTypeError( 271 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 272 % ( 273 args, 274 self.__class__.__name__, 275 ), 276 path_to_item=_path_to_item, 277 valid_classes=(self.__class__,), 278 ) 279 280 self._data_store = {} 281 self._check_type = _check_type 282 self._spec_property_naming = _spec_property_naming 283 self._path_to_item = _path_to_item 284 self._configuration = _configuration 285 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 286 287 self.id = id 288 self.values = values 289 for var_name, var_value in kwargs.items(): 290 if ( 291 var_name not in self.attribute_map 292 and self._configuration is not None 293 and self._configuration.discard_unknown_keys 294 and self.additional_properties_type is None 295 ): 296 # discard variable. 297 continue 298 setattr(self, var_name, var_value) 299 if var_name in self.read_only_vars: 300 raise PineconeApiAttributeError( 301 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 302 f"class with read only attributes." 303 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
220 @convert_js_args_to_python_args 221 def __init__(self, id, values, *args, **kwargs): # noqa: E501 222 """Vector - a model defined in OpenAPI 223 224 Args: 225 id (str): This is the vector's unique id. 226 values ([float]): This is the vector data included in the request. 227 228 Keyword Args: 229 _check_type (bool): if True, values for parameters in openapi_types 230 will be type checked and a TypeError will be 231 raised if the wrong type is input. 232 Defaults to True 233 _path_to_item (tuple/list): This is a list of keys or values to 234 drill down to the model in received_data 235 when deserializing a response 236 _spec_property_naming (bool): True if the variable names in the input data 237 are serialized names, as specified in the OpenAPI document. 238 False if the variable names in the input data 239 are pythonic names, e.g. snake case (default) 240 _configuration (Configuration): the instance to use when 241 deserializing a file_type parameter. 242 If passed, type conversion is attempted 243 If omitted no type conversion is done. 244 _visited_composed_classes (tuple): This stores a tuple of 245 classes that we have traveled through so that 246 if we see that class again we will not use its 247 discriminator again. 248 When traveling through a discriminator, the 249 composed schema that is 250 is traveled through is added to this set. 251 For example if Animal has a discriminator 252 petType and we pass in "Dog", and the class Dog 253 allOf includes Animal, we move through Animal 254 once using the discriminator, and pick Dog. 255 Then in Dog, we will make an instance of the 256 Animal class but this time we won't travel 257 through its discriminator because we passed in 258 _visited_composed_classes = (Animal,) 259 sparse_values (SparseValues): [optional] # noqa: E501 260 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501 261 """ 262 263 _check_type = kwargs.pop("_check_type", True) 264 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 265 _path_to_item = kwargs.pop("_path_to_item", ()) 266 _configuration = kwargs.pop("_configuration", None) 267 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 268 269 if args: 270 raise PineconeApiTypeError( 271 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 272 % ( 273 args, 274 self.__class__.__name__, 275 ), 276 path_to_item=_path_to_item, 277 valid_classes=(self.__class__,), 278 ) 279 280 self._data_store = {} 281 self._check_type = _check_type 282 self._spec_property_naming = _spec_property_naming 283 self._path_to_item = _path_to_item 284 self._configuration = _configuration 285 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 286 287 self.id = id 288 self.values = values 289 for var_name, var_value in kwargs.items(): 290 if ( 291 var_name not in self.attribute_map 292 and self._configuration is not None 293 and self._configuration.discard_unknown_keys 294 and self.additional_properties_type is None 295 ): 296 # discard variable. 297 continue 298 setattr(self, var_name, var_value) 299 if var_name in self.read_only_vars: 300 raise PineconeApiAttributeError( 301 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 302 f"class with read only attributes." 303 )
Vector - a model defined in OpenAPI
Arguments:
- id (str): This is the vector's unique id.
- values ([float]): This is the vector data included in the request.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) sparse_values (SparseValues): [optional] # noqa: E501 metadata ({str: (bool, dict, float, int, list, str, none_type)}): This is the metadata included in the request.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
33class DeleteRequest(ModelNormal): 34 """NOTE: This class is auto generated by OpenAPI Generator. 35 Ref: https://openapi-generator.tech 36 37 Do not edit the class manually. 38 39 Attributes: 40 allowed_values (dict): The key is the tuple path to the attribute 41 and the for var_name this is (var_name,). The value is a dict 42 with a capitalized key describing the allowed value and an allowed 43 value. These dicts store the allowed enum values. 44 attribute_map (dict): The key is attribute name 45 and the value is json key in definition. 46 discriminator_value_class_map (dict): A dict to go from the discriminator 47 variable value to the discriminator class name. 48 validations (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 that stores validations for max_length, min_length, max_items, 51 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 52 inclusive_minimum, and regex. 53 additional_properties_type (tuple): A tuple of classes accepted 54 as additional properties values. 55 """ 56 57 allowed_values = {} 58 59 validations = { 60 ("ids",): {}, 61 } 62 63 @cached_property 64 def additional_properties_type(): 65 """ 66 This must be a method because a model may have properties that are 67 of type self, this must run after the class is loaded 68 """ 69 return ( 70 bool, 71 dict, 72 float, 73 int, 74 list, 75 str, 76 none_type, 77 ) # noqa: E501 78 79 _nullable = False 80 81 @cached_property 82 def openapi_types(): 83 """ 84 This must be a method because a model may have properties that are 85 of type self, this must run after the class is loaded 86 87 Returns 88 openapi_types (dict): The key is attribute name 89 and the value is attribute type. 90 """ 91 return { 92 "ids": ([str],), # noqa: E501 93 "delete_all": (bool,), # noqa: E501 94 "namespace": (str,), # noqa: E501 95 "filter": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 96 } 97 98 @cached_property 99 def discriminator(): 100 return None 101 102 attribute_map = { 103 "ids": "ids", # noqa: E501 104 "delete_all": "deleteAll", # noqa: E501 105 "namespace": "namespace", # noqa: E501 106 "filter": "filter", # noqa: E501 107 } 108 109 read_only_vars = {} 110 111 _composed_schemas = {} 112 113 @classmethod 114 @convert_js_args_to_python_args 115 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 116 """DeleteRequest - a model defined in OpenAPI 117 118 Keyword Args: 119 _check_type (bool): if True, values for parameters in openapi_types 120 will be type checked and a TypeError will be 121 raised if the wrong type is input. 122 Defaults to True 123 _path_to_item (tuple/list): This is a list of keys or values to 124 drill down to the model in received_data 125 when deserializing a response 126 _spec_property_naming (bool): True if the variable names in the input data 127 are serialized names, as specified in the OpenAPI document. 128 False if the variable names in the input data 129 are pythonic names, e.g. snake case (default) 130 _configuration (Configuration): the instance to use when 131 deserializing a file_type parameter. 132 If passed, type conversion is attempted 133 If omitted no type conversion is done. 134 _visited_composed_classes (tuple): This stores a tuple of 135 classes that we have traveled through so that 136 if we see that class again we will not use its 137 discriminator again. 138 When traveling through a discriminator, the 139 composed schema that is 140 is traveled through is added to this set. 141 For example if Animal has a discriminator 142 petType and we pass in "Dog", and the class Dog 143 allOf includes Animal, we move through Animal 144 once using the discriminator, and pick Dog. 145 Then in Dog, we will make an instance of the 146 Animal class but this time we won't travel 147 through its discriminator because we passed in 148 _visited_composed_classes = (Animal,) 149 ids ([str]): Vectors to delete.. [optional] # noqa: E501 150 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 151 namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 152 filter ({str: (bool, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID.. [optional] # noqa: E501 153 """ 154 155 _check_type = kwargs.pop("_check_type", True) 156 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 157 _path_to_item = kwargs.pop("_path_to_item", ()) 158 _configuration = kwargs.pop("_configuration", None) 159 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 160 161 self = super(OpenApiModel, cls).__new__(cls) 162 163 if args: 164 raise PineconeApiTypeError( 165 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 166 % ( 167 args, 168 self.__class__.__name__, 169 ), 170 path_to_item=_path_to_item, 171 valid_classes=(self.__class__,), 172 ) 173 174 self._data_store = {} 175 self._check_type = _check_type 176 self._spec_property_naming = _spec_property_naming 177 self._path_to_item = _path_to_item 178 self._configuration = _configuration 179 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 180 181 for var_name, var_value in kwargs.items(): 182 if ( 183 var_name not in self.attribute_map 184 and self._configuration is not None 185 and self._configuration.discard_unknown_keys 186 and self.additional_properties_type is None 187 ): 188 # discard variable. 189 continue 190 setattr(self, var_name, var_value) 191 return self 192 193 required_properties = set( 194 [ 195 "_data_store", 196 "_check_type", 197 "_spec_property_naming", 198 "_path_to_item", 199 "_configuration", 200 "_visited_composed_classes", 201 ] 202 ) 203 204 @convert_js_args_to_python_args 205 def __init__(self, *args, **kwargs): # noqa: E501 206 """DeleteRequest - a model defined in OpenAPI 207 208 Keyword Args: 209 _check_type (bool): if True, values for parameters in openapi_types 210 will be type checked and a TypeError will be 211 raised if the wrong type is input. 212 Defaults to True 213 _path_to_item (tuple/list): This is a list of keys or values to 214 drill down to the model in received_data 215 when deserializing a response 216 _spec_property_naming (bool): True if the variable names in the input data 217 are serialized names, as specified in the OpenAPI document. 218 False if the variable names in the input data 219 are pythonic names, e.g. snake case (default) 220 _configuration (Configuration): the instance to use when 221 deserializing a file_type parameter. 222 If passed, type conversion is attempted 223 If omitted no type conversion is done. 224 _visited_composed_classes (tuple): This stores a tuple of 225 classes that we have traveled through so that 226 if we see that class again we will not use its 227 discriminator again. 228 When traveling through a discriminator, the 229 composed schema that is 230 is traveled through is added to this set. 231 For example if Animal has a discriminator 232 petType and we pass in "Dog", and the class Dog 233 allOf includes Animal, we move through Animal 234 once using the discriminator, and pick Dog. 235 Then in Dog, we will make an instance of the 236 Animal class but this time we won't travel 237 through its discriminator because we passed in 238 _visited_composed_classes = (Animal,) 239 ids ([str]): Vectors to delete.. [optional] # noqa: E501 240 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 241 namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 242 filter ({str: (bool, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID.. [optional] # noqa: E501 243 """ 244 245 _check_type = kwargs.pop("_check_type", True) 246 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 247 _path_to_item = kwargs.pop("_path_to_item", ()) 248 _configuration = kwargs.pop("_configuration", None) 249 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 250 251 if args: 252 raise PineconeApiTypeError( 253 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 254 % ( 255 args, 256 self.__class__.__name__, 257 ), 258 path_to_item=_path_to_item, 259 valid_classes=(self.__class__,), 260 ) 261 262 self._data_store = {} 263 self._check_type = _check_type 264 self._spec_property_naming = _spec_property_naming 265 self._path_to_item = _path_to_item 266 self._configuration = _configuration 267 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 268 269 for var_name, var_value in kwargs.items(): 270 if ( 271 var_name not in self.attribute_map 272 and self._configuration is not None 273 and self._configuration.discard_unknown_keys 274 and self.additional_properties_type is None 275 ): 276 # discard variable. 277 continue 278 setattr(self, var_name, var_value) 279 if var_name in self.read_only_vars: 280 raise PineconeApiAttributeError( 281 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 282 f"class with read only attributes." 283 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
204 @convert_js_args_to_python_args 205 def __init__(self, *args, **kwargs): # noqa: E501 206 """DeleteRequest - a model defined in OpenAPI 207 208 Keyword Args: 209 _check_type (bool): if True, values for parameters in openapi_types 210 will be type checked and a TypeError will be 211 raised if the wrong type is input. 212 Defaults to True 213 _path_to_item (tuple/list): This is a list of keys or values to 214 drill down to the model in received_data 215 when deserializing a response 216 _spec_property_naming (bool): True if the variable names in the input data 217 are serialized names, as specified in the OpenAPI document. 218 False if the variable names in the input data 219 are pythonic names, e.g. snake case (default) 220 _configuration (Configuration): the instance to use when 221 deserializing a file_type parameter. 222 If passed, type conversion is attempted 223 If omitted no type conversion is done. 224 _visited_composed_classes (tuple): This stores a tuple of 225 classes that we have traveled through so that 226 if we see that class again we will not use its 227 discriminator again. 228 When traveling through a discriminator, the 229 composed schema that is 230 is traveled through is added to this set. 231 For example if Animal has a discriminator 232 petType and we pass in "Dog", and the class Dog 233 allOf includes Animal, we move through Animal 234 once using the discriminator, and pick Dog. 235 Then in Dog, we will make an instance of the 236 Animal class but this time we won't travel 237 through its discriminator because we passed in 238 _visited_composed_classes = (Animal,) 239 ids ([str]): Vectors to delete.. [optional] # noqa: E501 240 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 241 namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 242 filter ({str: (bool, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID.. [optional] # noqa: E501 243 """ 244 245 _check_type = kwargs.pop("_check_type", True) 246 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 247 _path_to_item = kwargs.pop("_path_to_item", ()) 248 _configuration = kwargs.pop("_configuration", None) 249 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 250 251 if args: 252 raise PineconeApiTypeError( 253 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 254 % ( 255 args, 256 self.__class__.__name__, 257 ), 258 path_to_item=_path_to_item, 259 valid_classes=(self.__class__,), 260 ) 261 262 self._data_store = {} 263 self._check_type = _check_type 264 self._spec_property_naming = _spec_property_naming 265 self._path_to_item = _path_to_item 266 self._configuration = _configuration 267 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 268 269 for var_name, var_value in kwargs.items(): 270 if ( 271 var_name not in self.attribute_map 272 and self._configuration is not None 273 and self._configuration.discard_unknown_keys 274 and self.additional_properties_type is None 275 ): 276 # discard variable. 277 continue 278 setattr(self, var_name, var_value) 279 if var_name in self.read_only_vars: 280 raise PineconeApiAttributeError( 281 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 282 f"class with read only attributes." 283 )
DeleteRequest - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) ids ([str]): Vectors to delete.. [optional] # noqa: E501 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] if omitted the server will use the default value of False # noqa: E501 namespace (str): The namespace to delete vectors from, if applicable.. [optional] # noqa: E501 filter ({str: (bool, dict, float, int, list, str, none_type)}): If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See Filter with metadata. Serverless indexes do not support delete by metadata. Instead, you can use the
list
operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
33class DescribeIndexStatsRequest(ModelNormal): 34 """NOTE: This class is auto generated by OpenAPI Generator. 35 Ref: https://openapi-generator.tech 36 37 Do not edit the class manually. 38 39 Attributes: 40 allowed_values (dict): The key is the tuple path to the attribute 41 and the for var_name this is (var_name,). The value is a dict 42 with a capitalized key describing the allowed value and an allowed 43 value. These dicts store the allowed enum values. 44 attribute_map (dict): The key is attribute name 45 and the value is json key in definition. 46 discriminator_value_class_map (dict): A dict to go from the discriminator 47 variable value to the discriminator class name. 48 validations (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 that stores validations for max_length, min_length, max_items, 51 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 52 inclusive_minimum, and regex. 53 additional_properties_type (tuple): A tuple of classes accepted 54 as additional properties values. 55 """ 56 57 allowed_values = {} 58 59 validations = {} 60 61 @cached_property 62 def additional_properties_type(): 63 """ 64 This must be a method because a model may have properties that are 65 of type self, this must run after the class is loaded 66 """ 67 return ( 68 bool, 69 dict, 70 float, 71 int, 72 list, 73 str, 74 none_type, 75 ) # noqa: E501 76 77 _nullable = False 78 79 @cached_property 80 def openapi_types(): 81 """ 82 This must be a method because a model may have properties that are 83 of type self, this must run after the class is loaded 84 85 Returns 86 openapi_types (dict): The key is attribute name 87 and the value is attribute type. 88 """ 89 return { 90 "filter": ({str: (bool, dict, float, int, list, str, none_type)},), # noqa: E501 91 } 92 93 @cached_property 94 def discriminator(): 95 return None 96 97 attribute_map = { 98 "filter": "filter", # noqa: E501 99 } 100 101 read_only_vars = {} 102 103 _composed_schemas = {} 104 105 @classmethod 106 @convert_js_args_to_python_args 107 def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 108 """DescribeIndexStatsRequest - a model defined in OpenAPI 109 110 Keyword Args: 111 _check_type (bool): if True, values for parameters in openapi_types 112 will be type checked and a TypeError will be 113 raised if the wrong type is input. 114 Defaults to True 115 _path_to_item (tuple/list): This is a list of keys or values to 116 drill down to the model in received_data 117 when deserializing a response 118 _spec_property_naming (bool): True if the variable names in the input data 119 are serialized names, as specified in the OpenAPI document. 120 False if the variable names in the input data 121 are pythonic names, e.g. snake case (default) 122 _configuration (Configuration): the instance to use when 123 deserializing a file_type parameter. 124 If passed, type conversion is attempted 125 If omitted no type conversion is done. 126 _visited_composed_classes (tuple): This stores a tuple of 127 classes that we have traveled through so that 128 if we see that class again we will not use its 129 discriminator again. 130 When traveling through a discriminator, the 131 composed schema that is 132 is traveled through is added to this set. 133 For example if Animal has a discriminator 134 petType and we pass in "Dog", and the class Dog 135 allOf includes Animal, we move through Animal 136 once using the discriminator, and pick Dog. 137 Then in Dog, we will make an instance of the 138 Animal class but this time we won't travel 139 through its discriminator because we passed in 140 _visited_composed_classes = (Animal,) 141 filter ({str: (bool, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support filtering `describe_index_stats` by metadata.. [optional] # noqa: E501 142 """ 143 144 _check_type = kwargs.pop("_check_type", True) 145 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 146 _path_to_item = kwargs.pop("_path_to_item", ()) 147 _configuration = kwargs.pop("_configuration", None) 148 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 149 150 self = super(OpenApiModel, cls).__new__(cls) 151 152 if args: 153 raise PineconeApiTypeError( 154 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 155 % ( 156 args, 157 self.__class__.__name__, 158 ), 159 path_to_item=_path_to_item, 160 valid_classes=(self.__class__,), 161 ) 162 163 self._data_store = {} 164 self._check_type = _check_type 165 self._spec_property_naming = _spec_property_naming 166 self._path_to_item = _path_to_item 167 self._configuration = _configuration 168 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 169 170 for var_name, var_value in kwargs.items(): 171 if ( 172 var_name not in self.attribute_map 173 and self._configuration is not None 174 and self._configuration.discard_unknown_keys 175 and self.additional_properties_type is None 176 ): 177 # discard variable. 178 continue 179 setattr(self, var_name, var_value) 180 return self 181 182 required_properties = set( 183 [ 184 "_data_store", 185 "_check_type", 186 "_spec_property_naming", 187 "_path_to_item", 188 "_configuration", 189 "_visited_composed_classes", 190 ] 191 ) 192 193 @convert_js_args_to_python_args 194 def __init__(self, *args, **kwargs): # noqa: E501 195 """DescribeIndexStatsRequest - a model defined in OpenAPI 196 197 Keyword Args: 198 _check_type (bool): if True, values for parameters in openapi_types 199 will be type checked and a TypeError will be 200 raised if the wrong type is input. 201 Defaults to True 202 _path_to_item (tuple/list): This is a list of keys or values to 203 drill down to the model in received_data 204 when deserializing a response 205 _spec_property_naming (bool): True if the variable names in the input data 206 are serialized names, as specified in the OpenAPI document. 207 False if the variable names in the input data 208 are pythonic names, e.g. snake case (default) 209 _configuration (Configuration): the instance to use when 210 deserializing a file_type parameter. 211 If passed, type conversion is attempted 212 If omitted no type conversion is done. 213 _visited_composed_classes (tuple): This stores a tuple of 214 classes that we have traveled through so that 215 if we see that class again we will not use its 216 discriminator again. 217 When traveling through a discriminator, the 218 composed schema that is 219 is traveled through is added to this set. 220 For example if Animal has a discriminator 221 petType and we pass in "Dog", and the class Dog 222 allOf includes Animal, we move through Animal 223 once using the discriminator, and pick Dog. 224 Then in Dog, we will make an instance of the 225 Animal class but this time we won't travel 226 through its discriminator because we passed in 227 _visited_composed_classes = (Animal,) 228 filter ({str: (bool, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support filtering `describe_index_stats` by metadata.. [optional] # noqa: E501 229 """ 230 231 _check_type = kwargs.pop("_check_type", True) 232 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 233 _path_to_item = kwargs.pop("_path_to_item", ()) 234 _configuration = kwargs.pop("_configuration", None) 235 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 236 237 if args: 238 raise PineconeApiTypeError( 239 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 240 % ( 241 args, 242 self.__class__.__name__, 243 ), 244 path_to_item=_path_to_item, 245 valid_classes=(self.__class__,), 246 ) 247 248 self._data_store = {} 249 self._check_type = _check_type 250 self._spec_property_naming = _spec_property_naming 251 self._path_to_item = _path_to_item 252 self._configuration = _configuration 253 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 254 255 for var_name, var_value in kwargs.items(): 256 if ( 257 var_name not in self.attribute_map 258 and self._configuration is not None 259 and self._configuration.discard_unknown_keys 260 and self.additional_properties_type is None 261 ): 262 # discard variable. 263 continue 264 setattr(self, var_name, var_value) 265 if var_name in self.read_only_vars: 266 raise PineconeApiAttributeError( 267 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 268 f"class with read only attributes." 269 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
193 @convert_js_args_to_python_args 194 def __init__(self, *args, **kwargs): # noqa: E501 195 """DescribeIndexStatsRequest - a model defined in OpenAPI 196 197 Keyword Args: 198 _check_type (bool): if True, values for parameters in openapi_types 199 will be type checked and a TypeError will be 200 raised if the wrong type is input. 201 Defaults to True 202 _path_to_item (tuple/list): This is a list of keys or values to 203 drill down to the model in received_data 204 when deserializing a response 205 _spec_property_naming (bool): True if the variable names in the input data 206 are serialized names, as specified in the OpenAPI document. 207 False if the variable names in the input data 208 are pythonic names, e.g. snake case (default) 209 _configuration (Configuration): the instance to use when 210 deserializing a file_type parameter. 211 If passed, type conversion is attempted 212 If omitted no type conversion is done. 213 _visited_composed_classes (tuple): This stores a tuple of 214 classes that we have traveled through so that 215 if we see that class again we will not use its 216 discriminator again. 217 When traveling through a discriminator, the 218 composed schema that is 219 is traveled through is added to this set. 220 For example if Animal has a discriminator 221 petType and we pass in "Dog", and the class Dog 222 allOf includes Animal, we move through Animal 223 once using the discriminator, and pick Dog. 224 Then in Dog, we will make an instance of the 225 Animal class but this time we won't travel 226 through its discriminator because we passed in 227 _visited_composed_classes = (Animal,) 228 filter ({str: (bool, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support filtering `describe_index_stats` by metadata.. [optional] # noqa: E501 229 """ 230 231 _check_type = kwargs.pop("_check_type", True) 232 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 233 _path_to_item = kwargs.pop("_path_to_item", ()) 234 _configuration = kwargs.pop("_configuration", None) 235 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 236 237 if args: 238 raise PineconeApiTypeError( 239 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 240 % ( 241 args, 242 self.__class__.__name__, 243 ), 244 path_to_item=_path_to_item, 245 valid_classes=(self.__class__,), 246 ) 247 248 self._data_store = {} 249 self._check_type = _check_type 250 self._spec_property_naming = _spec_property_naming 251 self._path_to_item = _path_to_item 252 self._configuration = _configuration 253 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 254 255 for var_name, var_value in kwargs.items(): 256 if ( 257 var_name not in self.attribute_map 258 and self._configuration is not None 259 and self._configuration.discard_unknown_keys 260 and self.additional_properties_type is None 261 ): 262 # discard variable. 263 continue 264 setattr(self, var_name, var_value) 265 if var_name in self.read_only_vars: 266 raise PineconeApiAttributeError( 267 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 268 f"class with read only attributes." 269 )
DescribeIndexStatsRequest - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) filter ({str: (bool, dict, float, int, list, str, none_type)}): If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See Filter with metadata. Serverless indexes do not support filtering
describe_index_stats
by metadata.. [optional] # noqa: E501
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute
33class SparseValues(ModelNormal): 34 """NOTE: This class is auto generated by OpenAPI Generator. 35 Ref: https://openapi-generator.tech 36 37 Do not edit the class manually. 38 39 Attributes: 40 allowed_values (dict): The key is the tuple path to the attribute 41 and the for var_name this is (var_name,). The value is a dict 42 with a capitalized key describing the allowed value and an allowed 43 value. These dicts store the allowed enum values. 44 attribute_map (dict): The key is attribute name 45 and the value is json key in definition. 46 discriminator_value_class_map (dict): A dict to go from the discriminator 47 variable value to the discriminator class name. 48 validations (dict): The key is the tuple path to the attribute 49 and the for var_name this is (var_name,). The value is a dict 50 that stores validations for max_length, min_length, max_items, 51 min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, 52 inclusive_minimum, and regex. 53 additional_properties_type (tuple): A tuple of classes accepted 54 as additional properties values. 55 """ 56 57 allowed_values = {} 58 59 validations = { 60 ("indices",): {}, 61 ("values",): {}, 62 } 63 64 @cached_property 65 def additional_properties_type(): 66 """ 67 This must be a method because a model may have properties that are 68 of type self, this must run after the class is loaded 69 """ 70 return ( 71 bool, 72 dict, 73 float, 74 int, 75 list, 76 str, 77 none_type, 78 ) # noqa: E501 79 80 _nullable = False 81 82 @cached_property 83 def openapi_types(): 84 """ 85 This must be a method because a model may have properties that are 86 of type self, this must run after the class is loaded 87 88 Returns 89 openapi_types (dict): The key is attribute name 90 and the value is attribute type. 91 """ 92 return { 93 "indices": ([int],), # noqa: E501 94 "values": ([float],), # noqa: E501 95 } 96 97 @cached_property 98 def discriminator(): 99 return None 100 101 attribute_map = { 102 "indices": "indices", # noqa: E501 103 "values": "values", # noqa: E501 104 } 105 106 read_only_vars = {} 107 108 _composed_schemas = {} 109 110 @classmethod 111 @convert_js_args_to_python_args 112 def _from_openapi_data(cls, indices, values, *args, **kwargs): # noqa: E501 113 """SparseValues - a model defined in OpenAPI 114 115 Args: 116 indices ([int]): The indices of the sparse data. 117 values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices. 118 119 Keyword Args: 120 _check_type (bool): if True, values for parameters in openapi_types 121 will be type checked and a TypeError will be 122 raised if the wrong type is input. 123 Defaults to True 124 _path_to_item (tuple/list): This is a list of keys or values to 125 drill down to the model in received_data 126 when deserializing a response 127 _spec_property_naming (bool): True if the variable names in the input data 128 are serialized names, as specified in the OpenAPI document. 129 False if the variable names in the input data 130 are pythonic names, e.g. snake case (default) 131 _configuration (Configuration): the instance to use when 132 deserializing a file_type parameter. 133 If passed, type conversion is attempted 134 If omitted no type conversion is done. 135 _visited_composed_classes (tuple): This stores a tuple of 136 classes that we have traveled through so that 137 if we see that class again we will not use its 138 discriminator again. 139 When traveling through a discriminator, the 140 composed schema that is 141 is traveled through is added to this set. 142 For example if Animal has a discriminator 143 petType and we pass in "Dog", and the class Dog 144 allOf includes Animal, we move through Animal 145 once using the discriminator, and pick Dog. 146 Then in Dog, we will make an instance of the 147 Animal class but this time we won't travel 148 through its discriminator because we passed in 149 _visited_composed_classes = (Animal,) 150 """ 151 152 _check_type = kwargs.pop("_check_type", True) 153 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 154 _path_to_item = kwargs.pop("_path_to_item", ()) 155 _configuration = kwargs.pop("_configuration", None) 156 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 157 158 self = super(OpenApiModel, cls).__new__(cls) 159 160 if args: 161 raise PineconeApiTypeError( 162 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 163 % ( 164 args, 165 self.__class__.__name__, 166 ), 167 path_to_item=_path_to_item, 168 valid_classes=(self.__class__,), 169 ) 170 171 self._data_store = {} 172 self._check_type = _check_type 173 self._spec_property_naming = _spec_property_naming 174 self._path_to_item = _path_to_item 175 self._configuration = _configuration 176 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 177 178 self.indices = indices 179 self.values = values 180 for var_name, var_value in kwargs.items(): 181 if ( 182 var_name not in self.attribute_map 183 and self._configuration is not None 184 and self._configuration.discard_unknown_keys 185 and self.additional_properties_type is None 186 ): 187 # discard variable. 188 continue 189 setattr(self, var_name, var_value) 190 return self 191 192 required_properties = set( 193 [ 194 "_data_store", 195 "_check_type", 196 "_spec_property_naming", 197 "_path_to_item", 198 "_configuration", 199 "_visited_composed_classes", 200 ] 201 ) 202 203 @convert_js_args_to_python_args 204 def __init__(self, indices, values, *args, **kwargs): # noqa: E501 205 """SparseValues - a model defined in OpenAPI 206 207 Args: 208 indices ([int]): The indices of the sparse data. 209 values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices. 210 211 Keyword Args: 212 _check_type (bool): if True, values for parameters in openapi_types 213 will be type checked and a TypeError will be 214 raised if the wrong type is input. 215 Defaults to True 216 _path_to_item (tuple/list): This is a list of keys or values to 217 drill down to the model in received_data 218 when deserializing a response 219 _spec_property_naming (bool): True if the variable names in the input data 220 are serialized names, as specified in the OpenAPI document. 221 False if the variable names in the input data 222 are pythonic names, e.g. snake case (default) 223 _configuration (Configuration): the instance to use when 224 deserializing a file_type parameter. 225 If passed, type conversion is attempted 226 If omitted no type conversion is done. 227 _visited_composed_classes (tuple): This stores a tuple of 228 classes that we have traveled through so that 229 if we see that class again we will not use its 230 discriminator again. 231 When traveling through a discriminator, the 232 composed schema that is 233 is traveled through is added to this set. 234 For example if Animal has a discriminator 235 petType and we pass in "Dog", and the class Dog 236 allOf includes Animal, we move through Animal 237 once using the discriminator, and pick Dog. 238 Then in Dog, we will make an instance of the 239 Animal class but this time we won't travel 240 through its discriminator because we passed in 241 _visited_composed_classes = (Animal,) 242 """ 243 244 _check_type = kwargs.pop("_check_type", True) 245 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 246 _path_to_item = kwargs.pop("_path_to_item", ()) 247 _configuration = kwargs.pop("_configuration", None) 248 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 249 250 if args: 251 raise PineconeApiTypeError( 252 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 253 % ( 254 args, 255 self.__class__.__name__, 256 ), 257 path_to_item=_path_to_item, 258 valid_classes=(self.__class__,), 259 ) 260 261 self._data_store = {} 262 self._check_type = _check_type 263 self._spec_property_naming = _spec_property_naming 264 self._path_to_item = _path_to_item 265 self._configuration = _configuration 266 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 267 268 self.indices = indices 269 self.values = values 270 for var_name, var_value in kwargs.items(): 271 if ( 272 var_name not in self.attribute_map 273 and self._configuration is not None 274 and self._configuration.discard_unknown_keys 275 and self.additional_properties_type is None 276 ): 277 # discard variable. 278 continue 279 setattr(self, var_name, var_value) 280 if var_name in self.read_only_vars: 281 raise PineconeApiAttributeError( 282 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 283 f"class with read only attributes." 284 )
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
- allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values.
- attribute_map (dict): The key is attribute name and the value is json key in definition.
- discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name.
- validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex.
- additional_properties_type (tuple): A tuple of classes accepted as additional properties values.
203 @convert_js_args_to_python_args 204 def __init__(self, indices, values, *args, **kwargs): # noqa: E501 205 """SparseValues - a model defined in OpenAPI 206 207 Args: 208 indices ([int]): The indices of the sparse data. 209 values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices. 210 211 Keyword Args: 212 _check_type (bool): if True, values for parameters in openapi_types 213 will be type checked and a TypeError will be 214 raised if the wrong type is input. 215 Defaults to True 216 _path_to_item (tuple/list): This is a list of keys or values to 217 drill down to the model in received_data 218 when deserializing a response 219 _spec_property_naming (bool): True if the variable names in the input data 220 are serialized names, as specified in the OpenAPI document. 221 False if the variable names in the input data 222 are pythonic names, e.g. snake case (default) 223 _configuration (Configuration): the instance to use when 224 deserializing a file_type parameter. 225 If passed, type conversion is attempted 226 If omitted no type conversion is done. 227 _visited_composed_classes (tuple): This stores a tuple of 228 classes that we have traveled through so that 229 if we see that class again we will not use its 230 discriminator again. 231 When traveling through a discriminator, the 232 composed schema that is 233 is traveled through is added to this set. 234 For example if Animal has a discriminator 235 petType and we pass in "Dog", and the class Dog 236 allOf includes Animal, we move through Animal 237 once using the discriminator, and pick Dog. 238 Then in Dog, we will make an instance of the 239 Animal class but this time we won't travel 240 through its discriminator because we passed in 241 _visited_composed_classes = (Animal,) 242 """ 243 244 _check_type = kwargs.pop("_check_type", True) 245 _spec_property_naming = kwargs.pop("_spec_property_naming", False) 246 _path_to_item = kwargs.pop("_path_to_item", ()) 247 _configuration = kwargs.pop("_configuration", None) 248 _visited_composed_classes = kwargs.pop("_visited_composed_classes", ()) 249 250 if args: 251 raise PineconeApiTypeError( 252 "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." 253 % ( 254 args, 255 self.__class__.__name__, 256 ), 257 path_to_item=_path_to_item, 258 valid_classes=(self.__class__,), 259 ) 260 261 self._data_store = {} 262 self._check_type = _check_type 263 self._spec_property_naming = _spec_property_naming 264 self._path_to_item = _path_to_item 265 self._configuration = _configuration 266 self._visited_composed_classes = _visited_composed_classes + (self.__class__,) 267 268 self.indices = indices 269 self.values = values 270 for var_name, var_value in kwargs.items(): 271 if ( 272 var_name not in self.attribute_map 273 and self._configuration is not None 274 and self._configuration.discard_unknown_keys 275 and self.additional_properties_type is None 276 ): 277 # discard variable. 278 continue 279 setattr(self, var_name, var_value) 280 if var_name in self.read_only_vars: 281 raise PineconeApiAttributeError( 282 f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " 283 f"class with read only attributes." 284 )
SparseValues - a model defined in OpenAPI
Arguments:
- indices ([int]): The indices of the sparse data.
- values ([float]): The corresponding values of the sparse data, which must be with the same length as the indices.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,)
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
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.
Inherited Members
- pinecone.core.openapi.shared.model_utils.ModelNormal
- get
- to_dict
- to_str
- pinecone.core.openapi.shared.model_utils.OpenApiModel
- set_attribute