From cb600470e0937c33cf5d5b13ff4c4354dcc73002 Mon Sep 17 00:00:00 2001
From: Dheeraj Agrawal <dheeraj.agrawal@spotdraft.com>
Date: Sat, 23 Dec 2023 18:53:19 +0530
Subject: [PATCH] Adding support more filters pinecone (#9683)

adding support for one more filter  i.e not in array for pinecone vector store.
---
 .pre-commit-config.yaml               | 1 +
 llama_index/vector_stores/pinecone.py | 5 ++++-
 llama_index/vector_stores/types.py    | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e3ae90f473..2c6e71b03f 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -64,6 +64,7 @@ repos:
       - id: codespell
         additional_dependencies: [tomli]
         exclude: llama_index/_static
+        args: ["--ignore-words-list", "nin"]
   - repo: https://github.com/srstevenson/nb-clean
     rev: 3.1.0
     hooks:
diff --git a/llama_index/vector_stores/pinecone.py b/llama_index/vector_stores/pinecone.py
index 21f783d8d1..6ffec95095 100644
--- a/llama_index/vector_stores/pinecone.py
+++ b/llama_index/vector_stores/pinecone.py
@@ -1,4 +1,5 @@
-"""Pinecone Vector store index.
+"""
+Pinecone Vector store index.
 
 An index that that is built on top of an existing vector store.
 
@@ -61,6 +62,8 @@ def _transform_pinecone_filter_operator(operator: str) -> str:
         return "$lte"
     elif operator == "in":
         return "$in"
+    elif operator == "nin":
+        return "$nin"
     else:
         raise ValueError(f"Filter operator {operator} not supported")
 
diff --git a/llama_index/vector_stores/types.py b/llama_index/vector_stores/types.py
index 3bcda78401..f931243e13 100644
--- a/llama_index/vector_stores/types.py
+++ b/llama_index/vector_stores/types.py
@@ -69,6 +69,7 @@ class FilterOperator(str, Enum):
     GTE = ">="  # greater than or equal to (int, float)
     LTE = "<="  # less than or equal to (int, float)
     IN = "in"  # In array (string or number)
+    NIN = "nin"  # Not in array (string or number)
 
 
 class FilterCondition(str, Enum):
-- 
GitLab