1 00:00:00,760 --> 00:00:06,850 In our last video, we discussed vector databases, what they are and why they are 2 00:00:06,860 --> 00:00:09,050 essential for LLM applications. 3 00:00:10,360 --> 00:00:13,510 In this lecture, we ll delve into 4 00:00:13,520 --> 00:00:18,510 Pinecone, which is one of the most popular vector databases out there. 5 00:00:19,600 --> 00:00:24,950 Pinecone is a high -performance, scalable and distributed distributed vector store 6 00:00:24,960 --> 00:00:26,770 designed for LLMs. 7 00:00:27,700 --> 00:00:31,810 To use it, you ll need an API key for authentication. 8 00:00:33,060 --> 00:00:40,550 First, head over to pinecone .io and sign up for a free account. 9 00:00:43,310 --> 00:00:49,880 Once you are logged in, navigate to the API Keys section to generate a new key. 10 00:00:51,990 --> 00:00:55,500 Enter a name for the key and generate it. 11 00:00:57,090 --> 00:01:00,500 Copy this key to your clipboard and 12 00:01:00,510 --> 00:01:07,800 create a variable in your .tnv file named pinecone -api -key with the value of the key. 13 00:01:11,470 --> 00:01:19,160 In my case, I am opening the .tnv file from the project directory and appending 14 00:01:19,170 --> 00:01:29,320 the following line pinecone -api -key equals and the key between double quotes. 15 00:01:30,230 --> 00:01:31,440 I am saving the file. 16 00:01:32,110 --> 00:01:34,340 Remember, it s crucial to keep all your 17 00:01:34,350 --> 00:01:35,220 keys secure. 18 00:01:35,870 --> 00:01:38,920 After recording this video, I ll delete 19 00:01:38,930 --> 00:01:43,580 this key just as I ll do for any other keys used in this project. 20 00:01:45,790 --> 00:01:51,940 Next, I ll load the keys from the .tnv file as environment variables using 21 00:01:51,950 --> 00:01:52,900 python .tnv. 22 00:01:57,060 --> 00:01:59,610 Make sure that you have installed the 23 00:01:59,620 --> 00:02:05,350 pinecone -client library, if not, run pip install -q pinecone -client. 24 00:02:10,840 --> 00:02:18,550 To upgrade the library to its latest version, run pip install -upgrade -q 25 00:02:18,560 --> 00:02:29,250 pinecone -client and to display the version of the installed library, run pip 26 00:02:29,260 --> 00:02:30,830 show pinecone -client. 27 00:02:39,480 --> 00:02:42,870 With the new client, import the pinecone class. 28 00:02:45,300 --> 00:02:50,630 It is written with a capital P. 29 00:02:52,440 --> 00:02:55,770 Next, I will instantiate an object of the 30 00:02:55,780 --> 00:03:00,330 pinecone class, pc equals and I am calling the constructor. 31 00:03:02,590 --> 00:03:08,400 This constructor expects an environment variable called pinecone -api -key. 32 00:03:08,890 --> 00:03:14,920 If you ve already created and loaded such a variable into memory as we did, the 33 00:03:14,930 --> 00:03:17,620 authentication is automatically handled. 34 00:03:18,650 --> 00:03:21,480 However, if you haven t loaded the 35 00:03:21,490 --> 00:03:27,000 environment variable, you should explicitly pass an argument named api 36 00:03:27,010 --> 00:03:30,580 -key with your keys value to the pinecone constructor. 37 00:03:32,250 --> 00:03:39,960 Like this, api -key equals and your api -key. 38 00:03:43,950 --> 00:03:49,080 After creating the pinecone instance, you can check if it is successfully connected 39 00:03:49,090 --> 00:03:54,200 by attempting to perform an operation that requires authentication. 40 00:03:55,150 --> 00:04:00,320 For instance, you can create an index or list all existing indexes. 41 00:04:01,250 --> 00:04:06,440 If the operation completes without errors, your authentication is working. 42 00:04:14,540 --> 00:04:25,200 It completed without errors, so the authentication is working.