Commit 59e58e25 by Izma Aziz

updating code

parent e4c99781
......@@ -29,7 +29,7 @@
"outputs": [],
"source": [
"# Necessary installations\n",
"!pip install -q langchain-openai chromadb gradio"
"!pip install -q langchain-openai chromadb gradio langchain python-dotenv"
]
},
{
......@@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
......@@ -106,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"id": "BRViMDlpMMWl"
},
......@@ -134,7 +134,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [
{
......@@ -143,7 +143,7 @@
"True"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
......@@ -158,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
......@@ -182,22 +182,22 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from langchain.vectorstores import Chroma"
"from langchain_community.vectorstores import Chroma"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"# Create a Chroma vector store from the previously split documents and using the specified embeddings\n",
"vectorstore = Chroma.from_documents(\n",
" documents=chunks, # Split documents for vectorization\n",
" documents=chunks, # Split documents for vectorization\n",
" embedding=embeddings_model # Embeddings instance for encoding\n",
" )"
]
......@@ -213,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {
"id": "jwgJMs8r51hA"
},
......@@ -250,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
......@@ -259,7 +259,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [
{
......@@ -293,7 +293,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
......@@ -322,7 +322,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
......@@ -331,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
......@@ -343,7 +343,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
......@@ -362,7 +362,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
......@@ -371,7 +371,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
......@@ -381,40 +381,23 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"Source 1 \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",
"Count: 0\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",
"**Vision**\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",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 2 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\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",
" - 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",
......@@ -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",
"\n",
"**Vision**\n",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 3 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\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",
"\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",
"\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",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 4 \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",
"Count: 3\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",
"Emma Thompson,\n",
"Chief Vision Officer (CVO),\n",
......@@ -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- 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",
"==================================================\n",
"\n",
"\n"
]
}
],
"source": [
"# printing the 4 chunks for understanding\n",
"for count,document in enumerate(relevant_docs):\n",
" # Extract page content and metadata\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",
"for count,doc in enumerate(relevant_docs):\n",
" print(\"Count: \",count)\n",
" print(\"Content: \", doc.page_content)\n",
" print(\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
......@@ -547,7 +500,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
......@@ -556,7 +509,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
......@@ -578,14 +531,14 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Running on local URL: http://127.0.0.1:7861\n",
"Running on local URL: http://127.0.0.1:7860\n",
"\n",
"To create a public link, set `share=True` in `launch()`.\n"
]
......@@ -593,7 +546,7 @@
{
"data": {
"text/html": [
"<div><iframe src=\"http://127.0.0.1:7861/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
"<div><iframe src=\"http://127.0.0.1:7860/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
......@@ -606,7 +559,7 @@
"data": {
"text/plain": []
},
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
......
......@@ -29,7 +29,7 @@
"outputs": [],
"source": [
"# Necessary installations\n",
"!pip install -q langchain-openai chromadb gradio"
"!pip install -q langchain-openai chromadb gradio langchain python-dotenv"
]
},
{
......@@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
......@@ -106,7 +106,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {
"id": "BRViMDlpMMWl"
},
......@@ -134,7 +134,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [
{
......@@ -143,7 +143,7 @@
"True"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
......@@ -158,7 +158,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
......@@ -182,16 +182,16 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"from langchain.vectorstores import Chroma"
"from langchain_community.vectorstores import Chroma"
]
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
......@@ -213,7 +213,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 13,
"metadata": {
"id": "jwgJMs8r51hA"
},
......@@ -250,7 +250,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
......@@ -259,7 +259,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {},
"outputs": [
{
......@@ -293,7 +293,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
......@@ -322,7 +322,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
......@@ -331,7 +331,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
......@@ -343,7 +343,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
......@@ -362,7 +362,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
......@@ -371,7 +371,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
......@@ -381,40 +381,23 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" \n",
"Source 1 \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",
"Count: 0\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",
"**Vision**\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",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 2 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\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",
" - 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",
......@@ -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",
"\n",
"**Vision**\n",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 3 \n",
"==================================================\n",
"File Name: Demo_Data_ShopEase.txt\n",
"==================================================\n",
"\n",
"Uploaded Source Content:\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",
"\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",
"\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",
"==================================================\n",
"\n",
"\n",
" \n",
"Source 4 \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",
"Count: 3\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",
"Emma Thompson,\n",
"Chief Vision Officer (CVO),\n",
......@@ -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- 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",
"==================================================\n",
"\n",
"\n"
]
}
],
"source": [
"# printing the 4 chunks for understanding\n",
"for count,document in enumerate(relevant_docs):\n",
" # Extract page content and metadata\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",
"for count,doc in enumerate(relevant_docs):\n",
" print(\"Count: \",count)\n",
" print(\"Content: \", doc.page_content)\n",
" print(\"\\n\")"
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
......@@ -547,7 +500,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
......@@ -556,7 +509,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
......@@ -578,7 +531,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"outputs": [
{
......@@ -606,7 +559,7 @@
"data": {
"text/plain": []
},
"execution_count": 24,
"execution_count": 26,
"metadata": {},
"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