[BUG] init is no longer a top-level attribute of the pinecone package
rodrigo-pedro opened this issue · comments
I'm getting the following error when initializing the RebuffSdk class in Python.
`Traceback (most recent call last):
File "myfile.py", line 91, in run
output = rb.detect_injection(results)
File "venv/lib/python3.10/site-packages/rebuff/sdk.py", line 86, in detect_injection
self.initialize_pinecone()
File "venv/lib/python3.10/site-packages/rebuff/sdk.py", line 42, in initialize_pinecone
self.vector_store = init_pinecone(
File "venv/lib/python3.10/site-packages/rebuff/detect_pi_vectorbase.py", line 71, in init_pinecone
pinecone.init(api_key=api_key, environment=environment)
File "venv/lib/python3.10/site-packages/pinecone/deprecation_warnings.py", line 38, in init
raise AttributeError(msg)
AttributeError: init is no longer a top-level attribute of the pinecone package.
Please create an instance of the Pinecone class instead.
Example:
import os
from pinecone import Pinecone, ServerlessSpec
pc = Pinecone(
api_key=os.environ.get("PINECONE_API_KEY")
)
# Now do stuff
if 'my_index' not in pc.list_indexes().names():
pc.create_index(
name='my_index',
dimension=1536,
metric='euclidean',
spec=ServerlessSpec(
cloud='aws',
region='us-west-2'
)
)`
Thanks for raising this issue. We need to update our usage of pinecone-client
since we upgaded to 3.0.
@mehrinkiani, I think it would make sense for you to fix this as part of #92. Or if you think it'd be faster, you could open a PR to fix just this.
Thank you @ristomcgehee. I have opened a new PR #106 to fix this.