मेटाडेटा फ़िल्टरिंग

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

James Chapman

Curriculum Manager, DataCamp

मेटाडेटा फ़िल्टरिंग

{
    "genre": "action",
    "year": 2020,
    "color": "blue",
    "fit": "straight",
    "price": 29.99,
    "is_jeans": true,
    "areas": ["London", "Kent", "Bath"]
}
  • मेटाडेटा strings, numbers, Booleans, और strings की lists हो सकते हैं
  • मेटाडेटा फ़िल्टरिंग: सर्च स्पेस और query latency घटाती है
1 https://docs.pinecone.io/docs/metadata-filtering
Pinecone के साथ AI Applications बनाना

मेटाडेटा फ़िल्टरिंग

index.query(
    vector=[-0.250919762305275, ...],

filter={
"genre": {"$eq": "documentary"}, "year": 2019
},
top_k=1 )
1 https://docs.pinecone.io/docs/metadata-filtering
Pinecone के साथ AI Applications बनाना

मेटाडेटा फ़िल्टर्स

 

  • $eq - के बराबर (number, string, boolean)
  • $ne - के बराबर नहीं (number, string, boolean)
  • $gt - से बड़ा (number)
  • $gte - से बड़ा या बराबर (number)
  • $lt - से छोटा (number)
  • $lte - से छोटा या बराबर (number)
  • $in - array में (string या number)
  • $nin - array में नहीं (string या number)
1 https://docs.pinecone.io/docs/metadata-filtering
Pinecone के साथ AI Applications बनाना

मेटाडेटा फ़िल्टरिंग - greater than

index.query(
    vector=[-0.250919762305275, ...],

filter={
"year": {"$gt": 2019},
},
top_k=1,
include_metadatas=True
)
{'matches': [{'id': '1', 'score': 0.0478537641,
              'values': [],
              'metadata': {'genre': 'action', 'year': 2020}}],
 'namespace': '',
 'usage': {'read_units': 5}}
Pinecone के साथ AI Applications बनाना

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

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

Preparing Video For Download...