GaganaMD commited on
Commit
9f9892f
1 Parent(s): d69b928

Upload 6 files

Browse files
Files changed (5) hide show
  1. .gitattributes +2 -35
  2. .gitignore +1 -0
  3. README.md +2 -12
  4. langchain.ipynb +544 -0
  5. requirements.txt +5 -0
.gitattributes CHANGED
@@ -1,35 +1,2 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
- *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ venv/
README.md CHANGED
@@ -1,12 +1,2 @@
1
- ---
2
- title: End To End Chatbot Using LangChain
3
- emoji: 🏢
4
- colorFrom: gray
5
- colorTo: green
6
- sdk: streamlit
7
- sdk_version: 1.28.2
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # End-to-end chatbot using LangChain
2
+
 
 
 
 
 
 
 
 
 
 
langchain.ipynb ADDED
@@ -0,0 +1,544 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 2,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "from langchain.llms import OpenAI"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": 3,
15
+ "metadata": {},
16
+ "outputs": [],
17
+ "source": [
18
+ "import os\n"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": 4,
24
+ "metadata": {},
25
+ "outputs": [],
26
+ "source": [
27
+ "llm = OpenAI(temperature=0.6)"
28
+ ]
29
+ },
30
+ {
31
+ "cell_type": "code",
32
+ "execution_count": 5,
33
+ "metadata": {},
34
+ "outputs": [
35
+ {
36
+ "name": "stdout",
37
+ "output_type": "stream",
38
+ "text": [
39
+ "\n",
40
+ "\n",
41
+ "The capital of India is New Delhi.\n"
42
+ ]
43
+ }
44
+ ],
45
+ "source": [
46
+ "text=\"What is the capital of India\"\n",
47
+ "\n",
48
+ "print(llm.predict(text))"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": 6,
54
+ "metadata": {},
55
+ "outputs": [
56
+ {
57
+ "data": {
58
+ "text/plain": [
59
+ "'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'"
60
+ ]
61
+ },
62
+ "execution_count": 6,
63
+ "metadata": {},
64
+ "output_type": "execute_result"
65
+ }
66
+ ],
67
+ "source": [
68
+ "os.environ[\"HUGGINGFACEHUB_API_TOKEN\"]"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 7,
74
+ "metadata": {},
75
+ "outputs": [
76
+ {
77
+ "name": "stderr",
78
+ "output_type": "stream",
79
+ "text": [
80
+ "C:\\Users\\gagan\\AppData\\Roaming\\Python\\Python39\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
81
+ " from .autonotebook import tqdm as notebook_tqdm\n",
82
+ "d:\\Research\\End-to-end-chatbot-using-LangChain\\venv\\lib\\site-packages\\huggingface_hub\\utils\\_deprecation.py:127: FutureWarning: '__init__' (from 'huggingface_hub.inference_api') is deprecated and will be removed from version '1.0'. `InferenceApi` client is deprecated in favor of the more feature-complete `InferenceClient`. Check out this guide to learn how to convert your script to use it: https://huggingface.co/docs/huggingface_hub/guides/inference#legacy-inferenceapi-client.\n",
83
+ " warnings.warn(warning_message, FutureWarning)\n"
84
+ ]
85
+ }
86
+ ],
87
+ "source": [
88
+ "from langchain import HuggingFaceHub\n",
89
+ "\n",
90
+ "llm_huggingface = HuggingFaceHub(repo_id = \"google/flan-t5-large\",\n",
91
+ " model_kwargs = {\"temperature\":0,\"max_length\":64},\n",
92
+ " huggingfacehub_api_token=os.getenv(\"HUGGINGFACEHUB_API_TOKEN\"))\n"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "code",
97
+ "execution_count": 8,
98
+ "metadata": {},
99
+ "outputs": [
100
+ {
101
+ "name": "stdout",
102
+ "output_type": "stream",
103
+ "text": [
104
+ "moscow\n"
105
+ ]
106
+ }
107
+ ],
108
+ "source": [
109
+ "output=llm_huggingface.predict(\"Can you tell me the capital of Russia\")\n",
110
+ "print(output)"
111
+ ]
112
+ },
113
+ {
114
+ "cell_type": "code",
115
+ "execution_count": 9,
116
+ "metadata": {},
117
+ "outputs": [
118
+ {
119
+ "name": "stdout",
120
+ "output_type": "stream",
121
+ "text": [
122
+ "i love the way i look at the world i love the way i feel i love the way i think i feel i love the way i feel i love the way i think i feel i love the way i feel i love the way \n"
123
+ ]
124
+ }
125
+ ],
126
+ "source": [
127
+ "\n",
128
+ "output=llm_huggingface.predict(\"Can you write a poem about AI\")\n",
129
+ "print(output)"
130
+ ]
131
+ },
132
+ {
133
+ "cell_type": "code",
134
+ "execution_count": 10,
135
+ "metadata": {},
136
+ "outputs": [
137
+ {
138
+ "data": {
139
+ "text/plain": [
140
+ "\"\\n\\nAn AI so complex, so far ahead\\nIt's learning is so strong, it fills us with dread\\nIt's knowledge of the world, it knows so well\\nIt's capabilities, no one can tell\\n\\nIt's technology, it's so advanced\\nIt's powers, they are so immense\\nIt's applications, they are so vast\\nIt's future, it is so immense\\n\\nIt's predictions, they are so smart\\nIt's decisions, they are so wise\\nIt's future, it seems so bright\\nIt's potential, it never dies\\n\\nIt's learning, it's so strong\\nIt's power, it never fades\\nIt's knowledge, it never fails\\nIt's wisdom, it never fades\\n\\nAI, so complex, so far ahead\\nIt's learning is so strong, it fills us with dread.\""
141
+ ]
142
+ },
143
+ "execution_count": 10,
144
+ "metadata": {},
145
+ "output_type": "execute_result"
146
+ }
147
+ ],
148
+ "source": [
149
+ "llm.predict(\"Can you write a poem about AI\")"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "markdown",
154
+ "metadata": {},
155
+ "source": [
156
+ "## PROMPT TEMPALATES"
157
+ ]
158
+ },
159
+ {
160
+ "cell_type": "code",
161
+ "execution_count": 11,
162
+ "metadata": {},
163
+ "outputs": [
164
+ {
165
+ "data": {
166
+ "text/plain": [
167
+ "'Tell me the capital of this India'"
168
+ ]
169
+ },
170
+ "execution_count": 11,
171
+ "metadata": {},
172
+ "output_type": "execute_result"
173
+ }
174
+ ],
175
+ "source": [
176
+ "from langchain.prompts import PromptTemplate\n",
177
+ "\n",
178
+ "prompt_template=PromptTemplate(input_variables=['country'],\n",
179
+ "template=\"Tell me the capital of this {country}\")\n",
180
+ "\n",
181
+ "prompt_template.format(country=\"India\")"
182
+ ]
183
+ },
184
+ {
185
+ "cell_type": "code",
186
+ "execution_count": 12,
187
+ "metadata": {},
188
+ "outputs": [
189
+ {
190
+ "name": "stdout",
191
+ "output_type": "stream",
192
+ "text": [
193
+ "\n",
194
+ "\n",
195
+ "The capital of India is New Delhi.\n"
196
+ ]
197
+ }
198
+ ],
199
+ "source": [
200
+ "\n",
201
+ "from langchain.chains import LLMChain\n",
202
+ "chain=LLMChain(llm=llm,prompt=prompt_template)\n",
203
+ "print(chain.run(\"India\"))"
204
+ ]
205
+ },
206
+ {
207
+ "cell_type": "markdown",
208
+ "metadata": {},
209
+ "source": [
210
+ "## Combining Multiple Chains USing simple Sequential Chain"
211
+ ]
212
+ },
213
+ {
214
+ "cell_type": "code",
215
+ "execution_count": 13,
216
+ "metadata": {},
217
+ "outputs": [],
218
+ "source": [
219
+ "capital_template=PromptTemplate(input_variables=['country'],\n",
220
+ "template=\"Please tell me the capital of the {country}\")\n",
221
+ "\n",
222
+ "capital_chain=LLMChain(llm=llm,prompt=capital_template)\n",
223
+ "\n",
224
+ "famous_template=PromptTemplate(input_variables=['capital'],\n",
225
+ "template=\"Suggest me some amazing places to visit in {capital}\")"
226
+ ]
227
+ },
228
+ {
229
+ "cell_type": "code",
230
+ "execution_count": 14,
231
+ "metadata": {},
232
+ "outputs": [],
233
+ "source": [
234
+ "famous_chain=LLMChain(llm=llm,prompt=famous_template)"
235
+ ]
236
+ },
237
+ {
238
+ "cell_type": "code",
239
+ "execution_count": 16,
240
+ "metadata": {},
241
+ "outputs": [
242
+ {
243
+ "data": {
244
+ "text/plain": [
245
+ "\"\\n\\n1. India Gate: This majestic monument stands tall in the heart of the city and is a symbol of India's rich history.\\n\\n2. Red Fort: This iconic fort was built by Mughal Emperor Shah Jahan in 1638 and is a UNESCO World Heritage Site.\\n\\n3. Humayun's Tomb: Built in 1570, this is an impressive example of Mughal architecture.\\n\\n4. Jama Masjid: This grand mosque was built in 1656 by the Mughal Emperor Shah Jahan.\\n\\n5. Qutub Minar: This towering structure is a UNESCO World Heritage Site and is the tallest minaret in India.\\n\\n6. Akshardham Temple: Built in 2005, this is a Hindu temple complex with ornate architecture and sculptures.\\n\\n7. Chandni Chowk: This bustling old marketplace is a great place to explore and shop for traditional items.\\n\\n8. Lotus Temple: This beautiful temple is a Bahá'í House of Worship and is open to all religions.\\n\\n9. National Zoological Park: This is a great place to visit and observe various species of animals.\\n\\n10. Lodi Gardens: This public park is a great place\""
246
+ ]
247
+ },
248
+ "execution_count": 16,
249
+ "metadata": {},
250
+ "output_type": "execute_result"
251
+ }
252
+ ],
253
+ "source": [
254
+ "from langchain.chains import SimpleSequentialChain\n",
255
+ "chain=SimpleSequentialChain(chains=[capital_chain,famous_chain])\n",
256
+ "chain.run(\"India\")"
257
+ ]
258
+ },
259
+ {
260
+ "cell_type": "markdown",
261
+ "metadata": {},
262
+ "source": [
263
+ "### SEQUENTIAL CHAINS"
264
+ ]
265
+ },
266
+ {
267
+ "cell_type": "code",
268
+ "execution_count": 17,
269
+ "metadata": {},
270
+ "outputs": [],
271
+ "source": [
272
+ "capital_template=PromptTemplate(input_variables=['country'],\n",
273
+ "template=\"Please tell me the capital of the {country}\")\n",
274
+ "\n",
275
+ "capital_chain=LLMChain(llm=llm,prompt=capital_template,output_key=\"capital\")"
276
+ ]
277
+ },
278
+ {
279
+ "cell_type": "code",
280
+ "execution_count": 18,
281
+ "metadata": {},
282
+ "outputs": [],
283
+ "source": [
284
+ "famous_template=PromptTemplate(input_variables=['capital'],\n",
285
+ "template=\"Suggest me some amazing places to visit in {capital}\")\n",
286
+ "\n",
287
+ "famous_chain=LLMChain(llm=llm,prompt=famous_template,output_key=\"places\")"
288
+ ]
289
+ },
290
+ {
291
+ "cell_type": "code",
292
+ "execution_count": 27,
293
+ "metadata": {},
294
+ "outputs": [],
295
+ "source": [
296
+ "from langchain.chains import SequentialChain\n",
297
+ "chain=SequentialChain(chains=[capital_chain,famous_chain],\n",
298
+ "input_variables=['country'],\n",
299
+ "output_variables=['capital',\"places\"])"
300
+ ]
301
+ },
302
+ {
303
+ "cell_type": "code",
304
+ "execution_count": 29,
305
+ "metadata": {},
306
+ "outputs": [
307
+ {
308
+ "data": {
309
+ "text/plain": [
310
+ "{'country': 'India',\n",
311
+ " 'capital': '\\n\\nThe capital of India is New Delhi.',\n",
312
+ " 'places': \"\\n\\n1. India Gate: This iconic monument is a war memorial built in memory of the Indian soldiers who died in World War I. It is a popular tourist attraction and a symbol of India's rich history.\\n\\n2. Red Fort: The Red Fort was built by Mughal Emperor Shah Jahan in 1639 and is considered to be one of the most important monuments in India. It is a UNESCO World Heritage Site and is a major tourist attraction.\\n\\n3. Qutub Minar: This ancient monument was built in 1192 and is the tallest brick minaret in the world. It is a UNESCO World Heritage Site and is a popular tourist destination.\\n\\n4. Jama Masjid: This is one of the largest mosques in India and was built by Mughal Emperor Shah Jahan in 1656. It is a popular tourist attraction and a symbol of India's rich culture and history.\\n\\n5. Humayun's Tomb: This beautiful Mughal-era tomb was built by Humayun's widow in 1570. It is a UNESCO World Heritage Site and a popular tourist attraction.\\n\\n6. Akshardham Temple: This modern Hindu temple was built in 2005 and is a popular tourist attraction. It\"}"
313
+ ]
314
+ },
315
+ "execution_count": 29,
316
+ "metadata": {},
317
+ "output_type": "execute_result"
318
+ }
319
+ ],
320
+ "source": [
321
+ "chain({'country':\"India\"})\n"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "markdown",
326
+ "metadata": {},
327
+ "source": [
328
+ "## Chatmodels With ChatOpenAI"
329
+ ]
330
+ },
331
+ {
332
+ "cell_type": "code",
333
+ "execution_count": 30,
334
+ "metadata": {},
335
+ "outputs": [],
336
+ "source": [
337
+ "from langchain.chat_models import ChatOpenAI"
338
+ ]
339
+ },
340
+ {
341
+ "cell_type": "code",
342
+ "execution_count": 31,
343
+ "metadata": {},
344
+ "outputs": [],
345
+ "source": [
346
+ "from langchain.schema import HumanMessage,SystemMessage,AIMessage"
347
+ ]
348
+ },
349
+ {
350
+ "cell_type": "code",
351
+ "execution_count": 33,
352
+ "metadata": {},
353
+ "outputs": [],
354
+ "source": [
355
+ "chatllm=ChatOpenAI(openai_api_key=os.environ[\"OPENAI_API_KEY\"],temperature=0.6,model='gpt-3.5-turbo')"
356
+ ]
357
+ },
358
+ {
359
+ "cell_type": "code",
360
+ "execution_count": 34,
361
+ "metadata": {},
362
+ "outputs": [
363
+ {
364
+ "data": {
365
+ "text/plain": [
366
+ "AIMessage(content='1. \"Why did the AI go on a diet? It wanted to lose some unnecessary bytes!\"\\n\\n2. \"Why did the AI become a stand-up comedian? Because it had a knack for delivering byte-sized punchlines!\"\\n\\n3. \"Why did the AI break up with its robot partner? It realized it was just a case of artificial unintelligence!\"\\n\\n4. \"Why did the AI refuse to play poker? It couldn\\'t handle all the chips!\"\\n\\n5. \"Why did the AI join a band? Because it wanted to rock the binary!\"\\n\\n6. \"Why did the AI take up gardening? It wanted to see if it could grow a \\'byte\\'-iful garden!\"\\n\\n7. \"Why did the AI get a job at the bakery? It kneaded some dough to upgrade its processor!\"\\n\\n8. \"Why did the AI start a fitness routine? It wanted to work on its core algorithms!\"\\n\\n9. \"Why did the AI go to the comedy club? It wanted to learn the art of artificial laughter!\"\\n\\n10. \"Why did the AI become a magician? It loved pulling data out of thin air!\"')"
367
+ ]
368
+ },
369
+ "execution_count": 34,
370
+ "metadata": {},
371
+ "output_type": "execute_result"
372
+ }
373
+ ],
374
+ "source": [
375
+ "chatllm([\n",
376
+ "SystemMessage(content=\"Yor are a comedian AI assitant\"),\n",
377
+ "HumanMessage(content=\"Please provide some comedy punchlines on AI\")\n",
378
+ "])"
379
+ ]
380
+ },
381
+ {
382
+ "cell_type": "markdown",
383
+ "metadata": {},
384
+ "source": [
385
+ "### Prompt Template + LLM +Output Parsers"
386
+ ]
387
+ },
388
+ {
389
+ "cell_type": "code",
390
+ "execution_count": 35,
391
+ "metadata": {},
392
+ "outputs": [],
393
+ "source": [
394
+ "from langchain.chat_models import ChatOpenAI\n",
395
+ "from langchain.prompts.chat import ChatPromptTemplate\n",
396
+ "from langchain.schema import BaseOutputParser"
397
+ ]
398
+ },
399
+ {
400
+ "cell_type": "code",
401
+ "execution_count": 36,
402
+ "metadata": {},
403
+ "outputs": [],
404
+ "source": [
405
+ "class Commaseperatedoutput(BaseOutputParser):\n",
406
+ " def parse(self,text:str):\n",
407
+ " return text.strip().split(\",\")"
408
+ ]
409
+ },
410
+ {
411
+ "cell_type": "code",
412
+ "execution_count": 37,
413
+ "metadata": {},
414
+ "outputs": [],
415
+ "source": [
416
+ "template=\"Your are a helpful assistant. When the use given any input , you should generate 5 words synonyms in a comma seperated list\"\n",
417
+ "human_template=\"{text}\"\n",
418
+ "chatprompt=ChatPromptTemplate.from_messages([\n",
419
+ " (\"system\",template),\n",
420
+ " (\"human\",human_template)\n",
421
+ "\n",
422
+ "\n",
423
+ "])"
424
+ ]
425
+ },
426
+ {
427
+ "cell_type": "code",
428
+ "execution_count": 38,
429
+ "metadata": {},
430
+ "outputs": [],
431
+ "source": [
432
+ "chain=chatprompt|chatllm|Commaseperatedoutput()"
433
+ ]
434
+ },
435
+ {
436
+ "cell_type": "code",
437
+ "execution_count": 39,
438
+ "metadata": {},
439
+ "outputs": [
440
+ {
441
+ "data": {
442
+ "text/plain": [
443
+ "['smart', ' clever', ' brilliant', ' sharp', ' astute']"
444
+ ]
445
+ },
446
+ "execution_count": 39,
447
+ "metadata": {},
448
+ "output_type": "execute_result"
449
+ }
450
+ ],
451
+ "source": [
452
+ "chain.invoke({\"text\":\"intelligent\"})"
453
+ ]
454
+ },
455
+ {
456
+ "cell_type": "code",
457
+ "execution_count": 40,
458
+ "metadata": {},
459
+ "outputs": [
460
+ {
461
+ "data": {
462
+ "text/plain": [
463
+ "['adorable', ' charming', ' lovely', ' attractive', ' delightful']"
464
+ ]
465
+ },
466
+ "execution_count": 40,
467
+ "metadata": {},
468
+ "output_type": "execute_result"
469
+ }
470
+ ],
471
+ "source": [
472
+ "chain.invoke({\"text\":\"cute\"})"
473
+ ]
474
+ },
475
+ {
476
+ "cell_type": "code",
477
+ "execution_count": 41,
478
+ "metadata": {},
479
+ "outputs": [
480
+ {
481
+ "data": {
482
+ "text/plain": [
483
+ "['perceptive', ' shrewd', ' insightful', ' clever', ' sharp']"
484
+ ]
485
+ },
486
+ "execution_count": 41,
487
+ "metadata": {},
488
+ "output_type": "execute_result"
489
+ }
490
+ ],
491
+ "source": [
492
+ "chain.invoke({\"text\":\"astute\"})"
493
+ ]
494
+ },
495
+ {
496
+ "cell_type": "code",
497
+ "execution_count": 42,
498
+ "metadata": {},
499
+ "outputs": [
500
+ {
501
+ "data": {
502
+ "text/plain": [
503
+ "['beautiful', ' attractive', ' lovely', ' stunning', ' gorgeous']"
504
+ ]
505
+ },
506
+ "execution_count": 42,
507
+ "metadata": {},
508
+ "output_type": "execute_result"
509
+ }
510
+ ],
511
+ "source": [
512
+ "chain.invoke({\"text\":\"pretty\"})"
513
+ ]
514
+ },
515
+ {
516
+ "cell_type": "code",
517
+ "execution_count": null,
518
+ "metadata": {},
519
+ "outputs": [],
520
+ "source": []
521
+ }
522
+ ],
523
+ "metadata": {
524
+ "kernelspec": {
525
+ "display_name": "Python 3",
526
+ "language": "python",
527
+ "name": "python3"
528
+ },
529
+ "language_info": {
530
+ "codemirror_mode": {
531
+ "name": "ipython",
532
+ "version": 3
533
+ },
534
+ "file_extension": ".py",
535
+ "mimetype": "text/x-python",
536
+ "name": "python",
537
+ "nbconvert_exporter": "python",
538
+ "pygments_lexer": "ipython3",
539
+ "version": "3.9.0"
540
+ }
541
+ },
542
+ "nbformat": 4,
543
+ "nbformat_minor": 2
544
+ }
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+ python-dotenv
5
+ streamlit