pinecone.data.index
1from tqdm.autonotebook import tqdm 2 3import logging 4import json 5from typing import Union, List, Optional, Dict, Any 6 7from pinecone.config import ConfigBuilder 8 9from pinecone.core.openapi.shared import API_VERSION 10from pinecone.core.openapi.data import ApiClient 11from pinecone.core.openapi.data.models import ( 12 FetchResponse, 13 QueryRequest, 14 QueryResponse, 15 RpcStatus, 16 ScoredVector, 17 SingleQueryResults, 18 DescribeIndexStatsResponse, 19 UpsertRequest, 20 UpsertResponse, 21 Vector, 22 DeleteRequest, 23 UpdateRequest, 24 DescribeIndexStatsRequest, 25 ListResponse, 26 SparseValues, 27) 28from pinecone.core.openapi.data.api.data_plane_api import DataPlaneApi 29from ..utils import ( 30 setup_openapi_client, 31 parse_non_empty_args, 32 build_plugin_setup_client, 33 validate_and_convert_errors, 34) 35from .features.bulk_import import ImportFeatureMixin 36from .vector_factory import VectorFactory 37from .query_results_aggregator import QueryResultsAggregator, QueryNamespacesResults 38 39from multiprocessing.pool import ApplyResult 40from concurrent.futures import as_completed 41 42from pinecone_plugin_interface import load_and_install as install_plugins 43 44logger = logging.getLogger(__name__) 45 46__all__ = [ 47 "Index", 48 "FetchResponse", 49 "QueryRequest", 50 "QueryResponse", 51 "RpcStatus", 52 "ScoredVector", 53 "SingleQueryResults", 54 "DescribeIndexStatsResponse", 55 "UpsertRequest", 56 "UpsertResponse", 57 "UpdateRequest", 58 "Vector", 59 "DeleteRequest", 60 "UpdateRequest", 61 "DescribeIndexStatsRequest", 62 "SparseValues", 63] 64 65_OPENAPI_ENDPOINT_PARAMS = ( 66 "_return_http_data_only", 67 "_preload_content", 68 "_request_timeout", 69 "_check_input_type", 70 "_check_return_type", 71 "_host_index", 72 "async_req", 73 "async_threadpool_executor", 74) 75 76 77def parse_query_response(response: QueryResponse): 78 response._data_store.pop("results", None) 79 return response 80 81 82class Index(ImportFeatureMixin): 83 """ 84 A client for interacting with a Pinecone index via REST API. 85 For improved performance, use the Pinecone GRPC index client. 86 """ 87 88 def __init__( 89 self, 90 api_key: str, 91 host: str, 92 pool_threads: Optional[int] = 1, 93 additional_headers: Optional[Dict[str, str]] = {}, 94 openapi_config=None, 95 **kwargs, 96 ): 97 super().__init__( 98 api_key=api_key, 99 host=host, 100 pool_threads=pool_threads, 101 additional_headers=additional_headers, 102 openapi_config=openapi_config, 103 **kwargs, 104 ) 105 106 self.config = ConfigBuilder.build( 107 api_key=api_key, host=host, additional_headers=additional_headers, **kwargs 108 ) 109 self._openapi_config = ConfigBuilder.build_openapi_config(self.config, openapi_config) 110 self._pool_threads = pool_threads 111 112 if kwargs.get("connection_pool_maxsize", None): 113 self._openapi_config.connection_pool_maxsize = kwargs.get("connection_pool_maxsize") 114 115 self._vector_api = setup_openapi_client( 116 api_client_klass=ApiClient, 117 api_klass=DataPlaneApi, 118 config=self.config, 119 openapi_config=self._openapi_config, 120 pool_threads=self._pool_threads, 121 api_version=API_VERSION, 122 ) 123 124 self._load_plugins() 125 126 def _load_plugins(self): 127 """@private""" 128 try: 129 # I don't expect this to ever throw, but wrapping this in a 130 # try block just in case to make sure a bad plugin doesn't 131 # halt client initialization. 132 openapi_client_builder = build_plugin_setup_client( 133 config=self.config, 134 openapi_config=self._openapi_config, 135 pool_threads=self._pool_threads, 136 ) 137 install_plugins(self, openapi_client_builder) 138 except Exception as e: 139 logger.error(f"Error loading plugins in Index: {e}") 140 141 def __enter__(self): 142 return self 143 144 def __exit__(self, exc_type, exc_value, traceback): 145 self._vector_api.api_client.close() 146 147 @validate_and_convert_errors 148 def upsert( 149 self, 150 vectors: Union[List[Vector], List[tuple], List[dict]], 151 namespace: Optional[str] = None, 152 batch_size: Optional[int] = None, 153 show_progress: bool = True, 154 **kwargs, 155 ) -> UpsertResponse: 156 """ 157 The upsert operation writes vectors into a namespace. 158 If a new value is upserted for an existing vector id, it will overwrite the previous value. 159 160 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 161 162 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 163 164 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 165 where id is a string, vector is a list of floats, metadata is a dict, 166 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 167 168 Examples: 169 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 170 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 171 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 172 173 If a Vector object is used, a Vector object must be of the form 174 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 175 arguments. 176 177 Examples: 178 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 179 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 180 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 181 182 **Note:** the dimension of each vector must match the dimension of the index. 183 184 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}` 185 186 Examples: 187 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 188 >>> 189 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 190 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 191 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 192 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 193 194 API reference: https://docs.pinecone.io/reference/upsert 195 196 Args: 197 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 198 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 199 batch_size (int): The number of vectors to upsert in each batch. 200 If not specified, all vectors will be upserted in a single batch. [optional] 201 show_progress (bool): Whether to show a progress bar using tqdm. 202 Applied only if batch_size is provided. Default is True. 203 Keyword Args: 204 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 205 206 Returns: UpsertResponse, includes the number of vectors upserted. 207 """ 208 _check_type = kwargs.pop("_check_type", True) 209 210 if kwargs.get("async_req", False) and batch_size is not None: 211 raise ValueError( 212 "async_req is not supported when batch_size is provided." 213 "To upsert in parallel, please follow: " 214 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 215 ) 216 217 if batch_size is None: 218 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 219 220 if not isinstance(batch_size, int) or batch_size <= 0: 221 raise ValueError("batch_size must be a positive integer") 222 223 pbar = tqdm(total=len(vectors), disable=not show_progress, desc="Upserted vectors") 224 total_upserted = 0 225 for i in range(0, len(vectors), batch_size): 226 batch_result = self._upsert_batch( 227 vectors[i : i + batch_size], namespace, _check_type, **kwargs 228 ) 229 pbar.update(batch_result.upserted_count) 230 # we can't use here pbar.n for the case show_progress=False 231 total_upserted += batch_result.upserted_count 232 233 return UpsertResponse(upserted_count=total_upserted) 234 235 def _upsert_batch( 236 self, 237 vectors: Union[List[Vector], List[tuple], List[dict]], 238 namespace: Optional[str], 239 _check_type: bool, 240 **kwargs, 241 ) -> UpsertResponse: 242 args_dict = parse_non_empty_args([("namespace", namespace)]) 243 244 def vec_builder(v): 245 return VectorFactory.build(v, check_type=_check_type) 246 247 return self._vector_api.upsert( 248 UpsertRequest( 249 vectors=list(map(vec_builder, vectors)), 250 **args_dict, 251 _check_type=_check_type, 252 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 253 ), 254 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 255 ) 256 257 @staticmethod 258 def _iter_dataframe(df, batch_size): 259 for i in range(0, len(df), batch_size): 260 batch = df.iloc[i : i + batch_size].to_dict(orient="records") 261 yield batch 262 263 def upsert_from_dataframe( 264 self, df, namespace: Optional[str] = None, batch_size: int = 500, show_progress: bool = True 265 ) -> UpsertResponse: 266 """Upserts a dataframe into the index. 267 268 Args: 269 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 270 namespace: The namespace to upsert into. 271 batch_size: The number of rows to upsert in a single batch. 272 show_progress: Whether to show a progress bar. 273 """ 274 try: 275 import pandas as pd 276 except ImportError: 277 raise RuntimeError( 278 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 279 ) 280 281 if not isinstance(df, pd.DataFrame): 282 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 283 284 pbar = tqdm(total=len(df), disable=not show_progress, desc="sending upsert requests") 285 results = [] 286 for chunk in self._iter_dataframe(df, batch_size=batch_size): 287 res = self.upsert(vectors=chunk, namespace=namespace) 288 pbar.update(len(chunk)) 289 results.append(res) 290 291 upserted_count = 0 292 for res in results: 293 upserted_count += res.upserted_count 294 295 return UpsertResponse(upserted_count=upserted_count) 296 297 @validate_and_convert_errors 298 def delete( 299 self, 300 ids: Optional[List[str]] = None, 301 delete_all: Optional[bool] = None, 302 namespace: Optional[str] = None, 303 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 304 **kwargs, 305 ) -> Dict[str, Any]: 306 """ 307 The Delete operation deletes vectors from the index, from a single namespace. 308 No error raised if the vector id does not exist. 309 Note: for any delete call, if namespace is not specified, the default namespace is used. 310 311 Delete can occur in the following mutual exclusive ways: 312 1. Delete by ids from a single namespace 313 2. Delete all vectors from a single namespace by setting delete_all to True 314 3. Delete all vectors from a single namespace by specifying a metadata filter 315 (note that for this option delete all must be set to False) 316 317 API reference: https://docs.pinecone.io/reference/delete_post 318 319 Examples: 320 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 321 >>> index.delete(delete_all=True, namespace='my_namespace') 322 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 323 324 Args: 325 ids (List[str]): Vector ids to delete [optional] 326 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 327 Default is False. 328 namespace (str): The namespace to delete vectors from [optional] 329 If not specified, the default namespace is used. 330 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 331 If specified, the metadata filter here will be used to select the vectors to delete. 332 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 333 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 334 335 Keyword Args: 336 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 337 338 339 Returns: An empty dictionary if the delete operation was successful. 340 """ 341 _check_type = kwargs.pop("_check_type", False) 342 args_dict = parse_non_empty_args( 343 [("ids", ids), ("delete_all", delete_all), ("namespace", namespace), ("filter", filter)] 344 ) 345 346 return self._vector_api.delete( 347 DeleteRequest( 348 **args_dict, 349 **{ 350 k: v 351 for k, v in kwargs.items() 352 if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None 353 }, 354 _check_type=_check_type, 355 ), 356 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 357 ) 358 359 @validate_and_convert_errors 360 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 361 """ 362 The fetch operation looks up and returns vectors, by ID, from a single namespace. 363 The returned vectors include the vector data and/or metadata. 364 365 API reference: https://docs.pinecone.io/reference/fetch 366 367 Examples: 368 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 369 >>> index.fetch(ids=['id1', 'id2']) 370 371 Args: 372 ids (List[str]): The vector IDs to fetch. 373 namespace (str): The namespace to fetch vectors from. 374 If not specified, the default namespace is used. [optional] 375 Keyword Args: 376 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 377 378 379 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 380 """ 381 args_dict = parse_non_empty_args([("namespace", namespace)]) 382 return self._vector_api.fetch(ids=ids, **args_dict, **kwargs) 383 384 @validate_and_convert_errors 385 def query( 386 self, 387 *args, 388 top_k: int, 389 vector: Optional[List[float]] = None, 390 id: Optional[str] = None, 391 namespace: Optional[str] = None, 392 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 393 include_values: Optional[bool] = None, 394 include_metadata: Optional[bool] = None, 395 sparse_vector: Optional[ 396 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 397 ] = None, 398 **kwargs, 399 ) -> Union[QueryResponse, ApplyResult]: 400 """ 401 The Query operation searches a namespace, using a query vector. 402 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 403 404 API reference: https://docs.pinecone.io/reference/query 405 406 Examples: 407 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 408 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 409 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 410 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 411 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 412 >>> top_k=10, namespace='my_namespace') 413 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 414 >>> top_k=10, namespace='my_namespace') 415 416 Args: 417 vector (List[float]): The query vector. This should be the same length as the dimension of the index 418 being queried. Each `query()` request can contain only one of the parameters 419 `id` or `vector`.. [optional] 420 id (str): The unique ID of the vector to be used as a query vector. 421 Each `query()` request can contain only one of the parameters 422 `vector` or `id`. [optional] 423 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 424 namespace (str): The namespace to fetch vectors from. 425 If not specified, the default namespace is used. [optional] 426 filter (Dict[str, Union[str, float, int, bool, List, dict]): 427 The filter to apply. You can use vector metadata to limit your search. 428 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 429 include_values (bool): Indicates whether vector values are included in the response. 430 If omitted the server will use the default value of False [optional] 431 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 432 If omitted the server will use the default value of False [optional] 433 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 434 Expected to be either a SparseValues object or a dict of the form: 435 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 436 437 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 438 and namespace name. 439 """ 440 441 response = self._query( 442 *args, 443 top_k=top_k, 444 vector=vector, 445 id=id, 446 namespace=namespace, 447 filter=filter, 448 include_values=include_values, 449 include_metadata=include_metadata, 450 sparse_vector=sparse_vector, 451 **kwargs, 452 ) 453 454 if kwargs.get("async_req", False) or kwargs.get("async_threadpool_executor", False): 455 return response 456 else: 457 return parse_query_response(response) 458 459 def _query( 460 self, 461 *args, 462 top_k: int, 463 vector: Optional[List[float]] = None, 464 id: Optional[str] = None, 465 namespace: Optional[str] = None, 466 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 467 include_values: Optional[bool] = None, 468 include_metadata: Optional[bool] = None, 469 sparse_vector: Optional[ 470 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 471 ] = None, 472 **kwargs, 473 ) -> QueryResponse: 474 if len(args) > 0: 475 raise ValueError( 476 "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')" 477 ) 478 479 if vector is not None and id is not None: 480 raise ValueError("Cannot specify both `id` and `vector`") 481 482 _check_type = kwargs.pop("_check_type", False) 483 484 sparse_vector = self._parse_sparse_values_arg(sparse_vector) 485 args_dict = parse_non_empty_args( 486 [ 487 ("vector", vector), 488 ("id", id), 489 ("queries", None), 490 ("top_k", top_k), 491 ("namespace", namespace), 492 ("filter", filter), 493 ("include_values", include_values), 494 ("include_metadata", include_metadata), 495 ("sparse_vector", sparse_vector), 496 ] 497 ) 498 499 response = self._vector_api.query( 500 QueryRequest( 501 **args_dict, 502 _check_type=_check_type, 503 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 504 ), 505 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 506 ) 507 return response 508 509 @validate_and_convert_errors 510 def query_namespaces( 511 self, 512 vector: List[float], 513 namespaces: List[str], 514 top_k: Optional[int] = None, 515 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 516 include_values: Optional[bool] = None, 517 include_metadata: Optional[bool] = None, 518 sparse_vector: Optional[ 519 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 520 ] = None, 521 **kwargs, 522 ) -> QueryNamespacesResults: 523 """The query_namespaces() method is used to make a query to multiple namespaces in parallel and combine the results into one result set. 524 525 Since several asynchronous calls are made on your behalf when calling this method, you will need to tune the pool_threads and connection_pool_maxsize parameter of the Index constructor to suite your workload. 526 527 Examples: 528 529 ```python 530 from pinecone import Pinecone 531 532 pc = Pinecone(api_key="your-api-key") 533 index = pc.Index( 534 host="index-name", 535 pool_threads=32, 536 connection_pool_maxsize=32 537 ) 538 539 query_vec = [0.1, 0.2, 0.3] # An embedding that matches the index dimension 540 combined_results = index.query_namespaces( 541 vector=query_vec, 542 namespaces=['ns1', 'ns2', 'ns3', 'ns4'], 543 top_k=10, 544 filter={'genre': {"$eq": "drama"}}, 545 include_values=True, 546 include_metadata=True 547 ) 548 for vec in combined_results.matches: 549 print(vec.id, vec.score) 550 print(combined_results.usage) 551 ``` 552 553 Args: 554 vector (List[float]): The query vector, must be the same length as the dimension of the index being queried. 555 namespaces (List[str]): The list of namespaces to query. 556 top_k (Optional[int], optional): The number of results you would like to request from each namespace. Defaults to 10. 557 filter (Optional[Dict[str, Union[str, float, int, bool, List, dict]]], optional): Pass an optional filter to filter results based on metadata. Defaults to None. 558 include_values (Optional[bool], optional): Boolean field indicating whether vector values should be included with results. Defaults to None. 559 include_metadata (Optional[bool], optional): Boolean field indicating whether vector metadata should be included with results. Defaults to None. 560 sparse_vector (Optional[ Union[SparseValues, Dict[str, Union[List[float], List[int]]]] ], optional): If you are working with a dotproduct index, you can pass a sparse vector as part of your hybrid search. Defaults to None. 561 562 Returns: 563 QueryNamespacesResults: A QueryNamespacesResults object containing the combined results from all namespaces, as well as the combined usage cost in read units. 564 """ 565 if namespaces is None or len(namespaces) == 0: 566 raise ValueError("At least one namespace must be specified") 567 if len(vector) == 0: 568 raise ValueError("Query vector must not be empty") 569 570 overall_topk = top_k if top_k is not None else 10 571 aggregator = QueryResultsAggregator(top_k=overall_topk) 572 573 target_namespaces = set(namespaces) # dedup namespaces 574 async_futures = [ 575 self.query( 576 vector=vector, 577 namespace=ns, 578 top_k=overall_topk, 579 filter=filter, 580 include_values=include_values, 581 include_metadata=include_metadata, 582 sparse_vector=sparse_vector, 583 async_threadpool_executor=True, 584 _preload_content=False, 585 **kwargs, 586 ) 587 for ns in target_namespaces 588 ] 589 590 for result in as_completed(async_futures): 591 raw_result = result.result() 592 response = json.loads(raw_result.data.decode("utf-8")) 593 aggregator.add_results(response) 594 595 final_results = aggregator.get_results() 596 return final_results 597 598 @validate_and_convert_errors 599 def update( 600 self, 601 id: str, 602 values: Optional[List[float]] = None, 603 set_metadata: Optional[ 604 Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]] 605 ] = None, 606 namespace: Optional[str] = None, 607 sparse_values: Optional[ 608 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 609 ] = None, 610 **kwargs, 611 ) -> Dict[str, Any]: 612 """ 613 The Update operation updates vector in a namespace. 614 If a value is included, it will overwrite the previous value. 615 If a set_metadata is included, 616 the values of the fields specified in it will be added or overwrite the previous value. 617 618 API reference: https://docs.pinecone.io/reference/update 619 620 Examples: 621 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 622 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 623 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 624 >>> namespace='my_namespace') 625 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 626 >>> namespace='my_namespace') 627 628 Args: 629 id (str): Vector's unique id. 630 values (List[float]): vector values to set. [optional] 631 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 632 metadata to set for vector. [optional] 633 namespace (str): Namespace name where to update the vector.. [optional] 634 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 635 Expected to be either a SparseValues object or a dict of the form: 636 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 637 638 Keyword Args: 639 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 640 641 Returns: An empty dictionary if the update was successful. 642 """ 643 _check_type = kwargs.pop("_check_type", False) 644 sparse_values = self._parse_sparse_values_arg(sparse_values) 645 args_dict = parse_non_empty_args( 646 [ 647 ("values", values), 648 ("set_metadata", set_metadata), 649 ("namespace", namespace), 650 ("sparse_values", sparse_values), 651 ] 652 ) 653 return self._vector_api.update( 654 UpdateRequest( 655 id=id, 656 **args_dict, 657 _check_type=_check_type, 658 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 659 ), 660 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 661 ) 662 663 @validate_and_convert_errors 664 def describe_index_stats( 665 self, filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, **kwargs 666 ) -> DescribeIndexStatsResponse: 667 """ 668 The DescribeIndexStats operation returns statistics about the index's contents. 669 For example: The vector count per namespace and the number of dimensions. 670 671 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 672 673 Examples: 674 >>> index.describe_index_stats() 675 >>> index.describe_index_stats(filter={'key': 'value'}) 676 677 Args: 678 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 679 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 680 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 681 682 Returns: DescribeIndexStatsResponse object which contains stats about the index. 683 """ 684 _check_type = kwargs.pop("_check_type", False) 685 args_dict = parse_non_empty_args([("filter", filter)]) 686 687 return self._vector_api.describe_index_stats( 688 DescribeIndexStatsRequest( 689 **args_dict, 690 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 691 _check_type=_check_type, 692 ), 693 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 694 ) 695 696 @validate_and_convert_errors 697 def list_paginated( 698 self, 699 prefix: Optional[str] = None, 700 limit: Optional[int] = None, 701 pagination_token: Optional[str] = None, 702 namespace: Optional[str] = None, 703 **kwargs, 704 ) -> ListResponse: 705 """ 706 The list_paginated operation finds vectors based on an id prefix within a single namespace. 707 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 708 This id list can then be passed to fetch or delete operations, depending on your use case. 709 710 Consider using the `list` method to avoid having to handle pagination tokens manually. 711 712 Examples: 713 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 714 >>> [v.id for v in results.vectors] 715 ['99', '990', '991', '992', '993'] 716 >>> results.pagination.next 717 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 718 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 719 720 Args: 721 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 722 be used with the effect of listing all ids in a namespace [optional] 723 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 724 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 725 in the response if additional results are available. [optional] 726 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 727 728 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 729 """ 730 args_dict = parse_non_empty_args( 731 [ 732 ("prefix", prefix), 733 ("limit", limit), 734 ("namespace", namespace), 735 ("pagination_token", pagination_token), 736 ] 737 ) 738 return self._vector_api.list(**args_dict, **kwargs) 739 740 @validate_and_convert_errors 741 def list(self, **kwargs): 742 """ 743 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 744 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 745 behalf. 746 747 Examples: 748 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 749 >>> print(ids) 750 ['99', '990', '991', '992', '993'] 751 ['994', '995', '996', '997', '998'] 752 ['999'] 753 754 Args: 755 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 756 be used with the effect of listing all ids in a namespace [optional] 757 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 758 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 759 in the response if additional results are available. [optional] 760 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 761 """ 762 done = False 763 while not done: 764 results = self.list_paginated(**kwargs) 765 if len(results.vectors) > 0: 766 yield [v.id for v in results.vectors] 767 768 if results.pagination: 769 kwargs.update({"pagination_token": results.pagination.next}) 770 else: 771 done = True 772 773 @staticmethod 774 def _parse_sparse_values_arg( 775 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]], 776 ) -> Optional[SparseValues]: 777 if sparse_values is None: 778 return None 779 780 if isinstance(sparse_values, SparseValues): 781 return sparse_values 782 783 if ( 784 not isinstance(sparse_values, dict) 785 or "indices" not in sparse_values 786 or "values" not in sparse_values 787 ): 788 raise ValueError( 789 "Invalid sparse values argument. Expected a dict of: {'indices': List[int], 'values': List[float]}." 790 f"Received: {sparse_values}" 791 ) 792 793 return SparseValues(indices=sparse_values["indices"], values=sparse_values["values"])
83class Index(ImportFeatureMixin): 84 """ 85 A client for interacting with a Pinecone index via REST API. 86 For improved performance, use the Pinecone GRPC index client. 87 """ 88 89 def __init__( 90 self, 91 api_key: str, 92 host: str, 93 pool_threads: Optional[int] = 1, 94 additional_headers: Optional[Dict[str, str]] = {}, 95 openapi_config=None, 96 **kwargs, 97 ): 98 super().__init__( 99 api_key=api_key, 100 host=host, 101 pool_threads=pool_threads, 102 additional_headers=additional_headers, 103 openapi_config=openapi_config, 104 **kwargs, 105 ) 106 107 self.config = ConfigBuilder.build( 108 api_key=api_key, host=host, additional_headers=additional_headers, **kwargs 109 ) 110 self._openapi_config = ConfigBuilder.build_openapi_config(self.config, openapi_config) 111 self._pool_threads = pool_threads 112 113 if kwargs.get("connection_pool_maxsize", None): 114 self._openapi_config.connection_pool_maxsize = kwargs.get("connection_pool_maxsize") 115 116 self._vector_api = setup_openapi_client( 117 api_client_klass=ApiClient, 118 api_klass=DataPlaneApi, 119 config=self.config, 120 openapi_config=self._openapi_config, 121 pool_threads=self._pool_threads, 122 api_version=API_VERSION, 123 ) 124 125 self._load_plugins() 126 127 def _load_plugins(self): 128 """@private""" 129 try: 130 # I don't expect this to ever throw, but wrapping this in a 131 # try block just in case to make sure a bad plugin doesn't 132 # halt client initialization. 133 openapi_client_builder = build_plugin_setup_client( 134 config=self.config, 135 openapi_config=self._openapi_config, 136 pool_threads=self._pool_threads, 137 ) 138 install_plugins(self, openapi_client_builder) 139 except Exception as e: 140 logger.error(f"Error loading plugins in Index: {e}") 141 142 def __enter__(self): 143 return self 144 145 def __exit__(self, exc_type, exc_value, traceback): 146 self._vector_api.api_client.close() 147 148 @validate_and_convert_errors 149 def upsert( 150 self, 151 vectors: Union[List[Vector], List[tuple], List[dict]], 152 namespace: Optional[str] = None, 153 batch_size: Optional[int] = None, 154 show_progress: bool = True, 155 **kwargs, 156 ) -> UpsertResponse: 157 """ 158 The upsert operation writes vectors into a namespace. 159 If a new value is upserted for an existing vector id, it will overwrite the previous value. 160 161 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 162 163 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 164 165 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 166 where id is a string, vector is a list of floats, metadata is a dict, 167 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 168 169 Examples: 170 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 171 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 172 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 173 174 If a Vector object is used, a Vector object must be of the form 175 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 176 arguments. 177 178 Examples: 179 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 180 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 181 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 182 183 **Note:** the dimension of each vector must match the dimension of the index. 184 185 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}` 186 187 Examples: 188 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 189 >>> 190 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 191 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 192 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 193 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 194 195 API reference: https://docs.pinecone.io/reference/upsert 196 197 Args: 198 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 199 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 200 batch_size (int): The number of vectors to upsert in each batch. 201 If not specified, all vectors will be upserted in a single batch. [optional] 202 show_progress (bool): Whether to show a progress bar using tqdm. 203 Applied only if batch_size is provided. Default is True. 204 Keyword Args: 205 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 206 207 Returns: UpsertResponse, includes the number of vectors upserted. 208 """ 209 _check_type = kwargs.pop("_check_type", True) 210 211 if kwargs.get("async_req", False) and batch_size is not None: 212 raise ValueError( 213 "async_req is not supported when batch_size is provided." 214 "To upsert in parallel, please follow: " 215 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 216 ) 217 218 if batch_size is None: 219 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 220 221 if not isinstance(batch_size, int) or batch_size <= 0: 222 raise ValueError("batch_size must be a positive integer") 223 224 pbar = tqdm(total=len(vectors), disable=not show_progress, desc="Upserted vectors") 225 total_upserted = 0 226 for i in range(0, len(vectors), batch_size): 227 batch_result = self._upsert_batch( 228 vectors[i : i + batch_size], namespace, _check_type, **kwargs 229 ) 230 pbar.update(batch_result.upserted_count) 231 # we can't use here pbar.n for the case show_progress=False 232 total_upserted += batch_result.upserted_count 233 234 return UpsertResponse(upserted_count=total_upserted) 235 236 def _upsert_batch( 237 self, 238 vectors: Union[List[Vector], List[tuple], List[dict]], 239 namespace: Optional[str], 240 _check_type: bool, 241 **kwargs, 242 ) -> UpsertResponse: 243 args_dict = parse_non_empty_args([("namespace", namespace)]) 244 245 def vec_builder(v): 246 return VectorFactory.build(v, check_type=_check_type) 247 248 return self._vector_api.upsert( 249 UpsertRequest( 250 vectors=list(map(vec_builder, vectors)), 251 **args_dict, 252 _check_type=_check_type, 253 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 254 ), 255 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 256 ) 257 258 @staticmethod 259 def _iter_dataframe(df, batch_size): 260 for i in range(0, len(df), batch_size): 261 batch = df.iloc[i : i + batch_size].to_dict(orient="records") 262 yield batch 263 264 def upsert_from_dataframe( 265 self, df, namespace: Optional[str] = None, batch_size: int = 500, show_progress: bool = True 266 ) -> UpsertResponse: 267 """Upserts a dataframe into the index. 268 269 Args: 270 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 271 namespace: The namespace to upsert into. 272 batch_size: The number of rows to upsert in a single batch. 273 show_progress: Whether to show a progress bar. 274 """ 275 try: 276 import pandas as pd 277 except ImportError: 278 raise RuntimeError( 279 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 280 ) 281 282 if not isinstance(df, pd.DataFrame): 283 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 284 285 pbar = tqdm(total=len(df), disable=not show_progress, desc="sending upsert requests") 286 results = [] 287 for chunk in self._iter_dataframe(df, batch_size=batch_size): 288 res = self.upsert(vectors=chunk, namespace=namespace) 289 pbar.update(len(chunk)) 290 results.append(res) 291 292 upserted_count = 0 293 for res in results: 294 upserted_count += res.upserted_count 295 296 return UpsertResponse(upserted_count=upserted_count) 297 298 @validate_and_convert_errors 299 def delete( 300 self, 301 ids: Optional[List[str]] = None, 302 delete_all: Optional[bool] = None, 303 namespace: Optional[str] = None, 304 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 305 **kwargs, 306 ) -> Dict[str, Any]: 307 """ 308 The Delete operation deletes vectors from the index, from a single namespace. 309 No error raised if the vector id does not exist. 310 Note: for any delete call, if namespace is not specified, the default namespace is used. 311 312 Delete can occur in the following mutual exclusive ways: 313 1. Delete by ids from a single namespace 314 2. Delete all vectors from a single namespace by setting delete_all to True 315 3. Delete all vectors from a single namespace by specifying a metadata filter 316 (note that for this option delete all must be set to False) 317 318 API reference: https://docs.pinecone.io/reference/delete_post 319 320 Examples: 321 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 322 >>> index.delete(delete_all=True, namespace='my_namespace') 323 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 324 325 Args: 326 ids (List[str]): Vector ids to delete [optional] 327 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 328 Default is False. 329 namespace (str): The namespace to delete vectors from [optional] 330 If not specified, the default namespace is used. 331 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 332 If specified, the metadata filter here will be used to select the vectors to delete. 333 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 334 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 335 336 Keyword Args: 337 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 338 339 340 Returns: An empty dictionary if the delete operation was successful. 341 """ 342 _check_type = kwargs.pop("_check_type", False) 343 args_dict = parse_non_empty_args( 344 [("ids", ids), ("delete_all", delete_all), ("namespace", namespace), ("filter", filter)] 345 ) 346 347 return self._vector_api.delete( 348 DeleteRequest( 349 **args_dict, 350 **{ 351 k: v 352 for k, v in kwargs.items() 353 if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None 354 }, 355 _check_type=_check_type, 356 ), 357 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 358 ) 359 360 @validate_and_convert_errors 361 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 362 """ 363 The fetch operation looks up and returns vectors, by ID, from a single namespace. 364 The returned vectors include the vector data and/or metadata. 365 366 API reference: https://docs.pinecone.io/reference/fetch 367 368 Examples: 369 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 370 >>> index.fetch(ids=['id1', 'id2']) 371 372 Args: 373 ids (List[str]): The vector IDs to fetch. 374 namespace (str): The namespace to fetch vectors from. 375 If not specified, the default namespace is used. [optional] 376 Keyword Args: 377 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 378 379 380 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 381 """ 382 args_dict = parse_non_empty_args([("namespace", namespace)]) 383 return self._vector_api.fetch(ids=ids, **args_dict, **kwargs) 384 385 @validate_and_convert_errors 386 def query( 387 self, 388 *args, 389 top_k: int, 390 vector: Optional[List[float]] = None, 391 id: Optional[str] = None, 392 namespace: Optional[str] = None, 393 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 394 include_values: Optional[bool] = None, 395 include_metadata: Optional[bool] = None, 396 sparse_vector: Optional[ 397 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 398 ] = None, 399 **kwargs, 400 ) -> Union[QueryResponse, ApplyResult]: 401 """ 402 The Query operation searches a namespace, using a query vector. 403 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 404 405 API reference: https://docs.pinecone.io/reference/query 406 407 Examples: 408 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 409 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 410 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 411 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 412 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 413 >>> top_k=10, namespace='my_namespace') 414 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 415 >>> top_k=10, namespace='my_namespace') 416 417 Args: 418 vector (List[float]): The query vector. This should be the same length as the dimension of the index 419 being queried. Each `query()` request can contain only one of the parameters 420 `id` or `vector`.. [optional] 421 id (str): The unique ID of the vector to be used as a query vector. 422 Each `query()` request can contain only one of the parameters 423 `vector` or `id`. [optional] 424 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 425 namespace (str): The namespace to fetch vectors from. 426 If not specified, the default namespace is used. [optional] 427 filter (Dict[str, Union[str, float, int, bool, List, dict]): 428 The filter to apply. You can use vector metadata to limit your search. 429 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 430 include_values (bool): Indicates whether vector values are included in the response. 431 If omitted the server will use the default value of False [optional] 432 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 433 If omitted the server will use the default value of False [optional] 434 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 435 Expected to be either a SparseValues object or a dict of the form: 436 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 437 438 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 439 and namespace name. 440 """ 441 442 response = self._query( 443 *args, 444 top_k=top_k, 445 vector=vector, 446 id=id, 447 namespace=namespace, 448 filter=filter, 449 include_values=include_values, 450 include_metadata=include_metadata, 451 sparse_vector=sparse_vector, 452 **kwargs, 453 ) 454 455 if kwargs.get("async_req", False) or kwargs.get("async_threadpool_executor", False): 456 return response 457 else: 458 return parse_query_response(response) 459 460 def _query( 461 self, 462 *args, 463 top_k: int, 464 vector: Optional[List[float]] = None, 465 id: Optional[str] = None, 466 namespace: Optional[str] = None, 467 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 468 include_values: Optional[bool] = None, 469 include_metadata: Optional[bool] = None, 470 sparse_vector: Optional[ 471 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 472 ] = None, 473 **kwargs, 474 ) -> QueryResponse: 475 if len(args) > 0: 476 raise ValueError( 477 "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')" 478 ) 479 480 if vector is not None and id is not None: 481 raise ValueError("Cannot specify both `id` and `vector`") 482 483 _check_type = kwargs.pop("_check_type", False) 484 485 sparse_vector = self._parse_sparse_values_arg(sparse_vector) 486 args_dict = parse_non_empty_args( 487 [ 488 ("vector", vector), 489 ("id", id), 490 ("queries", None), 491 ("top_k", top_k), 492 ("namespace", namespace), 493 ("filter", filter), 494 ("include_values", include_values), 495 ("include_metadata", include_metadata), 496 ("sparse_vector", sparse_vector), 497 ] 498 ) 499 500 response = self._vector_api.query( 501 QueryRequest( 502 **args_dict, 503 _check_type=_check_type, 504 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 505 ), 506 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 507 ) 508 return response 509 510 @validate_and_convert_errors 511 def query_namespaces( 512 self, 513 vector: List[float], 514 namespaces: List[str], 515 top_k: Optional[int] = None, 516 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 517 include_values: Optional[bool] = None, 518 include_metadata: Optional[bool] = None, 519 sparse_vector: Optional[ 520 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 521 ] = None, 522 **kwargs, 523 ) -> QueryNamespacesResults: 524 """The query_namespaces() method is used to make a query to multiple namespaces in parallel and combine the results into one result set. 525 526 Since several asynchronous calls are made on your behalf when calling this method, you will need to tune the pool_threads and connection_pool_maxsize parameter of the Index constructor to suite your workload. 527 528 Examples: 529 530 ```python 531 from pinecone import Pinecone 532 533 pc = Pinecone(api_key="your-api-key") 534 index = pc.Index( 535 host="index-name", 536 pool_threads=32, 537 connection_pool_maxsize=32 538 ) 539 540 query_vec = [0.1, 0.2, 0.3] # An embedding that matches the index dimension 541 combined_results = index.query_namespaces( 542 vector=query_vec, 543 namespaces=['ns1', 'ns2', 'ns3', 'ns4'], 544 top_k=10, 545 filter={'genre': {"$eq": "drama"}}, 546 include_values=True, 547 include_metadata=True 548 ) 549 for vec in combined_results.matches: 550 print(vec.id, vec.score) 551 print(combined_results.usage) 552 ``` 553 554 Args: 555 vector (List[float]): The query vector, must be the same length as the dimension of the index being queried. 556 namespaces (List[str]): The list of namespaces to query. 557 top_k (Optional[int], optional): The number of results you would like to request from each namespace. Defaults to 10. 558 filter (Optional[Dict[str, Union[str, float, int, bool, List, dict]]], optional): Pass an optional filter to filter results based on metadata. Defaults to None. 559 include_values (Optional[bool], optional): Boolean field indicating whether vector values should be included with results. Defaults to None. 560 include_metadata (Optional[bool], optional): Boolean field indicating whether vector metadata should be included with results. Defaults to None. 561 sparse_vector (Optional[ Union[SparseValues, Dict[str, Union[List[float], List[int]]]] ], optional): If you are working with a dotproduct index, you can pass a sparse vector as part of your hybrid search. Defaults to None. 562 563 Returns: 564 QueryNamespacesResults: A QueryNamespacesResults object containing the combined results from all namespaces, as well as the combined usage cost in read units. 565 """ 566 if namespaces is None or len(namespaces) == 0: 567 raise ValueError("At least one namespace must be specified") 568 if len(vector) == 0: 569 raise ValueError("Query vector must not be empty") 570 571 overall_topk = top_k if top_k is not None else 10 572 aggregator = QueryResultsAggregator(top_k=overall_topk) 573 574 target_namespaces = set(namespaces) # dedup namespaces 575 async_futures = [ 576 self.query( 577 vector=vector, 578 namespace=ns, 579 top_k=overall_topk, 580 filter=filter, 581 include_values=include_values, 582 include_metadata=include_metadata, 583 sparse_vector=sparse_vector, 584 async_threadpool_executor=True, 585 _preload_content=False, 586 **kwargs, 587 ) 588 for ns in target_namespaces 589 ] 590 591 for result in as_completed(async_futures): 592 raw_result = result.result() 593 response = json.loads(raw_result.data.decode("utf-8")) 594 aggregator.add_results(response) 595 596 final_results = aggregator.get_results() 597 return final_results 598 599 @validate_and_convert_errors 600 def update( 601 self, 602 id: str, 603 values: Optional[List[float]] = None, 604 set_metadata: Optional[ 605 Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]] 606 ] = None, 607 namespace: Optional[str] = None, 608 sparse_values: Optional[ 609 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 610 ] = None, 611 **kwargs, 612 ) -> Dict[str, Any]: 613 """ 614 The Update operation updates vector in a namespace. 615 If a value is included, it will overwrite the previous value. 616 If a set_metadata is included, 617 the values of the fields specified in it will be added or overwrite the previous value. 618 619 API reference: https://docs.pinecone.io/reference/update 620 621 Examples: 622 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 623 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 624 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 625 >>> namespace='my_namespace') 626 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 627 >>> namespace='my_namespace') 628 629 Args: 630 id (str): Vector's unique id. 631 values (List[float]): vector values to set. [optional] 632 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 633 metadata to set for vector. [optional] 634 namespace (str): Namespace name where to update the vector.. [optional] 635 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 636 Expected to be either a SparseValues object or a dict of the form: 637 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 638 639 Keyword Args: 640 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 641 642 Returns: An empty dictionary if the update was successful. 643 """ 644 _check_type = kwargs.pop("_check_type", False) 645 sparse_values = self._parse_sparse_values_arg(sparse_values) 646 args_dict = parse_non_empty_args( 647 [ 648 ("values", values), 649 ("set_metadata", set_metadata), 650 ("namespace", namespace), 651 ("sparse_values", sparse_values), 652 ] 653 ) 654 return self._vector_api.update( 655 UpdateRequest( 656 id=id, 657 **args_dict, 658 _check_type=_check_type, 659 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 660 ), 661 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 662 ) 663 664 @validate_and_convert_errors 665 def describe_index_stats( 666 self, filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, **kwargs 667 ) -> DescribeIndexStatsResponse: 668 """ 669 The DescribeIndexStats operation returns statistics about the index's contents. 670 For example: The vector count per namespace and the number of dimensions. 671 672 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 673 674 Examples: 675 >>> index.describe_index_stats() 676 >>> index.describe_index_stats(filter={'key': 'value'}) 677 678 Args: 679 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 680 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 681 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 682 683 Returns: DescribeIndexStatsResponse object which contains stats about the index. 684 """ 685 _check_type = kwargs.pop("_check_type", False) 686 args_dict = parse_non_empty_args([("filter", filter)]) 687 688 return self._vector_api.describe_index_stats( 689 DescribeIndexStatsRequest( 690 **args_dict, 691 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 692 _check_type=_check_type, 693 ), 694 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 695 ) 696 697 @validate_and_convert_errors 698 def list_paginated( 699 self, 700 prefix: Optional[str] = None, 701 limit: Optional[int] = None, 702 pagination_token: Optional[str] = None, 703 namespace: Optional[str] = None, 704 **kwargs, 705 ) -> ListResponse: 706 """ 707 The list_paginated operation finds vectors based on an id prefix within a single namespace. 708 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 709 This id list can then be passed to fetch or delete operations, depending on your use case. 710 711 Consider using the `list` method to avoid having to handle pagination tokens manually. 712 713 Examples: 714 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 715 >>> [v.id for v in results.vectors] 716 ['99', '990', '991', '992', '993'] 717 >>> results.pagination.next 718 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 719 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 720 721 Args: 722 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 723 be used with the effect of listing all ids in a namespace [optional] 724 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 725 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 726 in the response if additional results are available. [optional] 727 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 728 729 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 730 """ 731 args_dict = parse_non_empty_args( 732 [ 733 ("prefix", prefix), 734 ("limit", limit), 735 ("namespace", namespace), 736 ("pagination_token", pagination_token), 737 ] 738 ) 739 return self._vector_api.list(**args_dict, **kwargs) 740 741 @validate_and_convert_errors 742 def list(self, **kwargs): 743 """ 744 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 745 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 746 behalf. 747 748 Examples: 749 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 750 >>> print(ids) 751 ['99', '990', '991', '992', '993'] 752 ['994', '995', '996', '997', '998'] 753 ['999'] 754 755 Args: 756 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 757 be used with the effect of listing all ids in a namespace [optional] 758 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 759 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 760 in the response if additional results are available. [optional] 761 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 762 """ 763 done = False 764 while not done: 765 results = self.list_paginated(**kwargs) 766 if len(results.vectors) > 0: 767 yield [v.id for v in results.vectors] 768 769 if results.pagination: 770 kwargs.update({"pagination_token": results.pagination.next}) 771 else: 772 done = True 773 774 @staticmethod 775 def _parse_sparse_values_arg( 776 sparse_values: Optional[Union[SparseValues, Dict[str, Union[List[float], List[int]]]]], 777 ) -> Optional[SparseValues]: 778 if sparse_values is None: 779 return None 780 781 if isinstance(sparse_values, SparseValues): 782 return sparse_values 783 784 if ( 785 not isinstance(sparse_values, dict) 786 or "indices" not in sparse_values 787 or "values" not in sparse_values 788 ): 789 raise ValueError( 790 "Invalid sparse values argument. Expected a dict of: {'indices': List[int], 'values': List[float]}." 791 f"Received: {sparse_values}" 792 ) 793 794 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.
89 def __init__( 90 self, 91 api_key: str, 92 host: str, 93 pool_threads: Optional[int] = 1, 94 additional_headers: Optional[Dict[str, str]] = {}, 95 openapi_config=None, 96 **kwargs, 97 ): 98 super().__init__( 99 api_key=api_key, 100 host=host, 101 pool_threads=pool_threads, 102 additional_headers=additional_headers, 103 openapi_config=openapi_config, 104 **kwargs, 105 ) 106 107 self.config = ConfigBuilder.build( 108 api_key=api_key, host=host, additional_headers=additional_headers, **kwargs 109 ) 110 self._openapi_config = ConfigBuilder.build_openapi_config(self.config, openapi_config) 111 self._pool_threads = pool_threads 112 113 if kwargs.get("connection_pool_maxsize", None): 114 self._openapi_config.connection_pool_maxsize = kwargs.get("connection_pool_maxsize") 115 116 self._vector_api = setup_openapi_client( 117 api_client_klass=ApiClient, 118 api_klass=DataPlaneApi, 119 config=self.config, 120 openapi_config=self._openapi_config, 121 pool_threads=self._pool_threads, 122 api_version=API_VERSION, 123 ) 124 125 self._load_plugins()
148 @validate_and_convert_errors 149 def upsert( 150 self, 151 vectors: Union[List[Vector], List[tuple], List[dict]], 152 namespace: Optional[str] = None, 153 batch_size: Optional[int] = None, 154 show_progress: bool = True, 155 **kwargs, 156 ) -> UpsertResponse: 157 """ 158 The upsert operation writes vectors into a namespace. 159 If a new value is upserted for an existing vector id, it will overwrite the previous value. 160 161 To upsert in parallel follow: https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel 162 163 A vector can be represented by a 1) Vector object, a 2) tuple or 3) a dictionary 164 165 If a tuple is used, it must be of the form `(id, values, metadata)` or `(id, values)`. 166 where id is a string, vector is a list of floats, metadata is a dict, 167 and sparse_values is a dict of the form `{'indices': List[int], 'values': List[float]}`. 168 169 Examples: 170 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}, {'indices': [1, 2], 'values': [0.2, 0.4]}) 171 >>> ('id1', [1.0, 2.0, 3.0], None, {'indices': [1, 2], 'values': [0.2, 0.4]}) 172 >>> ('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0]) 173 174 If a Vector object is used, a Vector object must be of the form 175 `Vector(id, values, metadata, sparse_values)`, where metadata and sparse_values are optional 176 arguments. 177 178 Examples: 179 >>> Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}) 180 >>> Vector(id='id2', values=[1.0, 2.0, 3.0]) 181 >>> Vector(id='id3', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4])) 182 183 **Note:** the dimension of each vector must match the dimension of the index. 184 185 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}` 186 187 Examples: 188 >>> index.upsert([('id1', [1.0, 2.0, 3.0], {'key': 'value'}), ('id2', [1.0, 2.0, 3.0])]) 189 >>> 190 >>> index.upsert([{'id': 'id1', 'values': [1.0, 2.0, 3.0], 'metadata': {'key': 'value'}}, 191 >>> {'id': 'id2', 'values': [1.0, 2.0, 3.0], 'sparse_values': {'indices': [1, 8], 'values': [0.2, 0.4]}]) 192 >>> index.upsert([Vector(id='id1', values=[1.0, 2.0, 3.0], metadata={'key': 'value'}), 193 >>> Vector(id='id2', values=[1.0, 2.0, 3.0], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]))]) 194 195 API reference: https://docs.pinecone.io/reference/upsert 196 197 Args: 198 vectors (Union[List[Vector], List[Tuple]]): A list of vectors to upsert. 199 namespace (str): The namespace to write to. If not specified, the default namespace is used. [optional] 200 batch_size (int): The number of vectors to upsert in each batch. 201 If not specified, all vectors will be upserted in a single batch. [optional] 202 show_progress (bool): Whether to show a progress bar using tqdm. 203 Applied only if batch_size is provided. Default is True. 204 Keyword Args: 205 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpsertRequest for more details. 206 207 Returns: UpsertResponse, includes the number of vectors upserted. 208 """ 209 _check_type = kwargs.pop("_check_type", True) 210 211 if kwargs.get("async_req", False) and batch_size is not None: 212 raise ValueError( 213 "async_req is not supported when batch_size is provided." 214 "To upsert in parallel, please follow: " 215 "https://docs.pinecone.io/docs/insert-data#sending-upserts-in-parallel" 216 ) 217 218 if batch_size is None: 219 return self._upsert_batch(vectors, namespace, _check_type, **kwargs) 220 221 if not isinstance(batch_size, int) or batch_size <= 0: 222 raise ValueError("batch_size must be a positive integer") 223 224 pbar = tqdm(total=len(vectors), disable=not show_progress, desc="Upserted vectors") 225 total_upserted = 0 226 for i in range(0, len(vectors), batch_size): 227 batch_result = self._upsert_batch( 228 vectors[i : i + batch_size], namespace, _check_type, **kwargs 229 ) 230 pbar.update(batch_result.upserted_count) 231 # we can't use here pbar.n for the case show_progress=False 232 total_upserted += batch_result.upserted_count 233 234 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.
264 def upsert_from_dataframe( 265 self, df, namespace: Optional[str] = None, batch_size: int = 500, show_progress: bool = True 266 ) -> UpsertResponse: 267 """Upserts a dataframe into the index. 268 269 Args: 270 df: A pandas dataframe with the following columns: id, values, sparse_values, and metadata. 271 namespace: The namespace to upsert into. 272 batch_size: The number of rows to upsert in a single batch. 273 show_progress: Whether to show a progress bar. 274 """ 275 try: 276 import pandas as pd 277 except ImportError: 278 raise RuntimeError( 279 "The `pandas` package is not installed. Please install pandas to use `upsert_from_dataframe()`" 280 ) 281 282 if not isinstance(df, pd.DataFrame): 283 raise ValueError(f"Only pandas dataframes are supported. Found: {type(df)}") 284 285 pbar = tqdm(total=len(df), disable=not show_progress, desc="sending upsert requests") 286 results = [] 287 for chunk in self._iter_dataframe(df, batch_size=batch_size): 288 res = self.upsert(vectors=chunk, namespace=namespace) 289 pbar.update(len(chunk)) 290 results.append(res) 291 292 upserted_count = 0 293 for res in results: 294 upserted_count += res.upserted_count 295 296 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.
298 @validate_and_convert_errors 299 def delete( 300 self, 301 ids: Optional[List[str]] = None, 302 delete_all: Optional[bool] = None, 303 namespace: Optional[str] = None, 304 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 305 **kwargs, 306 ) -> Dict[str, Any]: 307 """ 308 The Delete operation deletes vectors from the index, from a single namespace. 309 No error raised if the vector id does not exist. 310 Note: for any delete call, if namespace is not specified, the default namespace is used. 311 312 Delete can occur in the following mutual exclusive ways: 313 1. Delete by ids from a single namespace 314 2. Delete all vectors from a single namespace by setting delete_all to True 315 3. Delete all vectors from a single namespace by specifying a metadata filter 316 (note that for this option delete all must be set to False) 317 318 API reference: https://docs.pinecone.io/reference/delete_post 319 320 Examples: 321 >>> index.delete(ids=['id1', 'id2'], namespace='my_namespace') 322 >>> index.delete(delete_all=True, namespace='my_namespace') 323 >>> index.delete(filter={'key': 'value'}, namespace='my_namespace') 324 325 Args: 326 ids (List[str]): Vector ids to delete [optional] 327 delete_all (bool): This indicates that all vectors in the index namespace should be deleted.. [optional] 328 Default is False. 329 namespace (str): The namespace to delete vectors from [optional] 330 If not specified, the default namespace is used. 331 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 332 If specified, the metadata filter here will be used to select the vectors to delete. 333 This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. 334 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 335 336 Keyword Args: 337 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.DeleteRequest for more details. 338 339 340 Returns: An empty dictionary if the delete operation was successful. 341 """ 342 _check_type = kwargs.pop("_check_type", False) 343 args_dict = parse_non_empty_args( 344 [("ids", ids), ("delete_all", delete_all), ("namespace", namespace), ("filter", filter)] 345 ) 346 347 return self._vector_api.delete( 348 DeleteRequest( 349 **args_dict, 350 **{ 351 k: v 352 for k, v in kwargs.items() 353 if k not in _OPENAPI_ENDPOINT_PARAMS and v is not None 354 }, 355 _check_type=_check_type, 356 ), 357 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 358 )
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.
360 @validate_and_convert_errors 361 def fetch(self, ids: List[str], namespace: Optional[str] = None, **kwargs) -> FetchResponse: 362 """ 363 The fetch operation looks up and returns vectors, by ID, from a single namespace. 364 The returned vectors include the vector data and/or metadata. 365 366 API reference: https://docs.pinecone.io/reference/fetch 367 368 Examples: 369 >>> index.fetch(ids=['id1', 'id2'], namespace='my_namespace') 370 >>> index.fetch(ids=['id1', 'id2']) 371 372 Args: 373 ids (List[str]): The vector IDs to fetch. 374 namespace (str): The namespace to fetch vectors from. 375 If not specified, the default namespace is used. [optional] 376 Keyword Args: 377 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.FetchResponse for more details. 378 379 380 Returns: FetchResponse object which contains the list of Vector objects, and namespace name. 381 """ 382 args_dict = parse_non_empty_args([("namespace", namespace)]) 383 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.
385 @validate_and_convert_errors 386 def query( 387 self, 388 *args, 389 top_k: int, 390 vector: Optional[List[float]] = None, 391 id: Optional[str] = None, 392 namespace: Optional[str] = None, 393 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 394 include_values: Optional[bool] = None, 395 include_metadata: Optional[bool] = None, 396 sparse_vector: Optional[ 397 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 398 ] = None, 399 **kwargs, 400 ) -> Union[QueryResponse, ApplyResult]: 401 """ 402 The Query operation searches a namespace, using a query vector. 403 It retrieves the ids of the most similar items in a namespace, along with their similarity scores. 404 405 API reference: https://docs.pinecone.io/reference/query 406 407 Examples: 408 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace') 409 >>> index.query(id='id1', top_k=10, namespace='my_namespace') 410 >>> index.query(vector=[1, 2, 3], top_k=10, namespace='my_namespace', filter={'key': 'value'}) 411 >>> index.query(id='id1', top_k=10, namespace='my_namespace', include_metadata=True, include_values=True) 412 >>> index.query(vector=[1, 2, 3], sparse_vector={'indices': [1, 2], 'values': [0.2, 0.4]}, 413 >>> top_k=10, namespace='my_namespace') 414 >>> index.query(vector=[1, 2, 3], sparse_vector=SparseValues([1, 2], [0.2, 0.4]), 415 >>> top_k=10, namespace='my_namespace') 416 417 Args: 418 vector (List[float]): The query vector. This should be the same length as the dimension of the index 419 being queried. Each `query()` request can contain only one of the parameters 420 `id` or `vector`.. [optional] 421 id (str): The unique ID of the vector to be used as a query vector. 422 Each `query()` request can contain only one of the parameters 423 `vector` or `id`. [optional] 424 top_k (int): The number of results to return for each query. Must be an integer greater than 1. 425 namespace (str): The namespace to fetch vectors from. 426 If not specified, the default namespace is used. [optional] 427 filter (Dict[str, Union[str, float, int, bool, List, dict]): 428 The filter to apply. You can use vector metadata to limit your search. 429 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 430 include_values (bool): Indicates whether vector values are included in the response. 431 If omitted the server will use the default value of False [optional] 432 include_metadata (bool): Indicates whether metadata is included in the response as well as the ids. 433 If omitted the server will use the default value of False [optional] 434 sparse_vector: (Union[SparseValues, Dict[str, Union[List[float], List[int]]]]): sparse values of the query vector. 435 Expected to be either a SparseValues object or a dict of the form: 436 {'indices': List[int], 'values': List[float]}, where the lists each have the same length. 437 438 Returns: QueryResponse object which contains the list of the closest vectors as ScoredVector objects, 439 and namespace name. 440 """ 441 442 response = self._query( 443 *args, 444 top_k=top_k, 445 vector=vector, 446 id=id, 447 namespace=namespace, 448 filter=filter, 449 include_values=include_values, 450 include_metadata=include_metadata, 451 sparse_vector=sparse_vector, 452 **kwargs, 453 ) 454 455 if kwargs.get("async_req", False) or kwargs.get("async_threadpool_executor", False): 456 return response 457 else: 458 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.
510 @validate_and_convert_errors 511 def query_namespaces( 512 self, 513 vector: List[float], 514 namespaces: List[str], 515 top_k: Optional[int] = None, 516 filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, 517 include_values: Optional[bool] = None, 518 include_metadata: Optional[bool] = None, 519 sparse_vector: Optional[ 520 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 521 ] = None, 522 **kwargs, 523 ) -> QueryNamespacesResults: 524 """The query_namespaces() method is used to make a query to multiple namespaces in parallel and combine the results into one result set. 525 526 Since several asynchronous calls are made on your behalf when calling this method, you will need to tune the pool_threads and connection_pool_maxsize parameter of the Index constructor to suite your workload. 527 528 Examples: 529 530 ```python 531 from pinecone import Pinecone 532 533 pc = Pinecone(api_key="your-api-key") 534 index = pc.Index( 535 host="index-name", 536 pool_threads=32, 537 connection_pool_maxsize=32 538 ) 539 540 query_vec = [0.1, 0.2, 0.3] # An embedding that matches the index dimension 541 combined_results = index.query_namespaces( 542 vector=query_vec, 543 namespaces=['ns1', 'ns2', 'ns3', 'ns4'], 544 top_k=10, 545 filter={'genre': {"$eq": "drama"}}, 546 include_values=True, 547 include_metadata=True 548 ) 549 for vec in combined_results.matches: 550 print(vec.id, vec.score) 551 print(combined_results.usage) 552 ``` 553 554 Args: 555 vector (List[float]): The query vector, must be the same length as the dimension of the index being queried. 556 namespaces (List[str]): The list of namespaces to query. 557 top_k (Optional[int], optional): The number of results you would like to request from each namespace. Defaults to 10. 558 filter (Optional[Dict[str, Union[str, float, int, bool, List, dict]]], optional): Pass an optional filter to filter results based on metadata. Defaults to None. 559 include_values (Optional[bool], optional): Boolean field indicating whether vector values should be included with results. Defaults to None. 560 include_metadata (Optional[bool], optional): Boolean field indicating whether vector metadata should be included with results. Defaults to None. 561 sparse_vector (Optional[ Union[SparseValues, Dict[str, Union[List[float], List[int]]]] ], optional): If you are working with a dotproduct index, you can pass a sparse vector as part of your hybrid search. Defaults to None. 562 563 Returns: 564 QueryNamespacesResults: A QueryNamespacesResults object containing the combined results from all namespaces, as well as the combined usage cost in read units. 565 """ 566 if namespaces is None or len(namespaces) == 0: 567 raise ValueError("At least one namespace must be specified") 568 if len(vector) == 0: 569 raise ValueError("Query vector must not be empty") 570 571 overall_topk = top_k if top_k is not None else 10 572 aggregator = QueryResultsAggregator(top_k=overall_topk) 573 574 target_namespaces = set(namespaces) # dedup namespaces 575 async_futures = [ 576 self.query( 577 vector=vector, 578 namespace=ns, 579 top_k=overall_topk, 580 filter=filter, 581 include_values=include_values, 582 include_metadata=include_metadata, 583 sparse_vector=sparse_vector, 584 async_threadpool_executor=True, 585 _preload_content=False, 586 **kwargs, 587 ) 588 for ns in target_namespaces 589 ] 590 591 for result in as_completed(async_futures): 592 raw_result = result.result() 593 response = json.loads(raw_result.data.decode("utf-8")) 594 aggregator.add_results(response) 595 596 final_results = aggregator.get_results() 597 return final_results
The query_namespaces() method is used to make a query to multiple namespaces in parallel and combine the results into one result set.
Since several asynchronous calls are made on your behalf when calling this method, you will need to tune the pool_threads and connection_pool_maxsize parameter of the Index constructor to suite your workload.
Examples:
from pinecone import Pinecone
pc = Pinecone(api_key="your-api-key")
index = pc.Index(
host="index-name",
pool_threads=32,
connection_pool_maxsize=32
)
query_vec = [0.1, 0.2, 0.3] # An embedding that matches the index dimension
combined_results = index.query_namespaces(
vector=query_vec,
namespaces=['ns1', 'ns2', 'ns3', 'ns4'],
top_k=10,
filter={'genre': {"$eq": "drama"}},
include_values=True,
include_metadata=True
)
for vec in combined_results.matches:
print(vec.id, vec.score)
print(combined_results.usage)
Arguments:
- vector (List[float]): The query vector, must be the same length as the dimension of the index being queried.
- namespaces (List[str]): The list of namespaces to query.
- top_k (Optional[int], optional): The number of results you would like to request from each namespace. Defaults to 10.
- filter (Optional[Dict[str, Union[str, float, int, bool, List, dict]]], optional): Pass an optional filter to filter results based on metadata. Defaults to None.
- include_values (Optional[bool], optional): Boolean field indicating whether vector values should be included with results. Defaults to None.
- include_metadata (Optional[bool], optional): Boolean field indicating whether vector metadata should be included with results. Defaults to None.
- sparse_vector (Optional[ Union[SparseValues, Dict[str, Union[List[float], List[int]]]] ], optional): If you are working with a dotproduct index, you can pass a sparse vector as part of your hybrid search. Defaults to None.
Returns:
QueryNamespacesResults: A QueryNamespacesResults object containing the combined results from all namespaces, as well as the combined usage cost in read units.
599 @validate_and_convert_errors 600 def update( 601 self, 602 id: str, 603 values: Optional[List[float]] = None, 604 set_metadata: Optional[ 605 Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]] 606 ] = None, 607 namespace: Optional[str] = None, 608 sparse_values: Optional[ 609 Union[SparseValues, Dict[str, Union[List[float], List[int]]]] 610 ] = None, 611 **kwargs, 612 ) -> Dict[str, Any]: 613 """ 614 The Update operation updates vector in a namespace. 615 If a value is included, it will overwrite the previous value. 616 If a set_metadata is included, 617 the values of the fields specified in it will be added or overwrite the previous value. 618 619 API reference: https://docs.pinecone.io/reference/update 620 621 Examples: 622 >>> index.update(id='id1', values=[1, 2, 3], namespace='my_namespace') 623 >>> index.update(id='id1', set_metadata={'key': 'value'}, namespace='my_namespace') 624 >>> index.update(id='id1', values=[1, 2, 3], sparse_values={'indices': [1, 2], 'values': [0.2, 0.4]}, 625 >>> namespace='my_namespace') 626 >>> index.update(id='id1', values=[1, 2, 3], sparse_values=SparseValues(indices=[1, 2], values=[0.2, 0.4]), 627 >>> namespace='my_namespace') 628 629 Args: 630 id (str): Vector's unique id. 631 values (List[float]): vector values to set. [optional] 632 set_metadata (Dict[str, Union[str, float, int, bool, List[int], List[float], List[str]]]]): 633 metadata to set for vector. [optional] 634 namespace (str): Namespace name where to update the vector.. [optional] 635 sparse_values: (Dict[str, Union[List[float], List[int]]]): sparse values to update for the vector. 636 Expected to be either a SparseValues object or a dict of the form: 637 {'indices': List[int], 'values': List[float]} where the lists each have the same length. 638 639 Keyword Args: 640 Supports OpenAPI client keyword arguments. See pinecone.core.client.models.UpdateRequest for more details. 641 642 Returns: An empty dictionary if the update was successful. 643 """ 644 _check_type = kwargs.pop("_check_type", False) 645 sparse_values = self._parse_sparse_values_arg(sparse_values) 646 args_dict = parse_non_empty_args( 647 [ 648 ("values", values), 649 ("set_metadata", set_metadata), 650 ("namespace", namespace), 651 ("sparse_values", sparse_values), 652 ] 653 ) 654 return self._vector_api.update( 655 UpdateRequest( 656 id=id, 657 **args_dict, 658 _check_type=_check_type, 659 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 660 ), 661 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 662 )
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.
664 @validate_and_convert_errors 665 def describe_index_stats( 666 self, filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, **kwargs 667 ) -> DescribeIndexStatsResponse: 668 """ 669 The DescribeIndexStats operation returns statistics about the index's contents. 670 For example: The vector count per namespace and the number of dimensions. 671 672 API reference: https://docs.pinecone.io/reference/describe_index_stats_post 673 674 Examples: 675 >>> index.describe_index_stats() 676 >>> index.describe_index_stats(filter={'key': 'value'}) 677 678 Args: 679 filter (Dict[str, Union[str, float, int, bool, List, dict]]): 680 If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. 681 See https://www.pinecone.io/docs/metadata-filtering/.. [optional] 682 683 Returns: DescribeIndexStatsResponse object which contains stats about the index. 684 """ 685 _check_type = kwargs.pop("_check_type", False) 686 args_dict = parse_non_empty_args([("filter", filter)]) 687 688 return self._vector_api.describe_index_stats( 689 DescribeIndexStatsRequest( 690 **args_dict, 691 **{k: v for k, v in kwargs.items() if k not in _OPENAPI_ENDPOINT_PARAMS}, 692 _check_type=_check_type, 693 ), 694 **{k: v for k, v in kwargs.items() if k in _OPENAPI_ENDPOINT_PARAMS}, 695 )
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.
697 @validate_and_convert_errors 698 def list_paginated( 699 self, 700 prefix: Optional[str] = None, 701 limit: Optional[int] = None, 702 pagination_token: Optional[str] = None, 703 namespace: Optional[str] = None, 704 **kwargs, 705 ) -> ListResponse: 706 """ 707 The list_paginated operation finds vectors based on an id prefix within a single namespace. 708 It returns matching ids in a paginated form, with a pagination token to fetch the next page of results. 709 This id list can then be passed to fetch or delete operations, depending on your use case. 710 711 Consider using the `list` method to avoid having to handle pagination tokens manually. 712 713 Examples: 714 >>> results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace') 715 >>> [v.id for v in results.vectors] 716 ['99', '990', '991', '992', '993'] 717 >>> results.pagination.next 718 eyJza2lwX3Bhc3QiOiI5OTMiLCJwcmVmaXgiOiI5OSJ9 719 >>> next_results = index.list_paginated(prefix='99', limit=5, namespace='my_namespace', pagination_token=results.pagination.next) 720 721 Args: 722 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 723 be used with the effect of listing all ids in a namespace [optional] 724 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 725 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 726 in the response if additional results are available. [optional] 727 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 728 729 Returns: ListResponse object which contains the list of ids, the namespace name, pagination information, and usage showing the number of read_units consumed. 730 """ 731 args_dict = parse_non_empty_args( 732 [ 733 ("prefix", prefix), 734 ("limit", limit), 735 ("namespace", namespace), 736 ("pagination_token", pagination_token), 737 ] 738 ) 739 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.
741 @validate_and_convert_errors 742 def list(self, **kwargs): 743 """ 744 The list operation accepts all of the same arguments as list_paginated, and returns a generator that yields 745 a list of the matching vector ids in each page of results. It automatically handles pagination tokens on your 746 behalf. 747 748 Examples: 749 >>> for ids in index.list(prefix='99', limit=5, namespace='my_namespace'): 750 >>> print(ids) 751 ['99', '990', '991', '992', '993'] 752 ['994', '995', '996', '997', '998'] 753 ['999'] 754 755 Args: 756 prefix (Optional[str]): The id prefix to match. If unspecified, an empty string prefix will 757 be used with the effect of listing all ids in a namespace [optional] 758 limit (Optional[int]): The maximum number of ids to return. If unspecified, the server will use a default value. [optional] 759 pagination_token (Optional[str]): A token needed to fetch the next page of results. This token is returned 760 in the response if additional results are available. [optional] 761 namespace (Optional[str]): The namespace to fetch vectors from. If not specified, the default namespace is used. [optional] 762 """ 763 done = False 764 while not done: 765 results = self.list_paginated(**kwargs) 766 if len(results.vectors) > 0: 767 yield [v.id for v in results.vectors] 768 769 if results.pagination: 770 kwargs.update({"pagination_token": results.pagination.next}) 771 else: 772 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