वेक्टर अपडेट और डिलीट करना

Pinecone के साथ AI Applications बनाना

James Chapman

Curriculum Manager, DataCamp

चीजों को फ्रेश रखें...

  • डेटा को करेंट रखें
  • क्वेरी परफॉर्मेंस ऑप्टिमाइज़ करें
  • डेटा इंटीग्रिटी बनाए रखें

डेटा का जीवनचक्र: कैप्चर से उपयोग, वैलिडेशन, और अपडेट/रिमूवल तक.

Pinecone के साथ AI Applications बनाना

वेक्टर वैल्यू अपडेट करना

index.fetch(ids=['1'])
{'namespace': '',
 'usage': {'read_units': 1},
 'vectors': {'1': {'id': '1',
                   'metadata': {"genre": "action", "year": 2023},
                   'values': [-0.0131468913, ...]}
            }
}
Pinecone के साथ AI Applications बनाना

वेक्टर वैल्यू अपडेट करना

index.update(

id="1",
values=[0.370695321, ...]
)
  • ध्यान दें: list length = index dimensionality
1 https://docs.pinecone.io/docs/update-data
Pinecone के साथ AI Applications बनाना

वेक्टर वैल्यू अपडेट करना

index.fetch(ids=['1'])
{'namespace': '',
 'usage': {'read_units': 1},
 'vectors': {'1': {'id': '1',
                   'metadata': {"genre": "action", "year": 2023},
                   'values': [0.370695321, ...]}
            }
}
Pinecone के साथ AI Applications बनाना

वेक्टर मेटाडेटा अपडेट करना

index.update(
    id="1",
    set_metadata={"genre": "comedy", "rating": 5}
)
1 https://docs.pinecone.io/docs/update-data
Pinecone के साथ AI Applications बनाना

वेक्टर मेटाडेटा अपडेट करना

index.fetch(ids=['1'])
{'namespace': '',
 'usage': {'read_units': 1},
 'vectors': {'1': {'id': '1',
                   'metadata': {"genre": "comedy", "year": 2023, "rating": 5},
                   'values': [0.370695321, ...]}
            }
}
Pinecone के साथ AI Applications बनाना

वैल्यू और मेटाडेटा साथ में अपडेट करें

index.update(
    id="1",
    values=[-0.31956, ...],
    set_metadata={"genre": "thriller", "ratings": 4}
)
1 https://docs.pinecone.io/docs/update-data
Pinecone के साथ AI Applications बनाना

वेक्टर डिलीट करना

index.delete(
    ids=["1", "2"]
)
1 https://docs.pinecone.io/docs/delete-data
Pinecone के साथ AI Applications बनाना

मेटाडेटा के आधार पर वेक्टर डिलीट करें

index.delete(
    filter={
        "genre": {"$eq": "action"},
    }
)
Pinecone के साथ AI Applications बनाना

किसी namespace के भीतर वेक्टर डिलीट करना

index.delete(delete_all=True, namespace='namespace1')
  • नोट: यह namespace भी हटा देता है!
1 https://docs.pinecone.io/docs/delete-data
Pinecone के साथ AI Applications बनाना

अभ्यास करते हैं!

Pinecone के साथ AI Applications बनाना

Preparing Video For Download...