|
3 | 3 | > Please remove `pinecone-client` from your project dependencies and add `pinecone` instead to get
|
4 | 4 | > the latest updates.
|
5 | 5 |
|
| 6 | +# Upgrading from `6.x` to `7.x` |
| 7 | + |
| 8 | +There are no intentional breaking changes when moving from v6 to v7 of the SDK. The major version bump reflects the move from calling the `2025-01` to the `2025-04` version of the underlying API. |
| 9 | + |
| 10 | +Some internals of the client have been reorganized or moved, but we've made an effort to alias everything and show warning messages when appropriate. If you experience any unexpected breaking changes that cause you friction while upgrading, let us know and we'll try to smooth it out. |
| 11 | + |
| 12 | +## Useful additions in `7.x` |
| 13 | + |
| 14 | +New Features: |
| 15 | +- Assistant: The assistant plugin is now bundled by default. |
| 16 | +- Inference API: List/view available models |
| 17 | +- Backups: |
| 18 | + - Create backup from serverless index |
| 19 | + - Create serverless index from backup |
| 20 | + - List/view backups |
| 21 | + - List/view backup restore jobs |
| 22 | +- Bring Your Own Cloud (BYOC): |
| 23 | + - Create, list, describe, and delete BYOC indexes |
| 24 | + |
| 25 | +Other improvements: |
| 26 | +- ~70% faster initial import and client instantiation time thanks to refactoring to implement lazy loading. This means your app won't waste time loading code for features you're not using. |
| 27 | +- Retries are now enabled by default for REST calls (implemented for both urllib3 and aiohttp) |
| 28 | +- A `py.typed` marker file is now included to indicate type information is present in the package. We're still working toward reaching full coverage with our type hints, but including this file allows some tools to find the inline definitions we have already implemented. |
| 29 | + |
| 30 | + |
| 31 | +### Backups for Serverless Indexes |
| 32 | + |
| 33 | +You can create backups from your serverless indexes and use these backups to create new indexes. Some fields such as `record_count` are initially empty but will be populated by the time a backup is ready for use. |
| 34 | + |
| 35 | +```python |
| 36 | +from pinecone import Pinecone |
| 37 | + |
| 38 | +pc = Pinecone() |
| 39 | + |
| 40 | +index_name = 'example-index' |
| 41 | +if not pc.has_index(name=index_name): |
| 42 | + raise Exception('An index must exist before backing it up') |
| 43 | + |
| 44 | +backup = pc.create_backup( |
| 45 | + index_name=index_name, |
| 46 | + backup_name='example-backup', |
| 47 | + description='testing out backups' |
| 48 | +) |
| 49 | +# { |
| 50 | +# "backup_id": "4698a618-7e56-4a44-93bc-fc8f1371aa36", |
| 51 | +# "source_index_name": "example-index", |
| 52 | +# "source_index_id": "ec6fd44c-ab45-4873-97f3-f6b44b67e9bc", |
| 53 | +# "status": "Initializing", |
| 54 | +# "cloud": "aws", |
| 55 | +# "region": "us-east-1", |
| 56 | +# "tags": {}, |
| 57 | +# "name": "example-backup", |
| 58 | +# "description": "testing out backups", |
| 59 | +# "dimension": null, |
| 60 | +# "record_count": null, |
| 61 | +# "namespace_count": null, |
| 62 | +# "size_bytes": null, |
| 63 | +# "created_at": "2025-05-16T18:44:28.480671533Z" |
| 64 | +# } |
| 65 | +``` |
| 66 | + |
| 67 | +Check the status of a backup |
| 68 | + |
| 69 | +```python |
| 70 | +from pinecone import Pinecone |
| 71 | + |
| 72 | +pc = Pinecone() |
| 73 | + |
| 74 | +pc.describe_backup(backup_id='4698a618-7e56-4a44-93bc-fc8f1371aa36') |
| 75 | +``` |
| 76 | + |
| 77 | +You can use `list_backups` to see all of your backups and their current status. If you have a large number of backups, results will be paginated. You can control the pagination with optional parameters for `limit` and `pagination_token`. |
| 78 | + |
| 79 | +```python |
| 80 | + |
| 81 | +from pinecone import Pinecone |
| 82 | + |
| 83 | +pc = Pinecone() |
| 84 | + |
| 85 | +# All backups |
| 86 | +pc.list_backups() |
| 87 | + |
| 88 | +# Only backups associated with a particular index |
| 89 | +pc.list_backups(index_name='my-index') |
| 90 | +``` |
| 91 | + |
| 92 | +To create an index from a backup, use `create_index_from_backup`. |
| 93 | + |
| 94 | +```python |
| 95 | +from pinecone import Pinecone |
| 96 | + |
| 97 | +pc = Pinecone() |
| 98 | + |
| 99 | +pc.create_index_from_backup( |
| 100 | + name='index-from-backup', |
| 101 | + backup_id='4698a618-7e56-4a44-93bc-fc8f1371aa36', |
| 102 | + deletion_protection = "disabled", |
| 103 | + tags={'env': 'testing'}, |
| 104 | +) |
| 105 | +``` |
| 106 | + |
| 107 | +Under the hood, a restore job is created to handle taking data from your backup and loading it into the newly created serverless index. You can check status of pending restore jobs with `pc.list_restore_jobs()` or `pc.describe_restore_job(job_id='')` |
| 108 | + |
| 109 | +### Explore and discover models in our Inference API |
| 110 | + |
| 111 | +You can now fetch a dynamic list of models supported by the Inference API. |
| 112 | + |
| 113 | +```python |
| 114 | +from pinecone import Pinecone |
| 115 | + |
| 116 | +pc = Pinecone() |
| 117 | + |
| 118 | +# List all models |
| 119 | +models = pc.inference.list_models() |
| 120 | + |
| 121 | +# List models, with model type filtering |
| 122 | +models = pc.inference.list_models(type="embed") |
| 123 | +models = pc.inference.list_models(type="rerank") |
| 124 | + |
| 125 | +# List models, with vector type filtering |
| 126 | +models = pc.inference.list_models(vector_type="dense") |
| 127 | +models = pc.inference.list_models(vector_type="sparse") |
| 128 | + |
| 129 | +# List models, with both type and vector type filtering |
| 130 | +models = pc.inference.list_models(type="rerank", vector_type="dense") |
| 131 | +``` |
| 132 | + |
| 133 | +Or, if you know the name of a model, you can get just those details |
| 134 | + |
| 135 | +``` |
| 136 | +pc.inference.get_model(model_name='pinecone-rerank-v0') |
| 137 | +# { |
| 138 | +# "model": "pinecone-rerank-v0", |
| 139 | +# "short_description": "A state of the art reranking model that out-performs competitors on widely accepted benchmarks. It can handle chunks up to 512 tokens (1-2 paragraphs)", |
| 140 | +# "type": "rerank", |
| 141 | +# "supported_parameters": [ |
| 142 | +# { |
| 143 | +# "parameter": "truncate", |
| 144 | +# "type": "one_of", |
| 145 | +# "value_type": "string", |
| 146 | +# "required": false, |
| 147 | +# "default": "END", |
| 148 | +# "allowed_values": [ |
| 149 | +# "END", |
| 150 | +# "NONE" |
| 151 | +# ] |
| 152 | +# } |
| 153 | +# ], |
| 154 | +# "modality": "text", |
| 155 | +# "max_sequence_length": 512, |
| 156 | +# "max_batch_size": 100, |
| 157 | +# "provider_name": "Pinecone", |
| 158 | +# "supported_metrics": [] |
| 159 | +# } |
| 160 | +``` |
| 161 | + |
| 162 | +### Initial client support for BYOC (Bring Your Own Cloud) |
| 163 | + |
| 164 | +For customers using our [BYOC offering](https://docs.pinecone.io/guides/production/bring-your-own-cloud), you can now create indexes and list/describe indexes you have created in your cloud. |
| 165 | + |
| 166 | +```python |
| 167 | +from pinecone import Pinecone, ByocSpec |
| 168 | + |
| 169 | +pc = Pinecone() |
| 170 | + |
| 171 | +pc.create_index( |
| 172 | + name='example-byoc-index', |
| 173 | + dimension=768, |
| 174 | + metric='cosine', |
| 175 | + spec=ByocSpec(environment='my-private-env'), |
| 176 | + tags={ |
| 177 | + 'env': 'testing' |
| 178 | + }, |
| 179 | + deletion_protection='enabled' |
| 180 | +) |
| 181 | +``` |
| 182 | + |
6 | 183 | # Upgrading from `5.x` to `6.x`
|
7 | 184 |
|
8 | 185 | ## Breaking changes in 6.x
|
|
0 commit comments