Skip to content

Examples and guides for using the OpenAI API

add links to pinecone and add env var to index

Amnon Catav7164818de576
diff --git a/examples/How_to_build_a_tool-using_agent_with_Langchain.ipynb b/examples/How_to_build_a_tool-using_agent_with_Langchain.ipynb
index 01b86ecb..061ec796 100644
--- a/examples/How_to_build_a_tool-using_agent_with_Langchain.ipynb
+++ b/examples/How_to_build_a_tool-using_agent_with_Langchain.ipynb
@@ -54,7 +54,7 @@
"source": [
"# Setup\n",
"\n",
- "Import libraries and set up a connection to a Pinecone vector database.\n",
+ "Import libraries and set up a connection to a [Pinecone](https://www.pinecone.io) vector database.\n",
"\n",
"You can substitute Pinecone for any other vectorstore or database - there are a [selection](https://python.langchain.com/en/latest/modules/indexes/vectorstores.html) that are supported by Langchain natively, while other connectors will need to be developed yourself."
]
@@ -66,11 +66,13 @@
"metadata": {},
"outputs": [],
"source": [
+ "!pip install openai\n",
"!pip install pinecone-client\n",
"!pip install pandas\n",
"!pip install typing\n",
"!pip install tqdm\n",
- "!pip install langchain"
+ "!pip install langchain\n",
+ "!pip install wget"
]
},
{
@@ -109,6 +111,15 @@
"index_name = 'podcasts'"
]
},
+ {
+ "attachments": {},
+ "cell_type": "markdown",
+ "id": "9c85f298",
+ "metadata": {},
+ "source": [
+ "For acquiring an API key to connect with Pinecone, you can set up a [free account](https://app.pinecone.io/) and store it in the `api_key` variable below or in your environment variables under `PINECONE_API_KEY`"
+ ]
+ },
{
"cell_type": "code",
"execution_count": 4,
@@ -116,8 +127,13 @@
"metadata": {},
"outputs": [],
"source": [
- "api_key = os.getenv(\"PINECONE_API_KEY\")\n",
- "pinecone.init(api_key=api_key)"
+ "api_key = os.getenv(\"PINECONE_API_KEY\") or \"PINECONE_API_KEY\"\n",
+ "\n",
+ "# find environment next to your API key in the Pinecone console\n",
+ "env = os.getenv(\"PINECONE_ENVIRONMENT\") or \"PINECONE_ENVIRONMENT\"\n",
+ "\n",
+ "pinecone.init(api_key=api_key, environment=env)\n",
+ "pinecone.whoami()"
]
},
{