使用 Pinecone 构建 AI 应用
James Chapman
Curriculum Manager, DataCamp
{
"genre": "action",
"year": 2020,
"color": "blue",
"fit": "straight",
"price": 29.99,
"is_jeans": true,
"areas": ["London", "Kent", "Bath"]
}
index.query( vector=[-0.250919762305275, ...],filter={"genre": {"$eq": "documentary"}, "year": 2019},top_k=1 )
$eq - 等于(数字、字符串、布尔)$ne - 不等于(数字、字符串、布尔)$gt - 大于(数字)$gte - 大于等于(数字)$lt - 小于(数字)$lte - 小于等于(数字)$in - 在数组中(字符串或数字)$nin - 不在数组中(字符串或数字)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 应用