|
73 | 73 | }, |
74 | 74 | { |
75 | 75 | "cell_type": "code", |
76 | | - "execution_count": null, |
| 76 | + "execution_count": 1, |
77 | 77 | "metadata": { |
78 | 78 | "id": "v6g7eVRZAcFA" |
79 | 79 | }, |
80 | 80 | "outputs": [], |
81 | 81 | "source": [ |
82 | 82 | "# 📦 Install required Python packages\n", |
83 | | - "!pip install -q \"redisvl>=0.8.0\" sentence-transformers openai tiktoken python-dotenv redis" |
| 83 | + "!pip install -q \"redisvl>=0.8.0\" sentence-transformers openai tiktoken python-dotenv redis google pandas" |
84 | 84 | ] |
85 | 85 | }, |
86 | 86 | { |
87 | 87 | "cell_type": "code", |
88 | | - "execution_count": null, |
| 88 | + "execution_count": 2, |
89 | 89 | "metadata": { |
90 | 90 | "id": "m04KxSuhBiOx" |
91 | 91 | }, |
92 | | - "outputs": [], |
| 92 | + "outputs": [ |
| 93 | + { |
| 94 | + "ename": "SyntaxError", |
| 95 | + "evalue": "invalid syntax (2741142086.py, line 3)", |
| 96 | + "output_type": "error", |
| 97 | + "traceback": [ |
| 98 | + " \u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[2]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[31m \u001b[39m\u001b[31mcurl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg\u001b[39m\n ^\n\u001b[31mSyntaxError\u001b[39m\u001b[31m:\u001b[39m invalid syntax\n" |
| 99 | + ] |
| 100 | + } |
| 101 | + ], |
93 | 102 | "source": [ |
94 | 103 | "# NBVAL_SKIP\n", |
95 | 104 | "%%sh\n", |
|
115 | 124 | }, |
116 | 125 | { |
117 | 126 | "cell_type": "code", |
118 | | - "execution_count": null, |
| 127 | + "execution_count": 3, |
119 | 128 | "metadata": { |
120 | 129 | "colab": { |
121 | 130 | "base_uri": "https://localhost:8080/" |
|
125 | 134 | }, |
126 | 135 | "outputs": [ |
127 | 136 | { |
128 | | - "data": { |
129 | | - "text/plain": [ |
130 | | - "True" |
131 | | - ] |
132 | | - }, |
133 | | - "execution_count": 3, |
134 | | - "metadata": {}, |
135 | | - "output_type": "execute_result" |
| 137 | + "ename": "ConnectionError", |
| 138 | + "evalue": "Error 10061 connecting to localhost:6379. No connection could be made because the target machine actively refused it.", |
| 139 | + "output_type": "error", |
| 140 | + "traceback": [ |
| 141 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 142 | + "\u001b[31mConnectionRefusedError\u001b[39m Traceback (most recent call last)", |
| 143 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:389\u001b[39m, in \u001b[36mAbstractConnection.connect_check_health\u001b[39m\u001b[34m(self, check_health, retry_socket_connect)\u001b[39m\n\u001b[32m 388\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m retry_socket_connect:\n\u001b[32m--> \u001b[39m\u001b[32m389\u001b[39m sock = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mretry\u001b[49m\u001b[43m.\u001b[49m\u001b[43mcall_with_retry\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 390\u001b[39m \u001b[43m \u001b[49m\u001b[38;5;28;43;01mlambda\u001b[39;49;00m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mlambda\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mdisconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43merror\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 391\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 392\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n", |
| 144 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\retry.py:105\u001b[39m, in \u001b[36mRetry.call_with_retry\u001b[39m\u001b[34m(self, do, fail)\u001b[39m\n\u001b[32m 104\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m105\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdo\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 106\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;28mself\u001b[39m._supported_errors \u001b[38;5;28;01mas\u001b[39;00m error:\n", |
| 145 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:390\u001b[39m, in \u001b[36mAbstractConnection.connect_check_health.<locals>.<lambda>\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m 388\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m retry_socket_connect:\n\u001b[32m 389\u001b[39m sock = \u001b[38;5;28mself\u001b[39m.retry.call_with_retry(\n\u001b[32m--> \u001b[39m\u001b[32m390\u001b[39m \u001b[38;5;28;01mlambda\u001b[39;00m: \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_connect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m, \u001b[38;5;28;01mlambda\u001b[39;00m error: \u001b[38;5;28mself\u001b[39m.disconnect(error)\n\u001b[32m 391\u001b[39m )\n\u001b[32m 392\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n", |
| 146 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:803\u001b[39m, in \u001b[36mConnection._connect\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 802\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m err \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m803\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m err\n\u001b[32m 804\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m(\u001b[33m\"\u001b[39m\u001b[33msocket.getaddrinfo returned an empty list\u001b[39m\u001b[33m\"\u001b[39m)\n", |
| 147 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:787\u001b[39m, in \u001b[36mConnection._connect\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 786\u001b[39m \u001b[38;5;66;03m# connect\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m787\u001b[39m \u001b[43msock\u001b[49m\u001b[43m.\u001b[49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43msocket_address\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 789\u001b[39m \u001b[38;5;66;03m# set the socket_timeout now that we're connected\u001b[39;00m\n", |
| 148 | + "\u001b[31mConnectionRefusedError\u001b[39m: [WinError 10061] No connection could be made because the target machine actively refused it", |
| 149 | + "\nDuring handling of the above exception, another exception occurred:\n", |
| 150 | + "\u001b[31mConnectionError\u001b[39m Traceback (most recent call last)", |
| 151 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[3]\u001b[39m\u001b[32m, line 17\u001b[39m\n\u001b[32m 10\u001b[39m redis_client = redis.Redis(\n\u001b[32m 11\u001b[39m host=REDIS_HOST,\n\u001b[32m 12\u001b[39m port=REDIS_PORT,\n\u001b[32m 13\u001b[39m password=REDIS_PASSWORD\n\u001b[32m 14\u001b[39m )\n\u001b[32m 16\u001b[39m \u001b[38;5;66;03m# Test connection\u001b[39;00m\n\u001b[32m---> \u001b[39m\u001b[32m17\u001b[39m \u001b[43mredis_client\u001b[49m\u001b[43m.\u001b[49m\u001b[43mping\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", |
| 152 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\commands\\core.py:1219\u001b[39m, in \u001b[36mManagementCommands.ping\u001b[39m\u001b[34m(self, **kwargs)\u001b[39m\n\u001b[32m 1213\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mping\u001b[39m(\u001b[38;5;28mself\u001b[39m, **kwargs) -> ResponseT:\n\u001b[32m 1214\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 1215\u001b[39m \u001b[33;03m Ping the Redis server\u001b[39;00m\n\u001b[32m 1216\u001b[39m \n\u001b[32m 1217\u001b[39m \u001b[33;03m For more information see https://redis.io/commands/ping\u001b[39;00m\n\u001b[32m 1218\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1219\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mexecute_command\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mPING\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", |
| 153 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\client.py:621\u001b[39m, in \u001b[36mRedis.execute_command\u001b[39m\u001b[34m(self, *args, **options)\u001b[39m\n\u001b[32m 620\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mexecute_command\u001b[39m(\u001b[38;5;28mself\u001b[39m, *args, **options):\n\u001b[32m--> \u001b[39m\u001b[32m621\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_execute_command\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43moptions\u001b[49m\u001b[43m)\u001b[49m\n", |
| 154 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\client.py:627\u001b[39m, in \u001b[36mRedis._execute_command\u001b[39m\u001b[34m(self, *args, **options)\u001b[39m\n\u001b[32m 625\u001b[39m pool = \u001b[38;5;28mself\u001b[39m.connection_pool\n\u001b[32m 626\u001b[39m command_name = args[\u001b[32m0\u001b[39m]\n\u001b[32m--> \u001b[39m\u001b[32m627\u001b[39m conn = \u001b[38;5;28mself\u001b[39m.connection \u001b[38;5;129;01mor\u001b[39;00m \u001b[43mpool\u001b[49m\u001b[43m.\u001b[49m\u001b[43mget_connection\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 629\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m._single_connection_client:\n\u001b[32m 630\u001b[39m \u001b[38;5;28mself\u001b[39m.single_connection_lock.acquire()\n", |
| 155 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\utils.py:195\u001b[39m, in \u001b[36mdeprecated_args.<locals>.decorator.<locals>.wrapper\u001b[39m\u001b[34m(*args, **kwargs)\u001b[39m\n\u001b[32m 190\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m arg \u001b[38;5;129;01min\u001b[39;00m provided_args:\n\u001b[32m 191\u001b[39m warn_deprecated_arg_usage(\n\u001b[32m 192\u001b[39m arg, func.\u001b[34m__name__\u001b[39m, reason, version, stacklevel=\u001b[32m3\u001b[39m\n\u001b[32m 193\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m195\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", |
| 156 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:1533\u001b[39m, in \u001b[36mConnectionPool.get_connection\u001b[39m\u001b[34m(self, command_name, *keys, **options)\u001b[39m\n\u001b[32m 1529\u001b[39m \u001b[38;5;28mself\u001b[39m._in_use_connections.add(connection)\n\u001b[32m 1531\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 1532\u001b[39m \u001b[38;5;66;03m# ensure this connection is connected to Redis\u001b[39;00m\n\u001b[32m-> \u001b[39m\u001b[32m1533\u001b[39m \u001b[43mconnection\u001b[49m\u001b[43m.\u001b[49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1534\u001b[39m \u001b[38;5;66;03m# connections that the pool provides should be ready to send\u001b[39;00m\n\u001b[32m 1535\u001b[39m \u001b[38;5;66;03m# a command. if not, the connection was either returned to the\u001b[39;00m\n\u001b[32m 1536\u001b[39m \u001b[38;5;66;03m# pool before all data has been read or the socket has been\u001b[39;00m\n\u001b[32m 1537\u001b[39m \u001b[38;5;66;03m# closed. either way, reconnect and verify everything is good.\u001b[39;00m\n\u001b[32m 1538\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n", |
| 157 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:380\u001b[39m, in \u001b[36mAbstractConnection.connect\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 378\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mconnect\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m 379\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mConnects to the Redis server if not already connected\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m--> \u001b[39m\u001b[32m380\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mconnect_check_health\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcheck_health\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n", |
| 158 | + "\u001b[36mFile \u001b[39m\u001b[32mc:\\Users\\PhilipLaussermair\\Desktop\\Code\\Internal\\sc recipe\\redis-ai-resources\\.venv\\Lib\\site-packages\\redis\\connection.py:397\u001b[39m, in \u001b[36mAbstractConnection.connect_check_health\u001b[39m\u001b[34m(self, check_health, retry_socket_connect)\u001b[39m\n\u001b[32m 395\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTimeoutError\u001b[39;00m(\u001b[33m\"\u001b[39m\u001b[33mTimeout connecting to server\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 396\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[32m--> \u001b[39m\u001b[32m397\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(\u001b[38;5;28mself\u001b[39m._error_message(e))\n\u001b[32m 399\u001b[39m \u001b[38;5;28mself\u001b[39m._sock = sock\n\u001b[32m 400\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n", |
| 159 | + "\u001b[31mConnectionError\u001b[39m: Error 10061 connecting to localhost:6379. No connection could be made because the target machine actively refused it." |
| 160 | + ] |
136 | 161 | } |
137 | 162 | ], |
138 | 163 | "source": [ |
|
161 | 186 | "metadata": { |
162 | 187 | "id": "ZnqjGneBDFol" |
163 | 188 | }, |
164 | | - "outputs": [], |
| 189 | + "outputs": [ |
| 190 | + { |
| 191 | + "ename": "ModuleNotFoundError", |
| 192 | + "evalue": "No module named 'google'", |
| 193 | + "output_type": "error", |
| 194 | + "traceback": [ |
| 195 | + "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
| 196 | + "\u001b[31mModuleNotFoundError\u001b[39m Traceback (most recent call last)", |
| 197 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[4]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mos\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mgoogle\u001b[39;00m\u001b[34;01m.\u001b[39;00m\u001b[34;01mcolab\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m user_secret\n\u001b[32m 4\u001b[39m \u001b[38;5;66;03m# 🔐 Ask user whether to use Azure OpenAI or OpenAI\u001b[39;00m\n\u001b[32m 5\u001b[39m use_azure = \u001b[38;5;28minput\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33mUse Azure OpenAI? (y/n): \u001b[39m\u001b[33m\"\u001b[39m).strip().lower() == \u001b[33m\"\u001b[39m\u001b[33my\u001b[39m\u001b[33m\"\u001b[39m\n", |
| 198 | + "\u001b[31mModuleNotFoundError\u001b[39m: No module named 'google'" |
| 199 | + ] |
| 200 | + } |
| 201 | + ], |
165 | 202 | "source": [ |
166 | 203 | "import os\n", |
167 | | - "from google.colab import user_secret\n", |
| 204 | + "from google.colab import userdata\n", |
168 | 205 | "\n", |
169 | 206 | "# 🔐 Ask user whether to use Azure OpenAI or OpenAI\n", |
170 | 207 | "use_azure = input(\"Use Azure OpenAI? (y/n): \").strip().lower() == \"y\"\n", |
|
177 | 214 | " print(\"- AZURE_OPENAI_API_VERSION (e.g. 2024-05-01-preview)\")\n", |
178 | 215 | " print(\"💡 Make sure 'gpt-4o' and 'gpt-4o-mini' models are deployed in your Azure Foundry.\\n\")\n", |
179 | 216 | "\n", |
180 | | - " os.environ[\"AZURE_OPENAI_API_KEY\"] = user_secret.get_secret(\"AZURE_OPENAI_API_KEY\")\n", |
181 | | - " os.environ[\"AZURE_OPENAI_ENDPOINT\"] = user_secret.get_secret(\"AZURE_OPENAI_ENDPOINT\")\n", |
182 | | - " os.environ[\"AZURE_OPENAI_API_VERSION\"] = user_secret.get_secret(\"AZURE_OPENAI_API_VERSION\")\n", |
| 217 | + " os.environ[\"AZURE_OPENAI_API_KEY\"] = userdata.get(\"AZURE_OPENAI_API_KEY\")\n", |
| 218 | + " os.environ[\"AZURE_OPENAI_ENDPOINT\"] = userdata.get(\"AZURE_OPENAI_ENDPOINT\")\n", |
| 219 | + " os.environ[\"AZURE_OPENAI_API_VERSION\"] = userdata.get(\"AZURE_OPENAI_API_VERSION\")\n", |
183 | 220 | "\n", |
184 | 221 | " # Optional model deployment names\n", |
185 | 222 | " os.environ.setdefault(\"AZURE_OPENAI_GPT4_MODEL\", \"gpt-4o\")\n", |
|
190 | 227 | " print(\"📌 Please ensure the following secret is added via the 🔐 Colab > Secrets menu:\")\n", |
191 | 228 | " print(\"- OPENAI_API_KEY\\n\")\n", |
192 | 229 | "\n", |
193 | | - " os.environ[\"OPENAI_API_KEY\"] = user_secret.get_secret(\"OPENAI_API_KEY\")\n", |
| 230 | + " os.environ[\"OPENAI_API_KEY\"] = userdata.get(\"OPENAI_API_KEY\")\n", |
194 | 231 | "\n", |
195 | 232 | " # Optional model names (if using gpt-4o via OpenAI)\n", |
196 | 233 | " os.environ.setdefault(\"OPENAI_GPT4_MODEL\", \"gpt-4o\")\n", |
|
1500 | 1537 | "provenance": [] |
1501 | 1538 | }, |
1502 | 1539 | "kernelspec": { |
1503 | | - "display_name": "Python 3", |
| 1540 | + "display_name": ".venv", |
| 1541 | + "language": "python", |
1504 | 1542 | "name": "python3" |
1505 | 1543 | }, |
1506 | 1544 | "language_info": { |
1507 | | - "name": "python" |
| 1545 | + "codemirror_mode": { |
| 1546 | + "name": "ipython", |
| 1547 | + "version": 3 |
| 1548 | + }, |
| 1549 | + "file_extension": ".py", |
| 1550 | + "mimetype": "text/x-python", |
| 1551 | + "name": "python", |
| 1552 | + "nbconvert_exporter": "python", |
| 1553 | + "pygments_lexer": "ipython3", |
| 1554 | + "version": "3.11.9" |
1508 | 1555 | } |
1509 | 1556 | }, |
1510 | 1557 | "nbformat": 4, |
|
0 commit comments