|
57 | 57 | "source": [
|
58 | 58 | "import pinecone # pip install pinecone-client\n",
|
59 | 59 | "\n",
|
60 |
| - "API_KEY = \"YOUR_API_KEY\" # get api key app.pinecone.io\n", |
| 60 | + "index_name = \"negative-mining\"\n", |
61 | 61 | "\n",
|
62 | 62 | "pinecone.init(\n",
|
63 |
| - " api_key=API_KEY,\n", |
| 63 | + " api_key=\"YOUR_API_KEY\", # app.pinecone.io\n", |
64 | 64 | " environment=\"YOUR_ENV\" # find next to API key in console\n",
|
65 | 65 | ")\n",
|
66 | 66 | "# create a new negative mining index if does not already exist\n",
|
67 |
| - "if 'negative-mine' not in pinecone.list_indexes():\n", |
| 67 | + "if index_name not in pinecone.list_indexes():\n", |
68 | 68 | " pinecone.create_index(\n",
|
69 |
| - " 'negative-mine',\n", |
| 69 | + " index_name,\n", |
70 | 70 | " dimension=model.get_sentence_embedding_dimension(),\n",
|
71 | 71 | " metric='dotproduct',\n",
|
72 | 72 | " pods=1\n",
|
73 | 73 | " )\n",
|
74 | 74 | "# connect\n",
|
75 |
| - "index = pinecone.Index('negative-mine')" |
| 75 | + "index = pinecone.Index(index_name)" |
76 | 76 | ]
|
77 | 77 | },
|
78 | 78 | {
|
| 79 | + "attachments": {}, |
79 | 80 | "cell_type": "markdown",
|
80 | 81 | "metadata": {},
|
81 | 82 | "source": [
|
82 |
| - "Now we encode the passages and store in the `negative-mine` index." |
| 83 | + "Now we encode the passages and store in the `negative-mining` index." |
83 | 84 | ]
|
84 | 85 | },
|
85 | 86 | {
|
|
227 | 228 | "metadata": {},
|
228 | 229 | "outputs": [],
|
229 | 230 | "source": [
|
230 |
| - "pinecone.delete_index('negative-mine') # delete the index when done to avoid higher charges (if using multiple pods)" |
| 231 | + "pinecone.delete_index(index_name) # delete the index when done to avoid higher charges (if using multiple pods)" |
231 | 232 | ]
|
232 | 233 | },
|
233 | 234 | {
|
|
260 | 261 | "name": "python",
|
261 | 262 | "nbconvert_exporter": "python",
|
262 | 263 | "pygments_lexer": "ipython3",
|
263 |
| - "version": "3.10.7 (main, Sep 14 2022, 22:38:23) [Clang 14.0.0 (clang-1400.0.29.102)]" |
| 264 | + "version": "3.10.9" |
264 | 265 | },
|
265 | 266 | "vscode": {
|
266 | 267 | "interpreter": {
|
|
0 commit comments