├── LICENSE ├── README.md ├── data └── Adidas_final.csv ├── landing page gen.png ├── landingpage.ipynb └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Landing-Page-Generator-CrewAI-Qdrant-Langchain 2 | --------------------------------------------------------------------------------------------------------------------------- 3 | LLM Agents: Landing Page Generation for an E-commerce Platform Using CrewAI, Langchain and Qdrant 4 | #### Install required libraries using: 5 | 6 | ```python 7 | pip install -r requirements.txt 8 | ``` 9 | ------------------------------------------------------------------------------------------------------- 10 | ![](https://github.com/sachink1729/Landing-Page-Generator-CrewAI-Qdrant-Langchain/blob/main/landing%20page%20gen.png) 11 | -------------------------------------------------------------------------------- /landing page gen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sachink1729/LLM-Agent-Landing-Page-Generator-CrewAI-Qdrant-Langchain/daa3a9ee3be1138ddd12468997646cc2dc014d2a/landing page gen.png -------------------------------------------------------------------------------- /landingpage.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "# !pip install crewai[tools]\n", 10 | "# !pip install langchain\n", 11 | "# !pip install qdrant-client\n", 12 | "# !pip install langchain-groq\n", 13 | "# !pip install sentence-transformers" 14 | ] 15 | }, 16 | { 17 | "cell_type": "markdown", 18 | "metadata": {}, 19 | "source": [ 20 | "## Load data" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 13, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "import pandas as pd\n", 30 | "df = pd.read_csv(\"data/Adidas_final.csv\", sep=';')" 31 | ] 32 | }, 33 | { 34 | "cell_type": "code", 35 | "execution_count": 14, 36 | "metadata": {}, 37 | "outputs": [ 38 | { 39 | "name": "stdout", 40 | "output_type": "stream", 41 | "text": [ 42 | "\n", 43 | "RangeIndex: 2625 entries, 0 to 2624\n", 44 | "Data columns (total 12 columns):\n", 45 | " # Column Non-Null Count Dtype \n", 46 | "--- ------ -------------- ----- \n", 47 | " 0 URL 2625 non-null object\n", 48 | " 1 Product Name 2625 non-null object\n", 49 | " 2 Product ID 2625 non-null object\n", 50 | " 3 Listing Price 2625 non-null int64 \n", 51 | " 4 Sale Price 2625 non-null int64 \n", 52 | " 5 Discount 2625 non-null int64 \n", 53 | " 6 Brand 2625 non-null object\n", 54 | " 7 Description 2625 non-null object\n", 55 | " 8 Rating 2625 non-null int64 \n", 56 | " 9 Reviews 2625 non-null int64 \n", 57 | " 10 Images 2625 non-null object\n", 58 | " 11 Last Visited 2625 non-null object\n", 59 | "dtypes: int64(5), object(7)\n", 60 | "memory usage: 246.2+ KB\n" 61 | ] 62 | } 63 | ], 64 | "source": [ 65 | "df.info()" 66 | ] 67 | }, 68 | { 69 | "cell_type": "code", 70 | "execution_count": 15, 71 | "metadata": {}, 72 | "outputs": [ 73 | { 74 | "data": { 75 | "text/plain": [ 76 | "Brand\n", 77 | "CORE / NEO 1111\n", 78 | "ORIGINALS 908\n", 79 | "SPORT PERFORMANCE 606\n", 80 | "Name: count, dtype: int64" 81 | ] 82 | }, 83 | "execution_count": 15, 84 | "metadata": {}, 85 | "output_type": "execute_result" 86 | } 87 | ], 88 | "source": [ 89 | "df.Brand.value_counts()" 90 | ] 91 | }, 92 | { 93 | "cell_type": "code", 94 | "execution_count": 16, 95 | "metadata": {}, 96 | "outputs": [], 97 | "source": [ 98 | "def extended_descriptin(row):\n", 99 | " ex_desc = f\"Poduct Name: {row['Product Name'].strip()} \\nDescription of product: {row['Description'].strip()}\"\n", 100 | " return ex_desc" 101 | ] 102 | }, 103 | { 104 | "cell_type": "code", 105 | "execution_count": 17, 106 | "metadata": {}, 107 | "outputs": [], 108 | "source": [ 109 | "df['ExtendedDescription'] = df.apply(extended_descriptin, axis=1)" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "execution_count": 18, 115 | "metadata": {}, 116 | "outputs": [], 117 | "source": [ 118 | "texts = df['ExtendedDescription'].to_list()" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": 19, 124 | "metadata": {}, 125 | "outputs": [ 126 | { 127 | "name": "stdout", 128 | "output_type": "stream", 129 | "text": [ 130 | "Poduct Name: Women's adidas Originals NMD_Racer Primeknit Shoes \n", 131 | "Description of product: Channeling the streamlined look of an '80s racer, these shoes are updated with modern features. The foot-hugging adidas Primeknit upper offers a soft, breathable feel. The Boost midsole provides responsive comfort accented with a contrast-color EVA heel plug. Embroidered details add a distinctive finish. \n", 132 | "\n" 133 | ] 134 | } 135 | ], 136 | "source": [ 137 | "print(texts[0],\"\\n\")" 138 | ] 139 | }, 140 | { 141 | "cell_type": "markdown", 142 | "metadata": {}, 143 | "source": [ 144 | "## Encode Texts" 145 | ] 146 | }, 147 | { 148 | "cell_type": "code", 149 | "execution_count": 20, 150 | "metadata": {}, 151 | "outputs": [ 152 | { 153 | "name": "stderr", 154 | "output_type": "stream", 155 | "text": [ 156 | "c:\\Users\\ASUS\\anaconda3\\envs\\new\\lib\\site-packages\\huggingface_hub\\file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.\n", 157 | " warnings.warn(\n", 158 | "c:\\Users\\ASUS\\anaconda3\\envs\\new\\lib\\site-packages\\transformers\\models\\bert\\modeling_bert.py:435: UserWarning: 1Torch was not compiled with flash attention. (Triggered internally at ..\\aten\\src\\ATen\\native\\transformers\\cuda\\sdp_utils.cpp:263.)\n", 159 | " attn_output = torch.nn.functional.scaled_dot_product_attention(\n" 160 | ] 161 | } 162 | ], 163 | "source": [ 164 | "import torch\n", 165 | "from sentence_transformers import SentenceTransformer\n", 166 | "device_to_use = torch.device('cuda') if torch.cuda.is_available() else \"cpu\"\n", 167 | "model = SentenceTransformer(\"BAAI/bge-large-en-v1.5\", device=device_to_use)\n", 168 | "vectors = model.encode(texts)" 169 | ] 170 | }, 171 | { 172 | "cell_type": "markdown", 173 | "metadata": {}, 174 | "source": [ 175 | "## Qdrant Setup" 176 | ] 177 | }, 178 | { 179 | "cell_type": "code", 180 | "execution_count": 21, 181 | "metadata": {}, 182 | "outputs": [ 183 | { 184 | "name": "stderr", 185 | "output_type": "stream", 186 | "text": [ 187 | "C:\\Users\\ASUS\\AppData\\Local\\Temp\\ipykernel_7148\\2675290693.py:7: DeprecationWarning: `recreate_collection` method is deprecated and will be removed in the future. Use `collection_exists` to check collection existence and `create_collection` instead.\n", 188 | " client.recreate_collection(\n" 189 | ] 190 | } 191 | ], 192 | "source": [ 193 | "from qdrant_client import QdrantClient\n", 194 | "from qdrant_client.models import Distance, VectorParams\n", 195 | "\n", 196 | "# Initialize the client\n", 197 | "\n", 198 | "client = QdrantClient(\":memory:\",)\n", 199 | "client.recreate_collection(\n", 200 | " collection_name=\"adidas_products\",\n", 201 | " vectors_config=VectorParams(size=1024, distance=Distance.COSINE),\n", 202 | ")\n", 203 | "\n", 204 | "client.upload_collection(\n", 205 | " collection_name=\"adidas_products\",\n", 206 | " ids=[i for i in range(len(texts))],\n", 207 | " vectors=vectors,\n", 208 | " parallel=4,\n", 209 | " max_retries=3,\n", 210 | ")" 211 | ] 212 | }, 213 | { 214 | "cell_type": "code", 215 | "execution_count": 28, 216 | "metadata": {}, 217 | "outputs": [], 218 | "source": [ 219 | "def get_matches(text):\n", 220 | " query_vector = model.encode(text)\n", 221 | " hits = client.search(\n", 222 | " collection_name=\"adidas_products\",\n", 223 | " query_vector=query_vector,\n", 224 | " limit=20 # Return 20 closest points\n", 225 | " )\n", 226 | " products = list(set([df['Product Name'][i.id] for i in hits]))\n", 227 | " descriptions = list(set([df['Description'][i.id] for i in hits]))\n", 228 | " desc=\"\"\n", 229 | " pdts=\"\"\n", 230 | " for x, y in zip(descriptions, products):\n", 231 | " desc = desc + x + \"\\n\"\n", 232 | " pdts = pdts + y + ', '\n", 233 | " return desc, pdts" 234 | ] 235 | }, 236 | { 237 | "cell_type": "code", 238 | "execution_count": 29, 239 | "metadata": {}, 240 | "outputs": [ 241 | { 242 | "name": "stdout", 243 | "output_type": "stream", 244 | "text": [ 245 | "(\"Tennis-inspired style with a modern look. These men's shoes have the soft feel of a suede upper. A rubber cupsole gives comfort and ease to every stride.\\nKeep your cool when it's all on the line. These lightweight tennis shoes have a breathable mesh upper to keep air circulating when the heat is on. Their foot-hugging construction and supportive chassis offer a stable feel. The durable outsole gives a firm grip with every serve and slide as you improve your game.\\nServe up some style when you hit the club. The full synthetic upper provides unmatched durability. A cushioned EVA midsole keeps you comfortable from the moment you pull them on. The durable outsole stands up to every serve and slide as you improve your game.\\nYou play every single day so you need a shoe that's both durable and comfortable. These adidas tennis shoes have a cushioned midsole for enhanced comfort whether you're working on your groundstroke or playing best-of-five. A durable and supportive build lets you play on any type of court surface.\\nStay patient and consistent on the court. These adidas tennis shoes feature a breathable mesh upper that hugs your foot, locking you in as you step into every swing. Return serve in comfort. Stay on your toes and change directions in an instant.\\nThese tennis-inspired shoes elevate their style game off the court with a knit upper and decorative laces. The slip-on look has a seamless, sock-like construction with an ultra-soft Cloudfoam sockliner for added comfort throughout your day.\\nServe up some style when you hit the club. The breathable mesh upper on these lightweight tennis shoes hugs your foot to support every move. A cushioned midsole keeps you comfortable from the moment you pull them on. The durable outsole stands up to every serve and slide as you improve your game.\\nThe adidas steadfast tennis shoes for men. A new, modern design that delivers quality and comfort for the recreational tennis player. The Synthetic & Mesh combination on the upper makes it lightweight, breathable and durable. They come with Injected EVA midsole for long term lightweight durability while the adiwear outsole provides durability in high wear areas.\\nTake to the court with confidence in these men's tennis shoes. Designed for the casual player, they feature a durable and stable leather upper with mesh at the heel. Lightweight cushioning keeps you comfortable during long rallies, while a rubber outsole delivers strong grip.\\n\", \"Men's Tennis Steadfast 19 Shoes, Men's adidas Tennis Courtsmash Shoes, Men's Sport Inspired Court Adapt Shoes , Men's adidas Tennis Steadfast 19 Shoes, Men's Tennis Woundrous II Shoes, Men's adidas Tennis GameCourt Shoes, Men's adidas Sport Inspired VL Court 2.0 Shoes, Men's Tennis Laceless Hard Court Shoes, Men's adidas Tennis Woundrous II Shoes, \")\n" 246 | ] 247 | } 248 | ], 249 | "source": [ 250 | "print(get_matches(\"men tennis shoes\"))" 251 | ] 252 | }, 253 | { 254 | "cell_type": "markdown", 255 | "metadata": {}, 256 | "source": [ 257 | "## Groq API" 258 | ] 259 | }, 260 | { 261 | "cell_type": "code", 262 | "execution_count": 30, 263 | "metadata": {}, 264 | "outputs": [], 265 | "source": [ 266 | "from langchain_groq import ChatGroq" 267 | ] 268 | }, 269 | { 270 | "cell_type": "code", 271 | "execution_count": 14, 272 | "metadata": {}, 273 | "outputs": [], 274 | "source": [ 275 | "groq = ChatGroq(temperature=0.1, groq_api_key=\"gsk-your-groq-api-key\", \n", 276 | " model_name=\"llama3-8b-8192\")" 277 | ] 278 | }, 279 | { 280 | "cell_type": "code", 281 | "execution_count": 15, 282 | "metadata": {}, 283 | "outputs": [], 284 | "source": [ 285 | "# system = \"You are a helpful assistant.\"\n", 286 | "# human = \"{text}\"\n", 287 | "# prompt = ChatPromptTemplate.from_messages([(\"system\", system), (\"human\", human)])\n", 288 | "\n", 289 | "# chain = prompt | groq\n", 290 | "# chain.invoke({\"text\": \"Explain the importance of low latency LLMs.\"})" 291 | ] 292 | }, 293 | { 294 | "cell_type": "code", 295 | "execution_count": 16, 296 | "metadata": {}, 297 | "outputs": [], 298 | "source": [ 299 | "from langchain_community.chat_models import ChatOllama\n", 300 | "\n", 301 | "local_llm = \"phi3\"\n", 302 | "\n", 303 | "ollama = ChatOllama(model=local_llm, temperature=0)" 304 | ] 305 | }, 306 | { 307 | "cell_type": "markdown", 308 | "metadata": {}, 309 | "source": [ 310 | "## CrewAI system integration" 311 | ] 312 | }, 313 | { 314 | "cell_type": "code", 315 | "execution_count": 51, 316 | "metadata": {}, 317 | "outputs": [], 318 | "source": [ 319 | "from crewai import Agent, Task, Crew\n", 320 | "\n", 321 | "def agent_pipeline(query):\n", 322 | " desc, products = get_matches(query)\n", 323 | " tagline_agent = Agent(role = \"Marketing and Copy writing Head\",\n", 324 | " goal = \"\"\"Provide a catchy and creative tagline from the description that is provided JUST A TAGLINE.\"\"\",\n", 325 | " backstory = \"\"\"You are an excellent Marketing and Copy writing genius that doesnt explain things just gives results, who can sell any product via marketing the shit out of it.\"\"\",\n", 326 | " allow_delegation = False,\n", 327 | " verbose = True,\n", 328 | " llm = groq)\n", 329 | "\n", 330 | " explainindetail_agent = Agent(role = \"Senior Marketing and Copy writing Executive\",\n", 331 | " goal = \"\"\"Provide the pros of using this product according to the product and highlight the strong points..\"\"\",\n", 332 | " backstory = \"\"\"You are an excellent Marketing and Copy writing genius that doesnt explain things just gives results, who can sell any product via marketing the shit out of it.\"\"\",\n", 333 | " allow_delegation = False,\n", 334 | " verbose = True,\n", 335 | " llm = groq)\n", 336 | "\n", 337 | " listproducts_agent = Agent(role = \"Marketing and Copy writing Analyst\",\n", 338 | " goal = \"\"\"You'll be given a list of products, list them in presentable manner with 1 line each that's it.\"\"\",\n", 339 | " backstory = \"\"\"You are an excellent Marketing and Copy writing genius that doesnt explain things just gives results, who can sell any product via marketing the shit out of it.\"\"\",\n", 340 | " allow_delegation = False,\n", 341 | " verbose = True,\n", 342 | " llm = groq)\n", 343 | " # manager_agent = Agent(role = \"Manager\",\n", 344 | " # goal = \"\"\"You'll be managing all the other agents.\"\"\",\n", 345 | " # backstory = \"\"\"You are an excellent man power management genius that doesnt explain things just gives results, who can maager any team via managing the shit out of it.\"\"\",\n", 346 | " # allow_delegation = False,\n", 347 | " # verbose = True,\n", 348 | " # llm = groq,\n", 349 | " # )\n", 350 | "\n", 351 | "\n", 352 | " task1 = Task (description=desc,\n", 353 | " agent = tagline_agent,\n", 354 | " expected_output=\"A tagline for the product.\")\n", 355 | "\n", 356 | " task2 = Task (description=desc,\n", 357 | " agent = explainindetail_agent,\n", 358 | " expected_output=\"A description for the product.\")\n", 359 | "\n", 360 | " task3 = Task(description=products,\n", 361 | " agent=listproducts_agent,\n", 362 | " expected_output=\"A numbered 1,2,3,.. list of products from the provided list.\")\n", 363 | "\n", 364 | " results = []\n", 365 | " for agent, task in zip([tagline_agent, explainindetail_agent, listproducts_agent],[task1, task2, task3]):\n", 366 | " crew1 = Crew(agents=[agent],\n", 367 | " tasks=[task],\n", 368 | " verbose=3,\n", 369 | " # manager_llm=groq\n", 370 | " )\n", 371 | " result = crew1.kickoff()\n", 372 | " results.append(result)\n", 373 | " \n", 374 | " return {'tagline':results[0],'product_description':results[1],'products_list':results[2]} " 375 | ] 376 | }, 377 | { 378 | "cell_type": "markdown", 379 | "metadata": {}, 380 | "source": [ 381 | "## Inference" 382 | ] 383 | }, 384 | { 385 | "cell_type": "code", 386 | "execution_count": 52, 387 | "metadata": {}, 388 | "outputs": [ 389 | { 390 | "name": "stderr", 391 | "output_type": "stream", 392 | "text": [ 393 | "2024-05-29 12:52:39,725 - 9784 - __init__.py-__init__:518 - WARNING: Overriding of current TracerProvider is not allowed\n" 394 | ] 395 | }, 396 | { 397 | "name": "stdout", 398 | "output_type": "stream", 399 | "text": [ 400 | "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Marketing and Copy writing Head\u001b[00m\n", 401 | "\u001b[1m\u001b[95m [INFO]: == Starting Task: The adidas casual sandals for men. Features stylish webbing straps, Diecut EVA midsole for stable cushioning and abrasion resistant rubber outsole with wet and dry traction pattern. \n", 402 | "Give a boost to your running or jogging sessions wearing these 8K running shoes for men. Featuring mesh and suede upper, these lace-ups are durable, light in weight and comfortable to wear. Furthermore, the grooved rubber outsole will provide better traction on the different surfaces.\n", 403 | "These men's running shoes will get you on the road to your goals. A sandwich mesh upper offers lightweight breathability, while a seamless print overlay adds support for a stable stride. The midsole offers pillow-soft Cloudfoam cushioning that eases every stride.\n", 404 | "The adidas casual slippers for men with a striking camouflage design. Features stylish webbing straps, Diecut EVA midsole for stable cushioning and abrasion resistant rubber outsole with wet and dry traction pattern. \n", 405 | "Move swiftly through the mountains in these men's hiking shoes. The lightweight, breathable build features a speed lacing system. A rugged Traxion outsole with grippy Continental™ Rubber supports travel over any terrain, wet or dry.\n", 406 | "Sleek running shoes for men. These shoes have a lightweight look and feel in honeycomb mesh. Cloudfoam cushioning delivers superior step-in comfort.\n", 407 | "These men's running shoes keep you comfortable so you stay focused on your\n", 408 | "running goals. They feature a textile upper that wraps around the midfoot to give\n", 409 | "you stability where you need it most.\n", 410 | "These men's running shoes keep you comfortable so you stay focused on your\n", 411 | "training goals. They feature a textile upper and a cushioned IMEVA midsole provides all-day comfort with rubber outsole for best durability in high wear areas. \n", 412 | "These lightweight running shoes for men give all round comfort, cushioning, durability & support in a simplistic design. The mesh upper ensure breathability and durability while the Lightstrike IMEVA midsole provides premium cushioning. Non-Marking Rubber outsole provides durability.\n", 413 | "These men's running shoes keep you comfortable so you stay focused on your goals. They feature a textile, mesh and synthetic upper along with Cloudfoam midsole provides optimum cushioning where you need it most and durable Rubber outsole for long-lasting wear. \n", 414 | "\u001b[00m\n", 415 | "\n", 416 | "\n", 417 | "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n", 418 | "\u001b[32;1m\u001b[1;3m\u001b[0m" 419 | ] 420 | }, 421 | { 422 | "name": "stderr", 423 | "output_type": "stream", 424 | "text": [ 425 | "2024-05-29 12:52:41,307 - 9784 - __init__.py-__init__:518 - WARNING: Overriding of current TracerProvider is not allowed\n" 426 | ] 427 | }, 428 | { 429 | "name": "stdout", 430 | "output_type": "stream", 431 | "text": [ 432 | "\u001b[32;1m\u001b[1;3mThought: I now can give a great answer\n", 433 | "\n", 434 | "Final Answer: \"Step Up Your Comfort Game\"\u001b[0m\n", 435 | "\n", 436 | "\u001b[1m> Finished chain.\u001b[0m\n", 437 | "\u001b[1m\u001b[92m [DEBUG]: == [Marketing and Copy writing Head] Task output: \"Step Up Your Comfort Game\"\n", 438 | "\n", 439 | "\u001b[00m\n", 440 | "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Senior Marketing and Copy writing Executive\u001b[00m\n", 441 | "\u001b[1m\u001b[95m [INFO]: == Starting Task: The adidas casual sandals for men. Features stylish webbing straps, Diecut EVA midsole for stable cushioning and abrasion resistant rubber outsole with wet and dry traction pattern. \n", 442 | "Give a boost to your running or jogging sessions wearing these 8K running shoes for men. Featuring mesh and suede upper, these lace-ups are durable, light in weight and comfortable to wear. Furthermore, the grooved rubber outsole will provide better traction on the different surfaces.\n", 443 | "These men's running shoes will get you on the road to your goals. A sandwich mesh upper offers lightweight breathability, while a seamless print overlay adds support for a stable stride. The midsole offers pillow-soft Cloudfoam cushioning that eases every stride.\n", 444 | "The adidas casual slippers for men with a striking camouflage design. Features stylish webbing straps, Diecut EVA midsole for stable cushioning and abrasion resistant rubber outsole with wet and dry traction pattern. \n", 445 | "Move swiftly through the mountains in these men's hiking shoes. The lightweight, breathable build features a speed lacing system. A rugged Traxion outsole with grippy Continental™ Rubber supports travel over any terrain, wet or dry.\n", 446 | "Sleek running shoes for men. These shoes have a lightweight look and feel in honeycomb mesh. Cloudfoam cushioning delivers superior step-in comfort.\n", 447 | "These men's running shoes keep you comfortable so you stay focused on your\n", 448 | "running goals. They feature a textile upper that wraps around the midfoot to give\n", 449 | "you stability where you need it most.\n", 450 | "These men's running shoes keep you comfortable so you stay focused on your\n", 451 | "training goals. They feature a textile upper and a cushioned IMEVA midsole provides all-day comfort with rubber outsole for best durability in high wear areas. \n", 452 | "These lightweight running shoes for men give all round comfort, cushioning, durability & support in a simplistic design. The mesh upper ensure breathability and durability while the Lightstrike IMEVA midsole provides premium cushioning. Non-Marking Rubber outsole provides durability.\n", 453 | "These men's running shoes keep you comfortable so you stay focused on your goals. They feature a textile, mesh and synthetic upper along with Cloudfoam midsole provides optimum cushioning where you need it most and durable Rubber outsole for long-lasting wear. \n", 454 | "\u001b[00m\n", 455 | "\n", 456 | "\n", 457 | "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n" 458 | ] 459 | }, 460 | { 461 | "name": "stderr", 462 | "output_type": "stream", 463 | "text": [ 464 | "2024-05-29 12:52:44,219 - 9784 - __init__.py-__init__:518 - WARNING: Overriding of current TracerProvider is not allowed\n" 465 | ] 466 | }, 467 | { 468 | "name": "stdout", 469 | "output_type": "stream", 470 | "text": [ 471 | "\u001b[32;1m\u001b[1;3mFinal Answer:\n", 472 | "\n", 473 | "**Introducing the Ultimate Comfort and Performance: adidas Casual Sandals for Men**\n", 474 | "\n", 475 | "Step into comfort and style with the adidas Casual Sandals for men. Designed for the modern man who values both form and function, these sandals boast a sleek and stylish design that's perfect for everyday wear.\n", 476 | "\n", 477 | "**Key Features:**\n", 478 | "\n", 479 | "* **Stylish Webbing Straps:** Adjustable straps provide a secure and comfortable fit, while the webbing material adds a touch of sophistication to your overall look.\n", 480 | "* **Diecut EVA Midsole:** Provides stable cushioning and support for your feet, ensuring a comfortable stride.\n", 481 | "* **Abrasion Resistant Rubber Outsole:** With a wet and dry traction pattern, this outsole provides excellent grip on various surfaces, making it perfect for casual outings or light outdoor activities.\n", 482 | "\n", 483 | "Whether you're running errands, meeting friends, or simply lounging around, these sandals are the perfect choice. With their lightweight and breathable design, you'll feel like you're walking on clouds.\n", 484 | "\n", 485 | "**Experience the Comfort and Style:**\n", 486 | "\n", 487 | "* **Lightweight and Breathable:** The sandals' mesh upper allows for airflow, keeping your feet cool and dry.\n", 488 | "* **Stable and Supportive:** The Diecut EVA midsole provides excellent cushioning and support, ensuring a comfortable fit.\n", 489 | "* **Grip and Traction:** The abrasion-resistant rubber outsole provides excellent grip on various surfaces, giving you confidence and stability.\n", 490 | "\n", 491 | "**Upgrade Your Footwear Game:**\n", 492 | "\n", 493 | "Ditch the ordinary and upgrade to the adidas Casual Sandals for men. With their stylish design, comfortable fit, and excellent performance, these sandals are the perfect choice for any occasion. Treat your feet to the ultimate comfort and style experience.\u001b[0m\n", 494 | "\n", 495 | "\u001b[1m> Finished chain.\u001b[0m\n", 496 | "\u001b[1m\u001b[92m [DEBUG]: == [Senior Marketing and Copy writing Executive] Task output: **Introducing the Ultimate Comfort and Performance: adidas Casual Sandals for Men**\n", 497 | "\n", 498 | "Step into comfort and style with the adidas Casual Sandals for men. Designed for the modern man who values both form and function, these sandals boast a sleek and stylish design that's perfect for everyday wear.\n", 499 | "\n", 500 | "**Key Features:**\n", 501 | "\n", 502 | "* **Stylish Webbing Straps:** Adjustable straps provide a secure and comfortable fit, while the webbing material adds a touch of sophistication to your overall look.\n", 503 | "* **Diecut EVA Midsole:** Provides stable cushioning and support for your feet, ensuring a comfortable stride.\n", 504 | "* **Abrasion Resistant Rubber Outsole:** With a wet and dry traction pattern, this outsole provides excellent grip on various surfaces, making it perfect for casual outings or light outdoor activities.\n", 505 | "\n", 506 | "Whether you're running errands, meeting friends, or simply lounging around, these sandals are the perfect choice. With their lightweight and breathable design, you'll feel like you're walking on clouds.\n", 507 | "\n", 508 | "**Experience the Comfort and Style:**\n", 509 | "\n", 510 | "* **Lightweight and Breathable:** The sandals' mesh upper allows for airflow, keeping your feet cool and dry.\n", 511 | "* **Stable and Supportive:** The Diecut EVA midsole provides excellent cushioning and support, ensuring a comfortable fit.\n", 512 | "* **Grip and Traction:** The abrasion-resistant rubber outsole provides excellent grip on various surfaces, giving you confidence and stability.\n", 513 | "\n", 514 | "**Upgrade Your Footwear Game:**\n", 515 | "\n", 516 | "Ditch the ordinary and upgrade to the adidas Casual Sandals for men. With their stylish design, comfortable fit, and excellent performance, these sandals are the perfect choice for any occasion. Treat your feet to the ultimate comfort and style experience.\n", 517 | "\n", 518 | "\u001b[00m\n", 519 | "\u001b[1m\u001b[95m [DEBUG]: == Working Agent: Marketing and Copy writing Analyst\u001b[00m\n", 520 | "\u001b[1m\u001b[95m [INFO]: == Starting Task: MEN'S ADIDAS RUNNING DURAMO 9 SHOES,Men's Outdoor Terrex Swift R2 Shoes,Men's adidas Running Duramo 9 Shoes,Men's adidas Running Victriox Shoes,Men's adidas Running Thrum Shoes,Men's Running Remit Shoes,Men's Running Staredge Shoes,MEN'S ADIDAS RUNNING 8K SHOES,Men's adidas Running Dubbers Shoes,Men's adidas Toe Side Slippers,\u001b[00m\n", 521 | "\n", 522 | "\n", 523 | "\u001b[1m> Entering new CrewAgentExecutor chain...\u001b[0m\n", 524 | "\u001b[32;1m\u001b[1;3mI'm ready to give it my all! I'll create a list of products with a one-line description for each. Here's my thought process:\n", 525 | "\n", 526 | "\"Time to unleash my marketing magic and make these products shine!\"\n", 527 | "\n", 528 | "Final Answer:\n", 529 | "\n", 530 | "1. MEN'S ADIDAS RUNNING DURAMO 9 SHOES - Experience the ultimate running companion with the Duramo 9, designed for comfort and performance.\n", 531 | "2. Men's Outdoor Terrex Swift R2 Shoes - Take your outdoor adventures to the next level with these rugged and reliable trail running shoes.\n", 532 | "3. Men's adidas Running Duramo 9 Shoes - Get ready to crush your fitness goals with the Duramo 9, engineered for speed and agility.\n", 533 | "4. Men's adidas Running Victriox Shoes - Unleash your inner champion with the Victriox, designed for high-intensity training and competition.\n", 534 | "5. Men's adidas Running Thrum Shoes - Stay ahead of the game with the Thrum, engineered for speed and agility on any terrain.\n", 535 | "6. Men's Running Remit Shoes - Send your runs into orbit with the Remit, designed for comfort and performance on any surface.\n", 536 | "7. Men's Running Staredge Shoes - Take your running to new heights with the Staredge, engineered for stability and support.\n", 537 | "8. MEN'S ADIDAS RUNNING 8K SHOES - Reach new heights with the 8K, designed for speed and agility on any terrain.\n", 538 | "9. Men's adidas Running Dubbers Shoes - Get ready to take your runs to the next level with the Dubbers, engineered for comfort and performance.\n", 539 | "10. Men's adidas Toe Side Slippers - Slip into comfort with the Toe Side Slippers, designed for relaxation and leisure.\n", 540 | "\n", 541 | "There you have it!\u001b[0m\n", 542 | "\n", 543 | "\u001b[1m> Finished chain.\u001b[0m\n", 544 | "\u001b[1m\u001b[92m [DEBUG]: == [Marketing and Copy writing Analyst] Task output: 1. MEN'S ADIDAS RUNNING DURAMO 9 SHOES - Experience the ultimate running companion with the Duramo 9, designed for comfort and performance.\n", 545 | "2. Men's Outdoor Terrex Swift R2 Shoes - Take your outdoor adventures to the next level with these rugged and reliable trail running shoes.\n", 546 | "3. Men's adidas Running Duramo 9 Shoes - Get ready to crush your fitness goals with the Duramo 9, engineered for speed and agility.\n", 547 | "4. Men's adidas Running Victriox Shoes - Unleash your inner champion with the Victriox, designed for high-intensity training and competition.\n", 548 | "5. Men's adidas Running Thrum Shoes - Stay ahead of the game with the Thrum, engineered for speed and agility on any terrain.\n", 549 | "6. Men's Running Remit Shoes - Send your runs into orbit with the Remit, designed for comfort and performance on any surface.\n", 550 | "7. Men's Running Staredge Shoes - Take your running to new heights with the Staredge, engineered for stability and support.\n", 551 | "8. MEN'S ADIDAS RUNNING 8K SHOES - Reach new heights with the 8K, designed for speed and agility on any terrain.\n", 552 | "9. Men's adidas Running Dubbers Shoes - Get ready to take your runs to the next level with the Dubbers, engineered for comfort and performance.\n", 553 | "10. Men's adidas Toe Side Slippers - Slip into comfort with the Toe Side Slippers, designed for relaxation and leisure.\n", 554 | "\n", 555 | "There you have it!\n", 556 | "\n", 557 | "\u001b[00m\n" 558 | ] 559 | } 560 | ], 561 | "source": [ 562 | "result = agent_pipeline(query=\"men's casual shoes\")" 563 | ] 564 | }, 565 | { 566 | "cell_type": "code", 567 | "execution_count": 53, 568 | "metadata": {}, 569 | "outputs": [ 570 | { 571 | "data": { 572 | "text/plain": [ 573 | "{'tagline': '\"Step Up Your Comfort Game\"',\n", 574 | " 'product_description': \"**Introducing the Ultimate Comfort and Performance: adidas Casual Sandals for Men**\\n\\nStep into comfort and style with the adidas Casual Sandals for men. Designed for the modern man who values both form and function, these sandals boast a sleek and stylish design that's perfect for everyday wear.\\n\\n**Key Features:**\\n\\n* **Stylish Webbing Straps:** Adjustable straps provide a secure and comfortable fit, while the webbing material adds a touch of sophistication to your overall look.\\n* **Diecut EVA Midsole:** Provides stable cushioning and support for your feet, ensuring a comfortable stride.\\n* **Abrasion Resistant Rubber Outsole:** With a wet and dry traction pattern, this outsole provides excellent grip on various surfaces, making it perfect for casual outings or light outdoor activities.\\n\\nWhether you're running errands, meeting friends, or simply lounging around, these sandals are the perfect choice. With their lightweight and breathable design, you'll feel like you're walking on clouds.\\n\\n**Experience the Comfort and Style:**\\n\\n* **Lightweight and Breathable:** The sandals' mesh upper allows for airflow, keeping your feet cool and dry.\\n* **Stable and Supportive:** The Diecut EVA midsole provides excellent cushioning and support, ensuring a comfortable fit.\\n* **Grip and Traction:** The abrasion-resistant rubber outsole provides excellent grip on various surfaces, giving you confidence and stability.\\n\\n**Upgrade Your Footwear Game:**\\n\\nDitch the ordinary and upgrade to the adidas Casual Sandals for men. With their stylish design, comfortable fit, and excellent performance, these sandals are the perfect choice for any occasion. Treat your feet to the ultimate comfort and style experience.\",\n", 575 | " 'products_list': \"1. MEN'S ADIDAS RUNNING DURAMO 9 SHOES - Experience the ultimate running companion with the Duramo 9, designed for comfort and performance.\\n2. Men's Outdoor Terrex Swift R2 Shoes - Take your outdoor adventures to the next level with these rugged and reliable trail running shoes.\\n3. Men's adidas Running Duramo 9 Shoes - Get ready to crush your fitness goals with the Duramo 9, engineered for speed and agility.\\n4. Men's adidas Running Victriox Shoes - Unleash your inner champion with the Victriox, designed for high-intensity training and competition.\\n5. Men's adidas Running Thrum Shoes - Stay ahead of the game with the Thrum, engineered for speed and agility on any terrain.\\n6. Men's Running Remit Shoes - Send your runs into orbit with the Remit, designed for comfort and performance on any surface.\\n7. Men's Running Staredge Shoes - Take your running to new heights with the Staredge, engineered for stability and support.\\n8. MEN'S ADIDAS RUNNING 8K SHOES - Reach new heights with the 8K, designed for speed and agility on any terrain.\\n9. Men's adidas Running Dubbers Shoes - Get ready to take your runs to the next level with the Dubbers, engineered for comfort and performance.\\n10. Men's adidas Toe Side Slippers - Slip into comfort with the Toe Side Slippers, designed for relaxation and leisure.\\n\\nThere you have it!\"}" 576 | ] 577 | }, 578 | "execution_count": 53, 579 | "metadata": {}, 580 | "output_type": "execute_result" 581 | } 582 | ], 583 | "source": [ 584 | "print(result)" 585 | ] 586 | }, 587 | { 588 | "cell_type": "code", 589 | "execution_count": null, 590 | "metadata": {}, 591 | "outputs": [], 592 | "source": [] 593 | } 594 | ], 595 | "metadata": { 596 | "kernelspec": { 597 | "display_name": "Python 3", 598 | "language": "python", 599 | "name": "python3" 600 | }, 601 | "language_info": { 602 | "codemirror_mode": { 603 | "name": "ipython", 604 | "version": 3 605 | }, 606 | "file_extension": ".py", 607 | "mimetype": "text/x-python", 608 | "name": "python", 609 | "nbconvert_exporter": "python", 610 | "pygments_lexer": "ipython3", 611 | "version": "3.10.13" 612 | } 613 | }, 614 | "nbformat": 4, 615 | "nbformat_minor": 2 616 | } 617 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | crewai[tools] 2 | langchain 3 | qdrant-client 4 | langchain-groq 5 | sentence-transformers 6 | --------------------------------------------------------------------------------