Closed shrimpnoodles closed 6 months ago
š¤
Hey there @shrimpnoodles! Good to see you again in the LangChain repo. Remember, if life gives you shrimps, make shrimp noodles. š
Based on the error message you're receiving, it seems that the PINECONE_API_KEY
environment variable is not set. This variable is used to authenticate your application with Pinecone.
In the provided code, the PINECONE_API_KEY
is fetched from the environment variables using os.environ.get("PINECONE_API_KEY", None)
. If this variable is not set, an exception is raised.
To resolve this issue, you need to ensure that the PINECONE_API_KEY
environment variable is correctly set before running your application. You can do this in one of two ways:
export
command in Unix-based systems or the set
command in Windows. Here's an example for Unix-based systems:export PINECONE_API_KEY=your_api_key
os.environ["PINECONE_API_KEY"] = "your_api_key"
. Here's how you can modify your script:import os
os.environ["PINECONE_API_KEY"] = "your_api_key"
from langchain_community.chat_models import ChatOpenAI
...
Remember to replace "your_api_key"
with your actual Pinecone API key.
Regarding the outdated documentation, I appreciate your feedback. The LangChain framework does not directly handle environment variables such as PINECONE_API_KEY
. However, it does use the Pinecone Python client, which may require such environment variables. In the provided context, the Pinecone client is initialized outside of the LangChain framework. In this example, the api_key
is passed directly to the pinecone.init()
function. This key could be retrieved from an environment variable using standard Python methods, such as os.getenv('PINECONE_API_KEY')
.
I hope this helps! If you have any other questions or need further clarification, feel free to ask.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a š if this is helpful and š if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I'm creating my Pinecone DB as documentation via Pinecone says and trying to upsert my langchain documents into Pinecone, however it is saying I haven't specified my API key which I clearly have. The index is created fine, but I'm hitting a brick wall trying to get my documents into it.
I'm using pinecone as my vector DB and help from langchain for a RAG application. The langchain documentation for Pinecone is outdated (using pinecone init which is not supported anymore) and I'm seeing other people online say they are getting this issue too (https://www.reddit.com/r/LangChain/comments/199mklo/langchain_011_is_not_working_with_pineconeclient/)
System Info
pip 23.3.2 from /opt/conda/lib/python3.10/site-packages/pip (python 3.10)
langchain==0.0.354 pinecone-client==3.0.0
Using kaggle notebook on personal mac