Commit 1af5064b by Izma

Replace Building Simple and Efficient Chatbots Step-by-Step.ipynb

parent 5efda712
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Necessary installations\n", "# Necessary installations\n",
"!pip install -q langchain-openai chromadb gradio" "!pip install -q langchain-openai chromadb gradio langchain python-dotenv"
] ]
}, },
{ {
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 7,
"metadata": { "metadata": {
"id": "BRViMDlpMMWl" "id": "BRViMDlpMMWl"
}, },
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
"True" "True"
] ]
}, },
"execution_count": 7, "execution_count": 9,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -182,16 +182,16 @@ ...@@ -182,16 +182,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from langchain.vectorstores import Chroma" "from langchain_community.vectorstores import Chroma"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 13,
"metadata": { "metadata": {
"id": "jwgJMs8r51hA" "id": "jwgJMs8r51hA"
}, },
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -322,7 +322,7 @@ ...@@ -322,7 +322,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -343,7 +343,7 @@ ...@@ -343,7 +343,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -371,7 +371,7 @@ ...@@ -371,7 +371,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -381,40 +381,23 @@ ...@@ -381,40 +381,23 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
" \n", "Count: 0\n",
"Source 1 \n", "Content: These core values serve as the guiding principles that shape our culture, drive our actions, and define our identity as a company committed to serving our customers, employees, and communities with integrity, innovation, and sustainability.\n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\n",
"==================================================\n",
"\n",
" These core values serve as the guiding principles that shape our culture, drive our actions, and define our identity as a company committed to serving our customers, employees, and communities with integrity, innovation, and sustainability.\n",
"\n", "\n",
"**Vision**\n", "**Vision**\n",
"\n", "\n",
"At ShopEase, our vision is clear: we aspire to become the preferred destination for online shopping, renowned for our exceptional customer service, diverse product selection, and unwavering commitment to sustainability. We are dedicated to continually expanding our offerings and reaching new markets, all while upholding our core values and cultivating long-term relationships with our customers.\n", "At ShopEase, our vision is clear: we aspire to become the preferred destination for online shopping, renowned for our exceptional customer service, diverse product selection, and unwavering commitment to sustainability. We are dedicated to continually expanding our offerings and reaching new markets, all while upholding our core values and cultivating long-term relationships with our customers.\n",
"==================================================\n",
"\n",
"\n", "\n",
" \n",
"Source 2 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\n",
"==================================================\n",
"\n", "\n",
" 3. Innovation:\n", "Count: 1\n",
"Content: 3. Innovation:\n",
" - Innovation is key to staying ahead in the ever-evolving retail landscape, and at ShopEase, we embrace a culture of continuous innovation.\n", " - Innovation is key to staying ahead in the ever-evolving retail landscape, and at ShopEase, we embrace a culture of continuous innovation.\n",
" - We encourage creativity, experimentation, and out-of-the-box thinking to drive new ideas, products, and solutions that address emerging customer needs and trends.\n", " - We encourage creativity, experimentation, and out-of-the-box thinking to drive new ideas, products, and solutions that address emerging customer needs and trends.\n",
" - Our dedicated research and development teams are constantly exploring new technologies, trends, and market insights to innovate and improve our offerings, keeping us at the forefront of the industry.\n", " - Our dedicated research and development teams are constantly exploring new technologies, trends, and market insights to innovate and improve our offerings, keeping us at the forefront of the industry.\n",
...@@ -432,37 +415,19 @@ ...@@ -432,37 +415,19 @@
"These core values serve as the guiding principles that shape our culture, drive our actions, and define our identity as a company committed to serving our customers, employees, and communities with integrity, innovation, and sustainability.\n", "These core values serve as the guiding principles that shape our culture, drive our actions, and define our identity as a company committed to serving our customers, employees, and communities with integrity, innovation, and sustainability.\n",
"\n", "\n",
"**Vision**\n", "**Vision**\n",
"==================================================\n",
"\n",
"\n", "\n",
" \n",
"Source 3 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\n",
"==================================================\n",
"\n", "\n",
" In pursuit of our vision, we aim to:\n", "Count: 2\n",
"Content: In pursuit of our vision, we aim to:\n",
"\t1. Provide Exceptional Customer Service: We prioritize customer satisfaction above all else, striving to exceed expectations at every touchpoint. Our dedicated team is committed to delivering personalized support and assistance to ensure a seamless shopping experience for every customer.\n", "\t1. Provide Exceptional Customer Service: We prioritize customer satisfaction above all else, striving to exceed expectations at every touchpoint. Our dedicated team is committed to delivering personalized support and assistance to ensure a seamless shopping experience for every customer.\n",
"\t2. Offer Diverse Product Selection: We understand that every shopper is unique, which is why we curate a diverse range of products across various categories to cater to different tastes, preferences, and needs. From the latest gadgets to trendy fashion items and home essentials, ShopEase offers something for everyone.\n", "\t2. Offer Diverse Product Selection: We understand that every shopper is unique, which is why we curate a diverse range of products across various categories to cater to different tastes, preferences, and needs. From the latest gadgets to trendy fashion items and home essentials, ShopEase offers something for everyone.\n",
"\t3. Champion Sustainability: We recognize our responsibility to minimize our environmental impact and promote sustainable practices throughout our operations. From eco-friendly packaging to sourcing products from environmentally responsible suppliers, we are committed to reducing our carbon footprint and preserving the planet for future generations.\n", "\t3. Champion Sustainability: We recognize our responsibility to minimize our environmental impact and promote sustainable practices throughout our operations. From eco-friendly packaging to sourcing products from environmentally responsible suppliers, we are committed to reducing our carbon footprint and preserving the planet for future generations.\n",
"\t4. Expand Offerings and Reach New Markets: As a dynamic and forward-thinking company, we are constantly seeking opportunities to expand our product offerings and reach new markets. Whether through strategic partnerships, innovative marketing initiatives, or geographic expansion, we are committed to growing our brand and serving customers around the world.\n", "\t4. Expand Offerings and Reach New Markets: As a dynamic and forward-thinking company, we are constantly seeking opportunities to expand our product offerings and reach new markets. Whether through strategic partnerships, innovative marketing initiatives, or geographic expansion, we are committed to growing our brand and serving customers around the world.\n",
"\t5. Uphold Core Values and Foster Long-Term Relationships: Our success is built on a foundation of integrity, innovation, teamwork, and sustainability. We remain steadfast in our commitment to these core values, which guide our decision-making and interactions with customers, partners, and stakeholders. By prioritizing honesty, transparency, and trust, we aim to cultivate long-term relationships built on mutual respect and shared values.\n", "\t5. Uphold Core Values and Foster Long-Term Relationships: Our success is built on a foundation of integrity, innovation, teamwork, and sustainability. We remain steadfast in our commitment to these core values, which guide our decision-making and interactions with customers, partners, and stakeholders. By prioritizing honesty, transparency, and trust, we aim to cultivate long-term relationships built on mutual respect and shared values.\n",
"==================================================\n",
"\n", "\n",
"\n", "\n",
" \n", "Count: 3\n",
"Source 4 \n", "Content: As we work towards achieving our vision, we invite you to join us on this journey of innovation, sustainability, and customer-centricity. Together, we can shape the future of online shopping and create lasting value for our customers and communities.\n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\n",
"==================================================\n",
"\n",
" As we work towards achieving our vision, we invite you to join us on this journey of innovation, sustainability, and customer-centricity. Together, we can shape the future of online shopping and create lasting value for our customers and communities.\n",
"\n", "\n",
"Emma Thompson,\n", "Emma Thompson,\n",
"Chief Vision Officer (CVO),\n", "Chief Vision Officer (CVO),\n",
...@@ -483,33 +448,21 @@ ...@@ -483,33 +448,21 @@
"\t- Clothing: Elevate your wardrobe with stylish apparel for men, women, and children. From casual basics to formal attire, we offer a diverse range of clothing options from popular brands and designers.\n", "\t- Clothing: Elevate your wardrobe with stylish apparel for men, women, and children. From casual basics to formal attire, we offer a diverse range of clothing options from popular brands and designers.\n",
"\t- Shoes: Step out in style with our collection of footwear, including sneakers, boots, sandals, heels, and more. Find the perfect pair to complement any outfit and occasion.\n", "\t- Shoes: Step out in style with our collection of footwear, including sneakers, boots, sandals, heels, and more. Find the perfect pair to complement any outfit and occasion.\n",
" \t- Accessories: Complete your look with our selection of fashion accessories, including handbags, wallets, belts, scarves, hats, and jewelry. Add the perfect finishing touch to any ensemble.\n", " \t- Accessories: Complete your look with our selection of fashion accessories, including handbags, wallets, belts, scarves, hats, and jewelry. Add the perfect finishing touch to any ensemble.\n",
"==================================================\n",
"\n", "\n",
"\n" "\n"
] ]
} }
], ],
"source": [ "source": [
"# printing the 4 chunks for understanding\n", "for count,doc in enumerate(relevant_docs):\n",
"for count,document in enumerate(relevant_docs):\n", " print(\"Count: \",count)\n",
" # Extract page content and metadata\n", " print(\"Content: \", doc.page_content)\n",
" page_content = document.page_content\n",
" file_name = document.metadata['source']\n",
"\n",
" print((f\"\\nSource {count+1}\").center(50))\n",
" print(\"=\" * 50)\n",
" print(f\"File Name: {file_name}\")\n",
" print(\"=\" * 50)\n",
" print((\"\\nUploaded Source Content:\"))\n",
" print(\"=\" * 50)\n",
" print(\"\\n\",page_content)\n",
" print(\"=\" * 50)\n",
" print(\"\\n\")" " print(\"\\n\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -547,7 +500,7 @@ ...@@ -547,7 +500,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -556,7 +509,7 @@ ...@@ -556,7 +509,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -578,7 +531,7 @@ ...@@ -578,7 +531,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -606,7 +559,7 @@ ...@@ -606,7 +559,7 @@
"data": { "data": {
"text/plain": [] "text/plain": []
}, },
"execution_count": 24, "execution_count": 26,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment