'Inference' object has no attribute 'rerank'

Trying to use the rerank feaure.

Requirements.txt

pinecone[grpc]>=5.0.0

both with and without the the inference plugin mentioned specifically, gives error

‘Inference’ object has no attribute ‘rerank’ on basic code:

pc = Pinecone(api_key=settings.PINECONE_API_KEY)
result = pc.inference.rerank(
model=“bge-reranker-v2-m3”,
query=query,
documents=pong,
top_k=top_k,
public_metadata_field=“metadata”,
key_field=“id”,
text_field=‘text’
)

Running pinecone on AWS

Thanks for reaching out. During the preview you need to install the inference plugin. Let me know if you have any other issues.

pip install -U pinecone
pip install -U --pre pinecone-plugin-inference==1.1.0.* # Release candidate

For more documentation see the guide for bge-reranker-v2-m3

I wish I knew how to apply that ‘–pre’ flag in requirements.txt this is a VenV generated project environment. So the --pre is ignored and I get an error trying to build:

"ERROR: Could not find a version that satisfies the requirement pinecone-plugin-inference==1.1.0.* (from versions: 0.2.0, 0.2.1, 0.3.0, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.2, 1.0.3.dev20240801211604, 1.0.3.dev20240801220806, 1.0.3, 1.1.0rc0)"

I guess I just need to be patient :slight_smile:

@jlvanhulst for now you should be able to explicitly set pinecone-plugin-inference=1.1.0rc0 in your requirements.txt

1 Like

Not sure if you got this resolved or not @jlvanhulst. But I was running into the same issue. I had to downgrade my pinecone version to 4.1.2, then specify pinecone-plugin-inference=1.1.0rc0 install. I was running into issues using the auto-installed inference plugin with pinecone > 5. I also tried specifying inference plugin version 1.1.0rc0 after installing pinecone > 5 and that did not work either.

2 Likes

Thank you so much! That did it!
I do find the documentation in several places severely lacking/contradicting

1 Like

Awesome, glad to hear it @jlvanhulst.

We’ve just released support for rerank into python sdk version 5.2.0

1 Like