Config must be of type pinecone.config.Config

Changes made and several apps crash. Very frustrating. This was working and now I’m getting an unnecessary error. Anyone Know what changed so I can fix this? Thank you.

prompt_template = """ 
        You are a helpful bot assigned to answer questions about.....
                
        Context: 
        {context}

        Question: 
        {question}
        """

    PROMPT = PromptTemplate(
        template=prompt_template, input_variables=["context", "question"]
    )

llm = ChatOpenAI(
        model_name="gpt-4-1106-preview", temperature=0.0, streaming=True
    )
    
    qa = RetrievalQA.from_chain_type(
    llm=llm,
    chain_type="stuff",
    chain_type_kwargs={"prompt": PROMPT},
    retriever=docsearch.as_retriever()
)
    89 configKwarg = config or kwargs.get("config")
     90 if not isinstance(configKwarg, Config):
---> 91     raise TypeError("config must be of type pinecone.config.Config")
     92 else:
     93     self.config = configKwarg

TypeError: config must be of type pinecone.config.Config

Hi @LarryStewart2022. This is an error in the __init__() method of the Pinecone class. Can you share the part of your code where you instantiate your Pinecone object? Be sure not to include the API key value if that’s present. I suspect there’s something incorrect in how you’re creating that object and that’s what the error is about.

I am having the same issue. I think documentation may be dated?:

#Initialize Pinecone client
pc = Pinecone(api_key=PINECONE_API_KEY)

Connect to Pinecone index

pc = Pinecone(api_key=PINECONE_API_KEY)
product_vectorstore = pc.Index(PRODUCT_INDEX_NAME)
time.sleep(1)

Initialize ChatOpenAI

llm = ChatOpenAI(api_key=OPENAI_API_KEY, model_name=‘gpt-3.5-turbo’)

index = ‘PRODUCT_INDEX_NAME’

Initialize the Langchain Pinecone vector store

text_field = “text” # Adjust this to your actual text field
vectorstore = Pinecone(PRODUCT_INDEX_NAME, embed.embed_query, text_field)

RetrievalQA for products

product_qa = RetrievalQA.from_chain_type(llm=llm, chain_type=“stuff”, retriever=vectorstore.as_retriever())
business_qa = RetrievalQA.from_chain_type(llm=llm, chain_type=“stuff”, retriever=business_vectorstore.as_retriever())

Having the same problem

    llm = ChatOpenAI(
        openai_api_key=OPENAI_API_KEY,
        model_name='gpt-4',
        temperature=0
    )
    embed = OpenAIEmbeddings(
        model='text-embedding-ada-002',
        openai_api_key=OPENAI_API_KEY
    )

    pinecone = Pinecone(
        api_key=PINECONE_API_KEY,
        environment=PINECONE_API_ENV
    )
    index_name = "indexname"
    index = pinecone.Index(index_name)
    vectorstore = Pinecone(index, embed, 'text') # ERROR Happens Here
File "/usr/local/lib/python3.11/site-packages/pinecone/control/pinecone.py", line 91, in __init__
    raise TypeError("config must be of type pinecone.config.Config")

Pinecone 3.0.3

Found the solution to the error?

The simple issue with your code is that first Pinecone is constructor from
pinecone library and other function is from langchain.vectorstores so just add
from langchain.vectorstores import Pinecone your before the Initialize the Langchain Pinecone vector store step and this should solve it

1 Like

I believe the issue lies with pinecone vector store init

Check out abhijit’s comment:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.