ValueError: Index 'None' not found in your Pinecone project

192 views Asked by At

I'm trying to do example selector with Pinecone. I have the followings:

from langchain.prompts.example_selector import SemanticSimilarityExampleSelector
from langchain.vectorstores import Pinecone
import pinecone
from dotenv import load_dotenv
load_dotenv()

pinecone.init(
    api_key=os.environ["PINECONE_API_KEY"],
    environment=os.environ["PINECONE_ENVIRONMENT_REGION"],
)
index_name = os.environ["PINECONE_INDEX_NAME"]
index = pinecone.Index(index_name)
embeddings = VertexAIEmbeddings(model_name="textembedding-gecko")
text_field = "text"
vectorstore = Pinecone(index, embeddings, text_field)

example_selector = SemanticSimilarityExampleSelector.from_examples(
    examples,
    embeddings,
    vectorstore,
    k=4,
)

But it return this error:

ValueError: Index 'None' not found in your Pinecone project. Did you mean one of the following         indexes: options-adj-index

I already have "options-adj-index" as the index_name but it seems it does not get it. Any idea what's wrong? Thank you.

I have tried both just indicating the index name "options-adj-index" and pinecone.Index("options-adj-index") but still same error

0

There are 0 answers