🐛 Bug Report: Pinecone query asserts wrong type for filter
Which component is this bug for?
Pinecone Instrumentation
📜 Description
Openllmetry expects the filter parameter when querying pinecone to be one of ['bool', 'str', 'bytes', 'int', 'float'], but it should be a dict.
👟 Reproduction steps
import os
import numpy as np
from pinecone import Pinecone
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import tool
Traceloop.init(
api_key=os.getenv("TRACELOOP_API_KEY"),
resource_attributes={"env": os.getenv("ENV")},
)
@tool("test-tool")
def test():
api_key = os.getenv("PINECONE_API_KEY_SERVERLESS")
pc = Pinecone(api_key=api_key)
index = pc.Index("embeddings")
namespace = "chat-user-questions"
filters = {
"feedback": {"$eq": "POSITIVE"},
}
query_vector = np.random.uniform(-1, 1, size=3072).tolist()
# Perform the query with specified parameters and filters
query_response = index.query(
top_k=10,
vector=query_vector,
namespace=namespace,
include_metadata=True,
include_values=True,
filter=filters
)
if __name__ == "__main__":
test()
The above code logs an error to the console Invalid type dict for attribute 'pinecone.query.filter' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types
👍 Expected behavior
It should take any dict for the filter object and not log an error. Ideally the filter object would also show up on the Traceloop website when inspecting the span.
👎 Actual Behavior with Screenshots
The above code logs an error to the console Invalid type dict for attribute 'pinecone.query.filter' value. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or a sequence of those types and the filter does not show up. Some of the other values also don't show actually like include metadata
🤖 Python Version
Python 3.10.13
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- [X] I checked and didn't find similar issue
Are you willing to submit PR?
None