pinecone-io / pinecone-python-client

The Pinecone Python client
https://www.pinecone.io/docs
Apache License 2.0
309 stars 80 forks source link

[Feature Request] I have a request stating that I need all the metadata which I had 35k vectors upserted. #407

Open crtejavardhanreddy opened 3 weeks ago

crtejavardhanreddy commented 3 weeks ago

What motivated you to submit this feature request? Get all the metadata is a requirement in my project

Describe the solution you'd like Just GET the pinecone metadata data without any matches with the any vectors. My metadata consists of Source as a key and links as a value that I need to get the all data

Describe alternatives you've considered Checking the Pinecone docs data

Additional context

{9456A24C-9589-4948-BA9D-B51556F8EE2D}
jhamon commented 3 weeks ago

You can use fetch to get a record, including metadata, by id. Does something like this cover your use case?


from pinecone import Pinecone; 

pc = Pinecone(api_key='your-api-key')
index = pc.Index('jen2')

pc.describe_index('jen2')
# {
#     "name": "jen2",
#     "dimension": 2,
#     "metric": "cosine",
#     "host": "jen2-dojoi3u.svc.aped-4627-b74a.pinecone.io",
#     "spec": {
#         "serverless": {
#             "cloud": "aws",
#             "region": "us-east-1"
#         }
#     },
#     "status": {
#         "ready": true,
#         "state": "Ready"
#     },
#     "deletion_protection": "disabled"
# }

index.upsert(vectors=[('1', [0.2, 0.3], {"genre": "comedy", "rating": 4 })])
# {'upserted_count': 1}

index.fetch(ids=['1'])
# {'namespace': '',
#  'usage': {'read_units': 1},
#  'vectors': {'1': {'id': '1',
#                    'metadata': {'genre': 'comedy', 'rating': 4.0},
#                    'values': [0.2, 0.3]}}}