Upload customer_support_agent.ipynb
Browse files- customer_support_agent.ipynb +622 -0
customer_support_agent.ipynb
ADDED
@@ -0,0 +1,622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 2,
|
6 |
+
"metadata": {
|
7 |
+
"colab": {
|
8 |
+
"base_uri": "https://localhost:8080/"
|
9 |
+
},
|
10 |
+
"id": "VZllvIwaKwKb",
|
11 |
+
"outputId": "20ad5a9b-14e2-4410-afc4-4e0df2428fc3"
|
12 |
+
},
|
13 |
+
"outputs": [
|
14 |
+
{
|
15 |
+
"name": "stdout",
|
16 |
+
"output_type": "stream",
|
17 |
+
"text": [
|
18 |
+
"Requirement already satisfied: langchain in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.1.20)\n",
|
19 |
+
"Requirement already satisfied: langchain_core in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.1.52)\n",
|
20 |
+
"Collecting langchain_groq\n",
|
21 |
+
" Downloading langchain_groq-0.2.4-py3-none-any.whl.metadata (3.0 kB)\n",
|
22 |
+
"Requirement already satisfied: langchain_community in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (0.0.38)\n",
|
23 |
+
"Collecting langgraph\n",
|
24 |
+
" Downloading langgraph-0.3.2-py3-none-any.whl.metadata (17 kB)\n",
|
25 |
+
"Requirement already satisfied: PyYAML>=5.3 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (6.0.1)\n",
|
26 |
+
"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",
|
27 |
+
"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",
|
28 |
+
"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",
|
29 |
+
"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",
|
30 |
+
"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",
|
31 |
+
"Requirement already satisfied: numpy<2,>=1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (1.26.4)\n",
|
32 |
+
"Requirement already satisfied: pydantic<3,>=1 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (2.10.6)\n",
|
33 |
+
"Requirement already satisfied: requests<3,>=2 in c:\\users\\omvis\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from langchain) (2.32.3)\n",
|
34 |
+
"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",
|
35 |
+
"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",
|
36 |
+
"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",
|
37 |
+
"Collecting groq<1,>=0.4.1 (from langchain_groq)\n",
|
38 |
+
" Downloading groq-0.18.0-py3-none-any.whl.metadata (14 kB)\n",
|
39 |
+
"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",
|
40 |
+
"Collecting langchain_groq\n",
|
41 |
+
" Downloading langchain_groq-0.2.3-py3-none-any.whl.metadata (3.0 kB)\n",
|
42 |
+
" Downloading langchain_groq-0.2.2-py3-none-any.whl.metadata (3.0 kB)\n",
|
43 |
+
" Downloading langchain_groq-0.2.1-py3-none-any.whl.metadata (2.9 kB)\n",
|
44 |
+
" Downloading langchain_groq-0.2.0-py3-none-any.whl.metadata (2.9 kB)\n",
|
45 |
+
" Downloading langchain_groq-0.1.10-py3-none-any.whl.metadata (2.9 kB)\n",
|
46 |
+
" Downloading langchain_groq-0.1.9-py3-none-any.whl.metadata (2.9 kB)\n",
|
47 |
+
" Downloading langchain_groq-0.1.8-py3-none-any.whl.metadata (2.9 kB)\n",
|
48 |
+
"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",
|
49 |
+
" Downloading langchain_groq-0.1.6-py3-none-any.whl.metadata (2.8 kB)\n",
|
50 |
+
" Downloading langchain_groq-0.1.5-py3-none-any.whl.metadata (2.8 kB)\n",
|
51 |
+
"Collecting langgraph-checkpoint<3.0.0,>=2.0.10 (from langgraph)\n",
|
52 |
+
" Downloading langgraph_checkpoint-2.0.16-py3-none-any.whl.metadata (4.6 kB)\n",
|
53 |
+
"Collecting langgraph-prebuilt<0.2,>=0.1.1 (from langgraph)\n",
|
54 |
+
" Downloading langgraph_prebuilt-0.1.1-py3-none-any.whl.metadata (5.0 kB)\n",
|
55 |
+
"Collecting langgraph-sdk<0.2.0,>=0.1.42 (from langgraph)\n",
|
56 |
+
" Downloading langgraph_sdk-0.1.53-py3-none-any.whl.metadata (1.8 kB)\n",
|
57 |
+
"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",
|
58 |
+
"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",
|
59 |
+
"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",
|
60 |
+
"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",
|
61 |
+
"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",
|
62 |
+
"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",
|
63 |
+
"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",
|
64 |
+
"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",
|
65 |
+
"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",
|
66 |
+
"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",
|
67 |
+
"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",
|
68 |
+
"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",
|
69 |
+
"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",
|
70 |
+
"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",
|
71 |
+
"Collecting langgraph-checkpoint<3.0.0,>=2.0.10 (from langgraph)\n",
|
72 |
+
" Downloading langgraph_checkpoint-2.0.15-py3-none-any.whl.metadata (4.6 kB)\n",
|
73 |
+
" Downloading langgraph_checkpoint-2.0.14-py3-none-any.whl.metadata (4.6 kB)\n",
|
74 |
+
" Downloading langgraph_checkpoint-2.0.13-py3-none-any.whl.metadata (4.6 kB)\n",
|
75 |
+
" Downloading langgraph_checkpoint-2.0.12-py3-none-any.whl.metadata (4.6 kB)\n",
|
76 |
+
" Downloading langgraph_checkpoint-2.0.10-py3-none-any.whl.metadata (4.6 kB)\n",
|
77 |
+
"Collecting langchain-text-splitters<0.1,>=0.0.1 (from langchain)\n",
|
78 |
+
" Using cached langchain_text_splitters-0.0.2-py3-none-any.whl.metadata (2.2 kB)\n",
|
79 |
+
"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",
|
80 |
+
" Downloading langchain_text_splitters-0.0.1-py3-none-any.whl.metadata (2.0 kB)\n",
|
81 |
+
"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",
|
82 |
+
"Collecting langgraph\n",
|
83 |
+
" Downloading langgraph-0.3.1-py3-none-any.whl.metadata (17 kB)\n",
|
84 |
+
" Downloading langgraph-0.2.76-py3-none-any.whl.metadata (17 kB)\n",
|
85 |
+
"INFO: pip is looking at multiple versions of langgraph to determine which version is compatible with other requirements. This could take a while.\n",
|
86 |
+
" Downloading langgraph-0.2.75-py3-none-any.whl.metadata (17 kB)\n",
|
87 |
+
" Downloading langgraph-0.2.74-py3-none-any.whl.metadata (17 kB)\n",
|
88 |
+
" Downloading langgraph-0.2.73-py3-none-any.whl.metadata (17 kB)\n",
|
89 |
+
" Downloading langgraph-0.2.72-py3-none-any.whl.metadata (17 kB)\n",
|
90 |
+
" Downloading langgraph-0.2.71-py3-none-any.whl.metadata (17 kB)\n",
|
91 |
+
" Downloading langgraph-0.2.70-py3-none-any.whl.metadata (17 kB)\n",
|
92 |
+
" Downloading langgraph-0.2.69-py3-none-any.whl.metadata (17 kB)\n",
|
93 |
+
"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",
|
94 |
+
" Downloading langgraph-0.2.68-py3-none-any.whl.metadata (16 kB)\n",
|
95 |
+
" Downloading langgraph-0.2.67-py3-none-any.whl.metadata (16 kB)\n",
|
96 |
+
" Downloading langgraph-0.2.66-py3-none-any.whl.metadata (16 kB)\n",
|
97 |
+
" Downloading langgraph-0.2.65-py3-none-any.whl.metadata (16 kB)\n",
|
98 |
+
" Downloading langgraph-0.2.64-py3-none-any.whl.metadata (16 kB)\n",
|
99 |
+
"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",
|
100 |
+
" Downloading langgraph-0.2.63-py3-none-any.whl.metadata (15 kB)\n",
|
101 |
+
" Downloading langgraph-0.2.62-py3-none-any.whl.metadata (15 kB)\n",
|
102 |
+
" Downloading langgraph-0.2.61-py3-none-any.whl.metadata (15 kB)\n",
|
103 |
+
" Downloading langgraph-0.2.60-py3-none-any.whl.metadata (15 kB)\n",
|
104 |
+
" Downloading langgraph-0.2.59-py3-none-any.whl.metadata (15 kB)\n",
|
105 |
+
" Downloading langgraph-0.2.58-py3-none-any.whl.metadata (15 kB)\n",
|
106 |
+
" Downloading langgraph-0.2.57-py3-none-any.whl.metadata (15 kB)\n",
|
107 |
+
" Downloading langgraph-0.2.56-py3-none-any.whl.metadata (15 kB)\n",
|
108 |
+
" Downloading langgraph-0.2.55-py3-none-any.whl.metadata (15 kB)\n",
|
109 |
+
" Downloading langgraph-0.2.54-py3-none-any.whl.metadata (15 kB)\n",
|
110 |
+
" Downloading langgraph-0.2.53-py3-none-any.whl.metadata (15 kB)\n",
|
111 |
+
" Downloading langgraph-0.2.52-py3-none-any.whl.metadata (15 kB)\n",
|
112 |
+
" Downloading langgraph-0.2.51-py3-none-any.whl.metadata (15 kB)\n",
|
113 |
+
" Downloading langgraph-0.2.50-py3-none-any.whl.metadata (15 kB)\n",
|
114 |
+
" Downloading langgraph-0.2.49-py3-none-any.whl.metadata (15 kB)\n",
|
115 |
+
" Downloading langgraph-0.2.48-py3-none-any.whl.metadata (15 kB)\n",
|
116 |
+
" Downloading langgraph-0.2.47-py3-none-any.whl.metadata (15 kB)\n",
|
117 |
+
" Downloading langgraph-0.2.46-py3-none-any.whl.metadata (15 kB)\n",
|
118 |
+
" Downloading langgraph-0.2.45-py3-none-any.whl.metadata (15 kB)\n",
|
119 |
+
" Downloading langgraph-0.2.44-py3-none-any.whl.metadata (15 kB)\n",
|
120 |
+
" Downloading langgraph-0.2.43-py3-none-any.whl.metadata (15 kB)\n",
|
121 |
+
" Downloading langgraph-0.2.42-py3-none-any.whl.metadata (13 kB)\n",
|
122 |
+
" Downloading langgraph-0.2.41-py3-none-any.whl.metadata (13 kB)\n",
|
123 |
+
" Downloading langgraph-0.2.40-py3-none-any.whl.metadata (13 kB)\n",
|
124 |
+
" Downloading langgraph-0.2.39-py3-none-any.whl.metadata (13 kB)\n",
|
125 |
+
" Downloading langgraph-0.2.38-py3-none-any.whl.metadata (13 kB)\n",
|
126 |
+
" Downloading langgraph-0.2.37-py3-none-any.whl.metadata (13 kB)\n",
|
127 |
+
" Downloading langgraph-0.2.36-py3-none-any.whl.metadata (13 kB)\n",
|
128 |
+
" Downloading langgraph-0.2.35-py3-none-any.whl.metadata (13 kB)\n",
|
129 |
+
" Downloading langgraph-0.2.34-py3-none-any.whl.metadata (13 kB)\n",
|
130 |
+
" Downloading langgraph-0.2.33-py3-none-any.whl.metadata (13 kB)\n",
|
131 |
+
" Downloading langgraph-0.2.32-py3-none-any.whl.metadata (13 kB)\n",
|
132 |
+
" Downloading langgraph-0.2.28-py3-none-any.whl.metadata (13 kB)\n",
|
133 |
+
" Downloading langgraph-0.2.27-py3-none-any.whl.metadata (13 kB)\n",
|
134 |
+
" Downloading langgraph-0.2.26-py3-none-any.whl.metadata (13 kB)\n",
|
135 |
+
" Downloading langgraph-0.2.25-py3-none-any.whl.metadata (13 kB)\n",
|
136 |
+
" Downloading langgraph-0.2.24-py3-none-any.whl.metadata (13 kB)\n",
|
137 |
+
" Downloading langgraph-0.2.23-py3-none-any.whl.metadata (13 kB)\n",
|
138 |
+
" Downloading langgraph-0.2.22-py3-none-any.whl.metadata (13 kB)\n",
|
139 |
+
" Downloading langgraph-0.2.21-py3-none-any.whl.metadata (13 kB)\n",
|
140 |
+
" Downloading langgraph-0.2.20-py3-none-any.whl.metadata (13 kB)\n",
|
141 |
+
" Downloading langgraph-0.2.19-py3-none-any.whl.metadata (13 kB)\n",
|
142 |
+
" Downloading langgraph-0.2.18-py3-none-any.whl.metadata (13 kB)\n",
|
143 |
+
" Downloading langgraph-0.2.17-py3-none-any.whl.metadata (13 kB)\n",
|
144 |
+
" Downloading langgraph-0.2.16-py3-none-any.whl.metadata (13 kB)\n",
|
145 |
+
" Downloading langgraph-0.2.15-py3-none-any.whl.metadata (13 kB)\n",
|
146 |
+
" Downloading langgraph-0.2.14-py3-none-any.whl.metadata (13 kB)\n",
|
147 |
+
" Downloading langgraph-0.2.13-py3-none-any.whl.metadata (13 kB)\n",
|
148 |
+
" Downloading langgraph-0.2.12-py3-none-any.whl.metadata (13 kB)\n",
|
149 |
+
" Downloading langgraph-0.2.11-py3-none-any.whl.metadata (13 kB)\n",
|
150 |
+
" Downloading langgraph-0.2.10-py3-none-any.whl.metadata (13 kB)\n",
|
151 |
+
" Downloading langgraph-0.2.9-py3-none-any.whl.metadata (13 kB)\n",
|
152 |
+
" Downloading langgraph-0.2.8-py3-none-any.whl.metadata (13 kB)\n",
|
153 |
+
" Downloading langgraph-0.2.7-py3-none-any.whl.metadata (13 kB)\n",
|
154 |
+
" Downloading langgraph-0.2.6-py3-none-any.whl.metadata (13 kB)\n",
|
155 |
+
" Downloading langgraph-0.2.5-py3-none-any.whl.metadata (13 kB)\n",
|
156 |
+
" Downloading langgraph-0.2.4-py3-none-any.whl.metadata (13 kB)\n",
|
157 |
+
" Downloading langgraph-0.2.3-py3-none-any.whl.metadata (13 kB)\n",
|
158 |
+
" Downloading langgraph-0.2.2-py3-none-any.whl.metadata (13 kB)\n",
|
159 |
+
" Downloading langgraph-0.2.1-py3-none-any.whl.metadata (13 kB)\n",
|
160 |
+
" Downloading langgraph-0.2.0-py3-none-any.whl.metadata (13 kB)\n",
|
161 |
+
" Downloading langgraph-0.1.19-py3-none-any.whl.metadata (13 kB)\n",
|
162 |
+
" Downloading langgraph-0.1.17-py3-none-any.whl.metadata (13 kB)\n",
|
163 |
+
" Downloading langgraph-0.1.16-py3-none-any.whl.metadata (13 kB)\n",
|
164 |
+
" Downloading langgraph-0.1.15-py3-none-any.whl.metadata (13 kB)\n",
|
165 |
+
" Downloading langgraph-0.1.14-py3-none-any.whl.metadata (13 kB)\n",
|
166 |
+
" Downloading langgraph-0.1.13-py3-none-any.whl.metadata (13 kB)\n",
|
167 |
+
" Downloading langgraph-0.1.12-py3-none-any.whl.metadata (13 kB)\n",
|
168 |
+
" Downloading langgraph-0.1.11-py3-none-any.whl.metadata (13 kB)\n",
|
169 |
+
" Downloading langgraph-0.1.10-py3-none-any.whl.metadata (13 kB)\n",
|
170 |
+
" Downloading langgraph-0.1.9-py3-none-any.whl.metadata (13 kB)\n",
|
171 |
+
" Downloading langgraph-0.1.8-py3-none-any.whl.metadata (13 kB)\n",
|
172 |
+
" Downloading langgraph-0.1.7-py3-none-any.whl.metadata (13 kB)\n",
|
173 |
+
" Downloading langgraph-0.1.6-py3-none-any.whl.metadata (13 kB)\n",
|
174 |
+
" Downloading langgraph-0.1.5-py3-none-any.whl.metadata (11 kB)\n",
|
175 |
+
" Downloading langgraph-0.1.4-py3-none-any.whl.metadata (11 kB)\n",
|
176 |
+
" Downloading langgraph-0.1.3-py3-none-any.whl.metadata (11 kB)\n",
|
177 |
+
" Downloading langgraph-0.1.2-py3-none-any.whl.metadata (11 kB)\n",
|
178 |
+
" Downloading langgraph-0.1.1-py3-none-any.whl.metadata (11 kB)\n",
|
179 |
+
" Downloading langgraph-0.0.69-py3-none-any.whl.metadata (11 kB)\n",
|
180 |
+
" Downloading langgraph-0.0.68-py3-none-any.whl.metadata (11 kB)\n",
|
181 |
+
" Downloading langgraph-0.0.67-py3-none-any.whl.metadata (11 kB)\n",
|
182 |
+
" Downloading langgraph-0.0.66-py3-none-any.whl.metadata (23 kB)\n",
|
183 |
+
" Downloading langgraph-0.0.65-py3-none-any.whl.metadata (23 kB)\n",
|
184 |
+
" Downloading langgraph-0.0.64-py3-none-any.whl.metadata (23 kB)\n",
|
185 |
+
" Downloading langgraph-0.0.63-py3-none-any.whl.metadata (23 kB)\n",
|
186 |
+
" Downloading langgraph-0.0.62-py3-none-any.whl.metadata (23 kB)\n",
|
187 |
+
" Downloading langgraph-0.0.61-py3-none-any.whl.metadata (23 kB)\n",
|
188 |
+
" Downloading langgraph-0.0.60-py3-none-any.whl.metadata (23 kB)\n",
|
189 |
+
" Downloading langgraph-0.0.59-py3-none-any.whl.metadata (23 kB)\n",
|
190 |
+
" Downloading langgraph-0.0.58-py3-none-any.whl.metadata (23 kB)\n",
|
191 |
+
" Downloading langgraph-0.0.57-py3-none-any.whl.metadata (23 kB)\n",
|
192 |
+
" Downloading langgraph-0.0.56-py3-none-any.whl.metadata (23 kB)\n",
|
193 |
+
" Downloading langgraph-0.0.55-py3-none-any.whl.metadata (23 kB)\n",
|
194 |
+
" Downloading langgraph-0.0.54-py3-none-any.whl.metadata (23 kB)\n",
|
195 |
+
" Downloading langgraph-0.0.53-py3-none-any.whl.metadata (23 kB)\n",
|
196 |
+
" Downloading langgraph-0.0.52-py3-none-any.whl.metadata (23 kB)\n",
|
197 |
+
" Downloading langgraph-0.0.51-py3-none-any.whl.metadata (23 kB)\n",
|
198 |
+
"Collecting uuid6<2025.0.0,>=2024.1.12 (from langgraph)\n",
|
199 |
+
" Downloading uuid6-2024.7.10-py3-none-any.whl.metadata (8.6 kB)\n",
|
200 |
+
"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",
|
201 |
+
"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",
|
202 |
+
"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",
|
203 |
+
"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",
|
204 |
+
"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",
|
205 |
+
"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",
|
206 |
+
"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",
|
207 |
+
"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",
|
208 |
+
"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",
|
209 |
+
"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",
|
210 |
+
"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",
|
211 |
+
"Downloading langchain_groq-0.1.5-py3-none-any.whl (11 kB)\n",
|
212 |
+
"Downloading langgraph-0.0.51-py3-none-any.whl (83 kB)\n",
|
213 |
+
"Downloading groq-0.18.0-py3-none-any.whl (121 kB)\n",
|
214 |
+
"Downloading uuid6-2024.7.10-py3-none-any.whl (6.4 kB)\n",
|
215 |
+
"Installing collected packages: uuid6, groq, langgraph, langchain_groq\n",
|
216 |
+
"Successfully installed groq-0.18.0 langchain_groq-0.1.5 langgraph-0.0.51 uuid6-2024.7.10\n"
|
217 |
+
]
|
218 |
+
},
|
219 |
+
{
|
220 |
+
"name": "stderr",
|
221 |
+
"output_type": "stream",
|
222 |
+
"text": [
|
223 |
+
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
|
224 |
+
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
|
225 |
+
"WARNING: Ignoring invalid distribution ~treamlit (C:\\Users\\omvis\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages)\n",
|
226 |
+
"\n",
|
227 |
+
"[notice] A new release of pip is available: 24.3.1 -> 25.0.1\n",
|
228 |
+
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
|
229 |
+
]
|
230 |
+
}
|
231 |
+
],
|
232 |
+
"source": [
|
233 |
+
"!pip install langchain langchain_core langchain_groq langchain_community langgraph"
|
234 |
+
]
|
235 |
+
},
|
236 |
+
{
|
237 |
+
"cell_type": "code",
|
238 |
+
"execution_count": 3,
|
239 |
+
"metadata": {
|
240 |
+
"id": "W2k5O6f-LHy2"
|
241 |
+
},
|
242 |
+
"outputs": [],
|
243 |
+
"source": [
|
244 |
+
"from typing import TypedDict, Dict\n",
|
245 |
+
"from langgraph.graph import StateGraph, END\n",
|
246 |
+
"from langchain_core.prompts import ChatPromptTemplate\n",
|
247 |
+
"from langchain_core.runnables.graph import MermaidDrawMethod\n",
|
248 |
+
"from IPython.display import display, Image"
|
249 |
+
]
|
250 |
+
},
|
251 |
+
{
|
252 |
+
"cell_type": "markdown",
|
253 |
+
"metadata": {
|
254 |
+
"id": "MYtwefLeLzUX"
|
255 |
+
},
|
256 |
+
"source": [
|
257 |
+
"Define State Structure\n"
|
258 |
+
]
|
259 |
+
},
|
260 |
+
{
|
261 |
+
"cell_type": "code",
|
262 |
+
"execution_count": 4,
|
263 |
+
"metadata": {
|
264 |
+
"id": "aIgc0eTYLs4j"
|
265 |
+
},
|
266 |
+
"outputs": [],
|
267 |
+
"source": [
|
268 |
+
"class State(TypedDict):\n",
|
269 |
+
" query : str\n",
|
270 |
+
" category : str\n",
|
271 |
+
" sentiment : str\n",
|
272 |
+
" response : str\n"
|
273 |
+
]
|
274 |
+
},
|
275 |
+
{
|
276 |
+
"cell_type": "code",
|
277 |
+
"execution_count": 5,
|
278 |
+
"metadata": {
|
279 |
+
"colab": {
|
280 |
+
"base_uri": "https://localhost:8080/",
|
281 |
+
"height": 123
|
282 |
+
},
|
283 |
+
"id": "XRiPVwK4N7UB",
|
284 |
+
"outputId": "4be46677-7e68-4183-d2b4-29995f10d84c"
|
285 |
+
},
|
286 |
+
"outputs": [
|
287 |
+
{
|
288 |
+
"data": {
|
289 |
+
"text/plain": [
|
290 |
+
"\"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.\""
|
291 |
+
]
|
292 |
+
},
|
293 |
+
"execution_count": 5,
|
294 |
+
"metadata": {},
|
295 |
+
"output_type": "execute_result"
|
296 |
+
}
|
297 |
+
],
|
298 |
+
"source": [
|
299 |
+
"from langchain_groq import ChatGroq\n",
|
300 |
+
"\n",
|
301 |
+
"llm = ChatGroq(\n",
|
302 |
+
" temperature = 0,\n",
|
303 |
+
" groq_api_key = \"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\",\n",
|
304 |
+
" model_name = \"llama-3.3-70b-versatile\"\n",
|
305 |
+
")\n",
|
306 |
+
"result = llm.invoke(\"what is langchain\")\n",
|
307 |
+
"result.content"
|
308 |
+
]
|
309 |
+
},
|
310 |
+
{
|
311 |
+
"cell_type": "markdown",
|
312 |
+
"metadata": {
|
313 |
+
"id": "lv7-VCg5NaZO"
|
314 |
+
},
|
315 |
+
"source": [
|
316 |
+
"Define Node Function\n"
|
317 |
+
]
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"cell_type": "code",
|
321 |
+
"execution_count": 6,
|
322 |
+
"metadata": {
|
323 |
+
"id": "stPNaRqiMEAw"
|
324 |
+
},
|
325 |
+
"outputs": [],
|
326 |
+
"source": [
|
327 |
+
"def categorize(state: State) -> State:\n",
|
328 |
+
" \"Technical, Billing, General\"\n",
|
329 |
+
" prompt = ChatPromptTemplate.from_template(\n",
|
330 |
+
" \"Categorize the following customer query into one of these categories: \"\n",
|
331 |
+
" \"Technical, Billing, General. Query: {query}\"\n",
|
332 |
+
" )\n",
|
333 |
+
" chain = prompt | llm\n",
|
334 |
+
" category = chain.invoke({\"query\": state[\"query\"]}).content\n",
|
335 |
+
" return {\"category\": category}\n",
|
336 |
+
"\n",
|
337 |
+
"def analyze_sentiment(state: State) -> State:\n",
|
338 |
+
" prompt = ChatPromptTemplate.from_template(\n",
|
339 |
+
" \"Analyze the sentiment of the following customer query\"\n",
|
340 |
+
" \"Response with either 'Position', 'Neutral' , or 'Negative'. Query: {query}\"\n",
|
341 |
+
" )\n",
|
342 |
+
" chain = prompt | llm\n",
|
343 |
+
" sentiment = chain.invoke({\"query\": state[\"query\"]}).content\n",
|
344 |
+
" return {\"sentiment\": sentiment}\n",
|
345 |
+
"\n",
|
346 |
+
"def handle_technical(state: State)->State:\n",
|
347 |
+
" prompt = ChatPromptTemplate.from_template(\n",
|
348 |
+
" \"Provide a technical support response to the following query : {query}\"\n",
|
349 |
+
" )\n",
|
350 |
+
" chain = prompt | llm\n",
|
351 |
+
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
|
352 |
+
" return {\"response\": response}\n",
|
353 |
+
"\n",
|
354 |
+
"def handle_billing(state: State)->State:\n",
|
355 |
+
" prompt = ChatPromptTemplate.from_template(\n",
|
356 |
+
" \"Provide a billing support response to the following query : {query}\"\n",
|
357 |
+
" )\n",
|
358 |
+
" chain = prompt | llm\n",
|
359 |
+
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
|
360 |
+
" return {\"response\": response}\n",
|
361 |
+
"\n",
|
362 |
+
"def handle_general(state: State)->State:\n",
|
363 |
+
" prompt = ChatPromptTemplate.from_template(\n",
|
364 |
+
" \"Provide a general support response to the following query : {query}\"\n",
|
365 |
+
" )\n",
|
366 |
+
" chain = prompt | llm\n",
|
367 |
+
" response = chain.invoke({\"query\": state[\"query\"]}).content\n",
|
368 |
+
" return {\"response\": response}\n",
|
369 |
+
"\n",
|
370 |
+
"def escalate(state: State)->State:\n",
|
371 |
+
" return {\"response\": \"This query has been escalate to a human agent due to its negative sentiment\"}\n",
|
372 |
+
"\n",
|
373 |
+
"def route_query(state: State)->State:\n",
|
374 |
+
" if state[\"sentiment\"] == \"Negative\":\n",
|
375 |
+
" return \"escalate\"\n",
|
376 |
+
" elif state[\"category\"] == \"Technical\":\n",
|
377 |
+
" return \"handle_technical\"\n",
|
378 |
+
" elif state[\"category\"] == \"Billing\":\n",
|
379 |
+
" return \"handle_billing\"\n",
|
380 |
+
" else:\n",
|
381 |
+
" return \"handle_general\"\n"
|
382 |
+
]
|
383 |
+
},
|
384 |
+
{
|
385 |
+
"cell_type": "markdown",
|
386 |
+
"metadata": {
|
387 |
+
"id": "mq6g-aBoWPW2"
|
388 |
+
},
|
389 |
+
"source": [
|
390 |
+
"create and configure the graph\n"
|
391 |
+
]
|
392 |
+
},
|
393 |
+
{
|
394 |
+
"cell_type": "code",
|
395 |
+
"execution_count": 7,
|
396 |
+
"metadata": {
|
397 |
+
"id": "YGxYuxOZUDPq"
|
398 |
+
},
|
399 |
+
"outputs": [],
|
400 |
+
"source": [
|
401 |
+
"workflow = StateGraph(State)\n",
|
402 |
+
"\n",
|
403 |
+
"workflow.add_node(\"categorize\", categorize)\n",
|
404 |
+
"workflow.add_node(\"analyze_sentiment\", analyze_sentiment)\n",
|
405 |
+
"workflow.add_node(\"handle_technical\", handle_technical)\n",
|
406 |
+
"workflow.add_node(\"handle_billing\", handle_billing)\n",
|
407 |
+
"workflow.add_node(\"handle_general\", handle_general)\n",
|
408 |
+
"workflow.add_node(\"escalate\", escalate)\n",
|
409 |
+
"\n",
|
410 |
+
"workflow.add_edge(\"categorize\", \"analyze_sentiment\")\n",
|
411 |
+
"workflow.add_conditional_edges(\n",
|
412 |
+
" \"analyze_sentiment\",\n",
|
413 |
+
" route_query,{\n",
|
414 |
+
" \"handle_technical\" : \"handle_technical\",\n",
|
415 |
+
" \"handle_billing\" : \"handle_billing\",\n",
|
416 |
+
" \"handle_general\" : \"handle_general\",\n",
|
417 |
+
" \"escalate\": \"escalate\"\n",
|
418 |
+
" }\n",
|
419 |
+
")\n",
|
420 |
+
"\n",
|
421 |
+
"workflow.add_edge(\"handle_technical\", END)\n",
|
422 |
+
"workflow.add_edge(\"handle_billing\", END)\n",
|
423 |
+
"workflow.add_edge(\"handle_general\", END)\n",
|
424 |
+
"workflow.add_edge(\"escalate\", END)\n",
|
425 |
+
"\n",
|
426 |
+
"workflow.set_entry_point(\"categorize\")\n",
|
427 |
+
"\n",
|
428 |
+
"app = workflow.compile()\n"
|
429 |
+
]
|
430 |
+
},
|
431 |
+
{
|
432 |
+
"cell_type": "markdown",
|
433 |
+
"metadata": {
|
434 |
+
"id": "0gev4GERZCED"
|
435 |
+
},
|
436 |
+
"source": [
|
437 |
+
"Run Customer Support Function"
|
438 |
+
]
|
439 |
+
},
|
440 |
+
{
|
441 |
+
"cell_type": "code",
|
442 |
+
"execution_count": 8,
|
443 |
+
"metadata": {
|
444 |
+
"id": "LwF2JmHnY3pc"
|
445 |
+
},
|
446 |
+
"outputs": [],
|
447 |
+
"source": [
|
448 |
+
"\n",
|
449 |
+
"def run_customer_support(query: str)->Dict[str, str]:\n",
|
450 |
+
" results = app.invoke({\"query\": query})\n",
|
451 |
+
" return {\n",
|
452 |
+
" \"category\":results['category'],\n",
|
453 |
+
" \"sentiment\":results['sentiment'],\n",
|
454 |
+
" \"response\": results['response']\n",
|
455 |
+
" }"
|
456 |
+
]
|
457 |
+
},
|
458 |
+
{
|
459 |
+
"cell_type": "code",
|
460 |
+
"execution_count": 9,
|
461 |
+
"metadata": {
|
462 |
+
"colab": {
|
463 |
+
"base_uri": "https://localhost:8080/"
|
464 |
+
},
|
465 |
+
"id": "e93hSTmZZfqz",
|
466 |
+
"outputId": "3c9e2f22-83bd-44ad-983b-9373d13d0838"
|
467 |
+
},
|
468 |
+
"outputs": [
|
469 |
+
{
|
470 |
+
"name": "stdout",
|
471 |
+
"output_type": "stream",
|
472 |
+
"text": [
|
473 |
+
"Query: my laptop is not charging what should i do?\n",
|
474 |
+
"Category : The customer query \"my laptop is not charging what should i do?\" can be categorized as: Technical.\n",
|
475 |
+
"\n",
|
476 |
+
"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",
|
477 |
+
"Sentiment : Neutral. \n",
|
478 |
+
"\n",
|
479 |
+
"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",
|
480 |
+
"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",
|
481 |
+
"\n",
|
482 |
+
"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",
|
483 |
+
"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",
|
484 |
+
"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",
|
485 |
+
"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",
|
486 |
+
"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",
|
487 |
+
"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",
|
488 |
+
"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",
|
489 |
+
"\n",
|
490 |
+
"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",
|
491 |
+
"\n",
|
492 |
+
"* **Contact the manufacturer's support**: Reach out to the laptop manufacturer's support team for further assistance or to schedule a repair.\n",
|
493 |
+
"* **Visit a authorized service center**: Take your laptop to an authorized service center for a professional diagnosis and repair.\n",
|
494 |
+
"\n",
|
495 |
+
"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",
|
496 |
+
"\n",
|
497 |
+
"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"
|
498 |
+
]
|
499 |
+
}
|
500 |
+
],
|
501 |
+
"source": [
|
502 |
+
"query = \"my laptop is not charging what should i do?\"\n",
|
503 |
+
"result = run_customer_support(query)\n",
|
504 |
+
"print(f\"Query: {query}\")\n",
|
505 |
+
"print(f\"Category : {result['category']}\")\n",
|
506 |
+
"print(f\"Sentiment : {result['sentiment']}\")\n",
|
507 |
+
"print(f\"Response : {result['response']}\")"
|
508 |
+
]
|
509 |
+
},
|
510 |
+
{
|
511 |
+
"cell_type": "code",
|
512 |
+
"execution_count": 11,
|
513 |
+
"metadata": {},
|
514 |
+
"outputs": [
|
515 |
+
{
|
516 |
+
"name": "stdout",
|
517 |
+
"output_type": "stream",
|
518 |
+
"text": [
|
519 |
+
"Running on local URL: http://127.0.0.1:7861\n"
|
520 |
+
]
|
521 |
+
},
|
522 |
+
{
|
523 |
+
"name": "stderr",
|
524 |
+
"output_type": "stream",
|
525 |
+
"text": [
|
526 |
+
"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",
|
527 |
+
"--------\n",
|
528 |
+
" warnings.warn(\n"
|
529 |
+
]
|
530 |
+
},
|
531 |
+
{
|
532 |
+
"name": "stdout",
|
533 |
+
"output_type": "stream",
|
534 |
+
"text": [
|
535 |
+
"Running on public URL: https://8550729e4374b9f3d6.gradio.live\n",
|
536 |
+
"\n",
|
537 |
+
"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"
|
538 |
+
]
|
539 |
+
},
|
540 |
+
{
|
541 |
+
"data": {
|
542 |
+
"text/html": [
|
543 |
+
"<div><iframe src=\"https://8550729e4374b9f3d6.gradio.live\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
544 |
+
],
|
545 |
+
"text/plain": [
|
546 |
+
"<IPython.core.display.HTML object>"
|
547 |
+
]
|
548 |
+
},
|
549 |
+
"metadata": {},
|
550 |
+
"output_type": "display_data"
|
551 |
+
}
|
552 |
+
],
|
553 |
+
"source": [
|
554 |
+
"import gradio as gr\n",
|
555 |
+
"\n",
|
556 |
+
"# Define the function that integrates the workflow.\n",
|
557 |
+
"def run_customer_support(query: str) -> Dict[str, str]:\n",
|
558 |
+
" results = app.invoke({\"query\": query})\n",
|
559 |
+
" return {\n",
|
560 |
+
" \"Category\": results['category'],\n",
|
561 |
+
" \"Sentiment\": results['sentiment'],\n",
|
562 |
+
" \"Response\": results['response']\n",
|
563 |
+
" }\n",
|
564 |
+
"\n",
|
565 |
+
"# Create the Gradio interface\n",
|
566 |
+
"def gradio_interface(query: str):\n",
|
567 |
+
" result = run_customer_support(query)\n",
|
568 |
+
" return (\n",
|
569 |
+
" f\"**Category:** {result['Category']}\\n\\n\"\n",
|
570 |
+
" f\"**Sentiment:** {result['Sentiment']}\\n\\n\"\n",
|
571 |
+
" f\"**Response:** {result['Response']}\"\n",
|
572 |
+
" )\n",
|
573 |
+
"\n",
|
574 |
+
"# Build the Gradio app\n",
|
575 |
+
"gui = gr.Interface(\n",
|
576 |
+
" fn=gradio_interface,\n",
|
577 |
+
" theme='Yntec/HaleyCH_Theme_Orange_Green',\n",
|
578 |
+
" inputs=gr.Textbox(lines=2, placeholder=\"Enter your query here...\"),\n",
|
579 |
+
" outputs=gr.Markdown(),\n",
|
580 |
+
" title=\"Customer Support Assistant\",\n",
|
581 |
+
" description=\"Provide a query and receive a categorized response. The system analyzes sentiment and routes to the appropriate support channel.\",\n",
|
582 |
+
")\n",
|
583 |
+
"\n",
|
584 |
+
"# Launch the app\n",
|
585 |
+
"if __name__ == \"__main__\":\n",
|
586 |
+
" gui.launch(share=True)\n"
|
587 |
+
]
|
588 |
+
},
|
589 |
+
{
|
590 |
+
"cell_type": "code",
|
591 |
+
"execution_count": null,
|
592 |
+
"metadata": {},
|
593 |
+
"outputs": [],
|
594 |
+
"source": []
|
595 |
+
}
|
596 |
+
],
|
597 |
+
"metadata": {
|
598 |
+
"accelerator": "GPU",
|
599 |
+
"colab": {
|
600 |
+
"gpuType": "T4",
|
601 |
+
"provenance": []
|
602 |
+
},
|
603 |
+
"kernelspec": {
|
604 |
+
"display_name": "Python 3",
|
605 |
+
"name": "python3"
|
606 |
+
},
|
607 |
+
"language_info": {
|
608 |
+
"codemirror_mode": {
|
609 |
+
"name": "ipython",
|
610 |
+
"version": 3
|
611 |
+
},
|
612 |
+
"file_extension": ".py",
|
613 |
+
"mimetype": "text/x-python",
|
614 |
+
"name": "python",
|
615 |
+
"nbconvert_exporter": "python",
|
616 |
+
"pygments_lexer": "ipython3",
|
617 |
+
"version": "3.11.4"
|
618 |
+
}
|
619 |
+
},
|
620 |
+
"nbformat": 4,
|
621 |
+
"nbformat_minor": 0
|
622 |
+
}
|