File size: 40,295 Bytes
153539a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "VZllvIwaKwKb",
"outputId": "20ad5a9b-14e2-4410-afc4-4e0df2428fc3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: langchain in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.1.20)\n",
"Requirement already satisfied: langchain_core in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.1.52)\n",
"Collecting langchain_groq\n",
" Downloading langchain_groq-0.2.4-py3-none-any.whl.metadata (3.0 kB)\n",
"Requirement already satisfied: langchain_community in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.0.38)\n",
"Collecting langgraph\n",
" Downloading langgraph-0.3.2-py3-none-any.whl.metadata (17 kB)\n",
"Requirement already satisfied: PyYAML>=5.3 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (6.0.1)\n",
"Requirement already satisfied: SQLAlchemy<3,>=1.4 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (2.0.30)\n",
"Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (3.9.5)\n",
"Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (0.6.6)\n",
"Requirement already satisfied: langchain-text-splitters<0.1,>=0.0.1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (0.0.2)\n",
"Requirement already satisfied: langsmith<0.2.0,>=0.1.17 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (0.1.82)\n",
"Requirement already satisfied: numpy<2,>=1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (1.26.4)\n",
"Requirement already satisfied: pydantic<3,>=1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (2.10.6)\n",
"Requirement already satisfied: requests<3,>=2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (2.32.3)\n",
"Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (8.3.0)\n",
"Requirement already satisfied: jsonpatch<2.0,>=1.33 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain_core) (1.33)\n",
"Requirement already satisfied: packaging<24.0,>=23.2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain_core) (23.2)\n",
"Collecting groq<1,>=0.4.1 (from langchain_groq)\n",
" Downloading groq-0.18.0-py3-none-any.whl.metadata (14 kB)\n",
"INFO: pip is looking at multiple versions of langchain-groq to determine which version is compatible with other requirements. This could take a while.\n",
"Collecting langchain_groq\n",
" Downloading langchain_groq-0.2.3-py3-none-any.whl.metadata (3.0 kB)\n",
" Downloading langchain_groq-0.2.2-py3-none-any.whl.metadata (3.0 kB)\n",
" Downloading langchain_groq-0.2.1-py3-none-any.whl.metadata (2.9 kB)\n",
" Downloading langchain_groq-0.2.0-py3-none-any.whl.metadata (2.9 kB)\n",
" Downloading langchain_groq-0.1.10-py3-none-any.whl.metadata (2.9 kB)\n",
" Downloading langchain_groq-0.1.9-py3-none-any.whl.metadata (2.9 kB)\n",
" Downloading langchain_groq-0.1.8-py3-none-any.whl.metadata (2.9 kB)\n",
"INFO: pip is still looking at multiple versions of langchain-groq to determine which version is compatible with other requirements. This could take a while.\n",
" Downloading langchain_groq-0.1.6-py3-none-any.whl.metadata (2.8 kB)\n",
" Downloading langchain_groq-0.1.5-py3-none-any.whl.metadata (2.8 kB)\n",
"Collecting langgraph-checkpoint<3.0.0,>=2.0.10 (from langgraph)\n",
" Downloading langgraph_checkpoint-2.0.16-py3-none-any.whl.metadata (4.6 kB)\n",
"Collecting langgraph-prebuilt<0.2,>=0.1.1 (from langgraph)\n",
" Downloading langgraph_prebuilt-0.1.1-py3-none-any.whl.metadata (5.0 kB)\n",
"Collecting langgraph-sdk<0.2.0,>=0.1.42 (from langgraph)\n",
" Downloading langgraph_sdk-0.1.53-py3-none-any.whl.metadata (1.8 kB)\n",
"Requirement already satisfied: aiosignal>=1.1.2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.3.1)\n",
"Requirement already satisfied: attrs>=17.3.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (23.2.0)\n",
"Requirement already satisfied: frozenlist>=1.1.1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.4.1)\n",
"Requirement already satisfied: multidict<7.0,>=4.5 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (6.0.5)\n",
"Requirement already satisfied: yarl<2.0,>=1.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from aiohttp<4.0.0,>=3.8.3->langchain) (1.9.4)\n",
"Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from dataclasses-json<0.7,>=0.5.7->langchain) (3.21.2)\n",
"Requirement already satisfied: typing-inspect<1,>=0.4.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from dataclasses-json<0.7,>=0.5.7->langchain) (0.9.0)\n",
"Requirement already satisfied: anyio<5,>=3.5.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from groq<1,>=0.4.1->langchain_groq) (4.4.0)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from groq<1,>=0.4.1->langchain_groq) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from groq<1,>=0.4.1->langchain_groq) (0.27.0)\n",
"Requirement already satisfied: sniffio in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from groq<1,>=0.4.1->langchain_groq) (1.3.1)\n",
"Requirement already satisfied: typing-extensions<5,>=4.10 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from groq<1,>=0.4.1->langchain_groq) (4.12.2)\n",
"Requirement already satisfied: jsonpointer>=1.9 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from jsonpatch<2.0,>=1.33->langchain_core) (2.4)\n",
"INFO: pip is looking at multiple versions of langgraph-checkpoint to determine which version is compatible with other requirements. This could take a while.\n",
"Collecting langgraph-checkpoint<3.0.0,>=2.0.10 (from langgraph)\n",
" Downloading langgraph_checkpoint-2.0.15-py3-none-any.whl.metadata (4.6 kB)\n",
" Downloading langgraph_checkpoint-2.0.14-py3-none-any.whl.metadata (4.6 kB)\n",
" Downloading langgraph_checkpoint-2.0.13-py3-none-any.whl.metadata (4.6 kB)\n",
" Downloading langgraph_checkpoint-2.0.12-py3-none-any.whl.metadata (4.6 kB)\n",
" Downloading langgraph_checkpoint-2.0.10-py3-none-any.whl.metadata (4.6 kB)\n",
"Collecting langchain-text-splitters<0.1,>=0.0.1 (from langchain)\n",
" Using cached langchain_text_splitters-0.0.2-py3-none-any.whl.metadata (2.2 kB)\n",
"INFO: pip is still looking at multiple versions of langgraph-checkpoint to determine which version is compatible with other requirements. This could take a while.\n",
" Downloading langchain_text_splitters-0.0.1-py3-none-any.whl.metadata (2.0 kB)\n",
"INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.\n",
"Collecting langgraph\n",
" Downloading langgraph-0.3.1-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.76-py3-none-any.whl.metadata (17 kB)\n",
"INFO: pip is looking at multiple versions of langgraph to determine which version is compatible with other requirements. This could take a while.\n",
" Downloading langgraph-0.2.75-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.74-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.73-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.72-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.71-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.70-py3-none-any.whl.metadata (17 kB)\n",
" Downloading langgraph-0.2.69-py3-none-any.whl.metadata (17 kB)\n",
"INFO: pip is still looking at multiple versions of langgraph to determine which version is compatible with other requirements. This could take a while.\n",
" Downloading langgraph-0.2.68-py3-none-any.whl.metadata (16 kB)\n",
" Downloading langgraph-0.2.67-py3-none-any.whl.metadata (16 kB)\n",
" Downloading langgraph-0.2.66-py3-none-any.whl.metadata (16 kB)\n",
" Downloading langgraph-0.2.65-py3-none-any.whl.metadata (16 kB)\n",
" Downloading langgraph-0.2.64-py3-none-any.whl.metadata (16 kB)\n",
"INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.\n",
" Downloading langgraph-0.2.63-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.62-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.61-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.60-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.59-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.58-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.57-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.56-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.55-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.54-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.53-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.52-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.51-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.50-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.49-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.48-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.47-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.46-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.45-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.44-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.43-py3-none-any.whl.metadata (15 kB)\n",
" Downloading langgraph-0.2.42-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.41-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.40-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.39-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.38-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.37-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.36-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.35-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.34-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.33-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.32-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.28-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.27-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.26-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.25-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.24-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.23-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.22-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.21-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.20-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.19-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.18-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.17-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.16-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.15-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.14-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.13-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.12-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.11-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.10-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.9-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.8-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.7-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.6-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.5-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.4-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.3-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.2-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.1-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.2.0-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.19-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.17-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.16-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.15-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.14-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.13-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.12-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.11-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.10-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.9-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.8-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.7-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.6-py3-none-any.whl.metadata (13 kB)\n",
" Downloading langgraph-0.1.5-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.1.4-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.1.3-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.1.2-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.1.1-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.0.69-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.0.68-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.0.67-py3-none-any.whl.metadata (11 kB)\n",
" Downloading langgraph-0.0.66-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.65-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.64-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.63-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.62-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.61-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.60-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.59-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.58-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.57-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.56-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.55-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.54-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.53-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.52-py3-none-any.whl.metadata (23 kB)\n",
" Downloading langgraph-0.0.51-py3-none-any.whl.metadata (23 kB)\n",
"Collecting uuid6<2025.0.0,>=2024.1.12 (from langgraph)\n",
" Downloading uuid6-2024.7.10-py3-none-any.whl.metadata (8.6 kB)\n",
"Requirement already satisfied: orjson<4.0.0,>=3.9.14 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langsmith<0.2.0,>=0.1.17->langchain) (3.10.5)\n",
"Requirement already satisfied: annotated-types>=0.6.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from pydantic<3,>=1->langchain) (0.7.0)\n",
"Requirement already satisfied: pydantic-core==2.27.2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from pydantic<3,>=1->langchain) (2.27.2)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from requests<3,>=2->langchain) (3.3.2)\n",
"Requirement already satisfied: idna<4,>=2.5 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from requests<3,>=2->langchain) (3.7)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from requests<3,>=2->langchain) (2.2.1)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from requests<3,>=2->langchain) (2024.6.2)\n",
"Requirement already satisfied: greenlet!=0.4.17 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from SQLAlchemy<3,>=1.4->langchain) (3.1.1)\n",
"Requirement already satisfied: httpcore==1.* in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from httpx<1,>=0.23.0->groq<1,>=0.4.1->langchain_groq) (1.0.5)\n",
"Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->groq<1,>=0.4.1->langchain_groq) (0.14.0)\n",
"Requirement already satisfied: mypy-extensions>=0.3.0 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain) (1.0.0)\n",
"Downloading langchain_groq-0.1.5-py3-none-any.whl (11 kB)\n",
"Downloading langgraph-0.0.51-py3-none-any.whl (83 kB)\n",
"Downloading groq-0.18.0-py3-none-any.whl (121 kB)\n",
"Downloading uuid6-2024.7.10-py3-none-any.whl (6.4 kB)\n",
"Installing collected packages: uuid6, groq, langgraph, langchain_groq\n",
"Successfully installed groq-0.18.0 langchain_groq-0.1.5 langgraph-0.0.51 uuid6-2024.7.10\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
"\n",
"[notice] A new release of pip is available: 24.3.1 -> 25.0.1\n",
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
]
}
],
"source": [
"!pip install langchain langchain_core langchain_groq langchain_community langgraph"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "W2k5O6f-LHy2"
},
"outputs": [],
"source": [
"from typing import TypedDict, Dict\n",
"from langgraph.graph import StateGraph, END\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables.graph import MermaidDrawMethod\n",
"from IPython.display import display, Image"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "MYtwefLeLzUX"
},
"source": [
"Define State Structure\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "aIgc0eTYLs4j"
},
"outputs": [],
"source": [
"class State(TypedDict):\n",
" query : str\n",
" category : str\n",
" sentiment : str\n",
" response : str\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 123
},
"id": "XRiPVwK4N7UB",
"outputId": "4be46677-7e68-4183-d2b4-29995f10d84c"
},
"outputs": [
{
"data": {
"text/plain": [
"\"LangChain is an open-source framework designed to help developers build applications that utilize large language models (LLMs) more efficiently. It was created to simplify the process of integrating LLMs into various projects, making it easier for developers to leverage the capabilities of these powerful models.\\n\\nLangChain provides a set of tools and libraries that enable developers to:\\n\\n1. **Interact with LLMs**: LangChain offers a unified interface to interact with different LLMs, such as LLaMA, PaLM, and others, allowing developers to write code that works across multiple models.\\n2. **Manage memory and computation**: LangChain helps optimize memory usage and computation resources when working with LLMs, which can be computationally intensive and require significant memory.\\n3. **Implement custom workflows**: LangChain provides a flexible framework for building custom workflows that involve LLMs, such as text classification, question-answering, and text generation.\\n4. **Integrate with other tools and services**: LangChain allows developers to integrate LLMs with other tools and services, such as databases, APIs, and messaging platforms.\\n\\nThe key benefits of using LangChain include:\\n\\n* **Simplified development**: LangChain abstracts away many of the complexities associated with working with LLMs, making it easier for developers to build applications.\\n* **Improved performance**: LangChain's optimization techniques help reduce the computational resources required to run LLMs, making them more efficient and cost-effective.\\n* **Increased flexibility**: LangChain's modular design allows developers to easily swap out different LLMs or integrate new models as they become available.\\n\\nLangChain has a wide range of potential applications, including:\\n\\n* **Chatbots and conversational AI**: LangChain can be used to build more sophisticated chatbots that can understand and respond to user input.\\n* **Text analysis and summarization**: LangChain can be used to analyze and summarize large volumes of text data, such as news articles or documents.\\n* **Content generation**: LangChain can be used to generate high-quality content, such as articles, stories, or dialogues.\\n\\nOverall, LangChain is a powerful tool for developers looking to harness the capabilities of large language models and build innovative applications that can understand and generate human-like language.\""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from langchain_groq import ChatGroq\n",
"\n",
"llm = ChatGroq(\n",
" temperature = 0,\n",
" groq_api_key = \"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\",\n",
" model_name = \"llama-3.3-70b-versatile\"\n",
")\n",
"result = llm.invoke(\"what is langchain\")\n",
"result.content"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lv7-VCg5NaZO"
},
"source": [
"Define Node Function\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"id": "stPNaRqiMEAw"
},
"outputs": [],
"source": [
"def categorize(state: State) -> State:\n",
" \"Technical, Billing, General\"\n",
" prompt = ChatPromptTemplate.from_template(\n",
" \"Categorize the following customer query into one of these categories: \"\n",
" \"Technical, Billing, General. Query: {query}\"\n",
" )\n",
" chain = prompt | llm\n",
" category = chain.invoke({\"query\": state[\"query\"]}).content\n",
" return {\"category\": category}\n",
"\n",
"def analyze_sentiment(state: State) -> State:\n",
" prompt = ChatPromptTemplate.from_template(\n",
" \"Analyze the sentiment of the following customer query\"\n",
" \"Response with either 'Position', 'Neutral' , or 'Negative'. Query: {query}\"\n",
" )\n",
" chain = prompt | llm\n",
" sentiment = chain.invoke({\"query\": state[\"query\"]}).content\n",
" return {\"sentiment\": sentiment}\n",
"\n",
"def handle_technical(state: State)->State:\n",
" prompt = ChatPromptTemplate.from_template(\n",
" \"Provide a technical support response to the following query : {query}\"\n",
" )\n",
" chain = prompt | llm\n",
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
" return {\"response\": response}\n",
"\n",
"def handle_billing(state: State)->State:\n",
" prompt = ChatPromptTemplate.from_template(\n",
" \"Provide a billing support response to the following query : {query}\"\n",
" )\n",
" chain = prompt | llm\n",
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
" return {\"response\": response}\n",
"\n",
"def handle_general(state: State)->State:\n",
" prompt = ChatPromptTemplate.from_template(\n",
" \"Provide a general support response to the following query : {query}\"\n",
" )\n",
" chain = prompt | llm\n",
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
" return {\"response\": response}\n",
"\n",
"def escalate(state: State)->State:\n",
" return {\"response\": \"This query has been escalate to a human agent due to its negative sentiment\"}\n",
"\n",
"def route_query(state: State)->State:\n",
" if state[\"sentiment\"] == \"Negative\":\n",
" return \"escalate\"\n",
" elif state[\"category\"] == \"Technical\":\n",
" return \"handle_technical\"\n",
" elif state[\"category\"] == \"Billing\":\n",
" return \"handle_billing\"\n",
" else:\n",
" return \"handle_general\"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "mq6g-aBoWPW2"
},
"source": [
"create and configure the graph\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"id": "YGxYuxOZUDPq"
},
"outputs": [],
"source": [
"workflow = StateGraph(State)\n",
"\n",
"workflow.add_node(\"categorize\", categorize)\n",
"workflow.add_node(\"analyze_sentiment\", analyze_sentiment)\n",
"workflow.add_node(\"handle_technical\", handle_technical)\n",
"workflow.add_node(\"handle_billing\", handle_billing)\n",
"workflow.add_node(\"handle_general\", handle_general)\n",
"workflow.add_node(\"escalate\", escalate)\n",
"\n",
"workflow.add_edge(\"categorize\", \"analyze_sentiment\")\n",
"workflow.add_conditional_edges(\n",
" \"analyze_sentiment\",\n",
" route_query,{\n",
" \"handle_technical\" : \"handle_technical\",\n",
" \"handle_billing\" : \"handle_billing\",\n",
" \"handle_general\" : \"handle_general\",\n",
" \"escalate\": \"escalate\"\n",
" }\n",
")\n",
"\n",
"workflow.add_edge(\"handle_technical\", END)\n",
"workflow.add_edge(\"handle_billing\", END)\n",
"workflow.add_edge(\"handle_general\", END)\n",
"workflow.add_edge(\"escalate\", END)\n",
"\n",
"workflow.set_entry_point(\"categorize\")\n",
"\n",
"app = workflow.compile()\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0gev4GERZCED"
},
"source": [
"Run Customer Support Function"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"id": "LwF2JmHnY3pc"
},
"outputs": [],
"source": [
"\n",
"def run_customer_support(query: str)->Dict[str, str]:\n",
" results = app.invoke({\"query\": query})\n",
" return {\n",
" \"category\":results['category'],\n",
" \"sentiment\":results['sentiment'],\n",
" \"response\": results['response']\n",
" }"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "e93hSTmZZfqz",
"outputId": "3c9e2f22-83bd-44ad-983b-9373d13d0838"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Query: my laptop is not charging what should i do?\n",
"Category : The customer query \"my laptop is not charging what should i do?\" can be categorized as: Technical.\n",
"\n",
"This is because the query is related to a technical issue with the customer's laptop, specifically a problem with charging, and they are seeking assistance or troubleshooting advice to resolve the issue.\n",
"Sentiment : Neutral. \n",
"\n",
"The customer is seeking help and providing information about their issue, but they are not expressing any emotion, frustration, or dissatisfaction, which is why the sentiment is neutral. They are simply stating a problem and asking for a solution.\n",
"Response : I'm sorry to hear that your laptop is not charging. Don't worry, I'm here to help you troubleshoot the issue. Here are some steps you can try to resolve the problem:\n",
"\n",
"1. **Check the power cord and adapter**: Ensure that the power cord is properly connected to both the laptop and the power outlet. Try using a different power outlet to rule out any issues with the electrical supply.\n",
"2. **Verify the charger**: If you have a spare charger, try using it to see if the issue is with the charger itself. If you don't have a spare, you can try borrowing one from a friend or purchasing a new one.\n",
"3. **Check the laptop's charging port**: Inspect the charging port on your laptop for any signs of damage or debris. Clean out any dust or dirt that may be accumulated in the port using a soft brush or a can of compressed air.\n",
"4. **Restart your laptop**: Sometimes, a simple restart can resolve the issue. Shut down your laptop, unplug the power cord, and then plug it back in and restart.\n",
"5. **Check the battery settings**: Ensure that the battery settings are set to charge the battery. You can check this in your laptop's settings or control panel.\n",
"6. **Update your laptop's drivers**: Outdated drivers can cause charging issues. Check for updates for your laptop's drivers, especially the battery driver.\n",
"7. **Run a diagnostic test**: If your laptop has a built-in diagnostic test, run it to check for any issues with the battery or charging system.\n",
"\n",
"If none of these steps resolve the issue, it's possible that there's a hardware problem with your laptop's battery or charging system. In this case, you may need to:\n",
"\n",
"* **Contact the manufacturer's support**: Reach out to the laptop manufacturer's support team for further assistance or to schedule a repair.\n",
"* **Visit a authorized service center**: Take your laptop to an authorized service center for a professional diagnosis and repair.\n",
"\n",
"Remember to always handle your laptop with care, and avoid exposing it to extreme temperatures, physical stress, or moisture, as these can cause damage to the battery and charging system.\n",
"\n",
"I hope these steps help you resolve the issue with your laptop not charging. If you have any further questions or concerns, feel free to ask!\n"
]
}
],
"source": [
"query = \"my laptop is not charging what should i do?\"\n",
"result = run_customer_support(query)\n",
"print(f\"Query: {query}\")\n",
"print(f\"Category : {result['category']}\")\n",
"print(f\"Sentiment : {result['sentiment']}\")\n",
"print(f\"Response : {result['response']}\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running on local URL: http://127.0.0.1:7861\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\gradio\\analytics.py:106: UserWarning: IMPORTANT: You are using gradio version 4.44.0, however version 4.44.1 is available, please upgrade. \n",
"--------\n",
" warnings.warn(\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running on public URL: https://8550729e4374b9f3d6.gradio.live\n",
"\n",
"This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)\n"
]
},
{
"data": {
"text/html": [
"<div><iframe src=\"https://8550729e4374b9f3d6.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import gradio as gr\n",
"\n",
"# Define the function that integrates the workflow.\n",
"def run_customer_support(query: str) -> Dict[str, str]:\n",
" results = app.invoke({\"query\": query})\n",
" return {\n",
" \"Category\": results['category'],\n",
" \"Sentiment\": results['sentiment'],\n",
" \"Response\": results['response']\n",
" }\n",
"\n",
"# Create the Gradio interface\n",
"def gradio_interface(query: str):\n",
" result = run_customer_support(query)\n",
" return (\n",
" f\"**Category:** {result['Category']}\\n\\n\"\n",
" f\"**Sentiment:** {result['Sentiment']}\\n\\n\"\n",
" f\"**Response:** {result['Response']}\"\n",
" )\n",
"\n",
"# Build the Gradio app\n",
"gui = gr.Interface(\n",
" fn=gradio_interface,\n",
" theme='Yntec/HaleyCH_Theme_Orange_Green',\n",
" inputs=gr.Textbox(lines=2, placeholder=\"Enter your query here...\"),\n",
" outputs=gr.Markdown(),\n",
" title=\"Customer Support Assistant\",\n",
" description=\"Provide a query and receive a categorized response. The system analyzes sentiment and routes to the appropriate support channel.\",\n",
")\n",
"\n",
"# Launch the app\n",
"if __name__ == \"__main__\":\n",
" gui.launch(share=True)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"gpuType": "T4",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|