├── .gitignore ├── requirements.txt ├── .devcontainer └── devcontainer.json ├── README.md └── app.py /.gitignore: -------------------------------------------------------------------------------- 1 | secrets.toml 2 | .venv 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | streamlit 2 | langchain 3 | langchain_community 4 | langchain_groq 5 | 6 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Python 3", 3 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 4 | "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", 5 | "customizations": { 6 | "codespaces": { 7 | "openFiles": [ 8 | "README.md", 9 | "app.py" 10 | ] 11 | }, 12 | "vscode": { 13 | "settings": {}, 14 | "extensions": [ 15 | "ms-python.python", 16 | "ms-python.vscode-pylance" 17 | ] 18 | } 19 | }, 20 | "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y Settings", 30 | unsafe_allow_html=True 31 | ) 32 | 33 | # Dropdown to select Groq AI model 34 | selected_groq_model = st.sidebar.selectbox( 35 | label="Select Groq Model", 36 | options=["Groq-8x7B", "Groq-8x13B", "Groq-Mixtral", "Groq-LLM"], 37 | help="Choose a Groq model for processing tasks." 38 | ) 39 | 40 | temperature = st.sidebar.slider( 41 | label="Model Temperature", 42 | min_value=0.0, 43 | max_value=1.0, 44 | value=0.7, 45 | step=0.1, 46 | help="Adjust the temperature to control the randomness of the model's outputs. Lower values produce more deterministic results." 47 | ) 48 | 49 | st.sidebar.markdown("---") 50 | 51 | # Add Google Trends link with icon 52 | # Resources Section 53 | st.sidebar.markdown("### Resources") 54 | st.sidebar.markdown("[Google Trends](https://trends.google.com/)") 55 | st.sidebar.markdown("[Google News](https://news.google.com/)") 56 | st.sidebar.markdown("[Amazon](https://www.amazon.com/)") 57 | 58 | st.sidebar.markdown("---") 59 | 60 | # Add GitHub link with icon in the sidebar 61 | st.sidebar.markdown( 62 | """ 63 |
64 | 65 | GitHub Logo 66 | GitHub Repository 67 | 68 |
69 | """, 70 | unsafe_allow_html=True 71 | ) 72 | 73 | # Feedback Section at the Bottom 74 | st.sidebar.markdown("---") # Divider for better visual separation 75 | with st.sidebar.expander("Provide Feedback"): 76 | 77 | 78 | # Feedback Text Input 79 | feedback = st.text_area( 80 | label="Feedback:", 81 | placeholder="Please provide any additional feedback or comments to improve results." 82 | ) 83 | 84 | # 5-Star Rating System 85 | star_rating = st.slider( 86 | label="Rate the experience:", 87 | min_value=1, 88 | max_value=5, 89 | value=5, 90 | step=1, 91 | format="%d stars", 92 | help="Rate the application from 1 (poor) to 5 (excellent)." 93 | ) 94 | 95 | # Feedback Submit Button 96 | if st.button("Submit Feedback"): 97 | st.success("Thank you for your feedback!") 98 | # Process or save the feedback and rating here 99 | print(f"Feedback: {feedback}") 100 | print(f"Rating: {star_rating} stars") 101 | 102 | # Toggle for demo mode 103 | demo_mode = st.checkbox("Use Demo Inputs") 104 | 105 | # Define demo inputs 106 | demo_inputs = { 107 | "product_name": "gaming chair", 108 | "company_url": "https://store.hermanmiller.com/gaming-view-all?lang=en_US", 109 | "product_category": "Office supplies", 110 | "competitors_url": "https://www.ewinracing.com, https://xrockergaming.com, www.razer.com, https://secretlab.co, https://www.vertagear.com/, https://www.noblechairs.com, https://www.dxracer.com, https://www.mavix.com/, https://subsonic.com/, https://www.andaseat.com/", 111 | "value_proposition": "a high quality 3D enhanced gaming chair for gamers with speakers, surround sound, vibrations, cupholder and Siri/Alex compatibility, priced at $399.", 112 | "target_customer": "Gamers", 113 | "amazon_best_sellers": "https://www.amazon.com/s?k=gaming+chairs&i=garden&rh=n%3A1055398%2Cp_72%3A1248915011&s=exact-aware-popularity-rank&dc&ds=v1%3AHBaNLpw8vi94y9a3WBIfMjSgF2VSI48owFQHB87fFyc&crid=ZXF6209QI6R1&qid=1734017332&rnid=1248913011&sprefix=gaming+chairs%2Caps%2C229&ref=sr_nr_p_72_1", 114 | "google_trends_review": "https://trends.google.com/trends/explore?geo=US&q=gaming%20chairs", 115 | "googled_news_search": "https://www.google.com/search?q=gaming+chairs&sca_esv=fa27aa6c1a2c9000&biw=1447&bih=750&tbm=nws&sxsrf=ADLYWIJUjMkXLxpbPMvQbSzpTvG02xCp5w%3A1734025867585&ei=iyJbZ9noIpydkPIPnqz0uQ0&ved=0ahUKEwiZ2vje5aKKAxWcDkQIHR4WPdcQ4dUDCA4&uact=5&oq=gaming+chairs&gs_lp=Egxnd3Mtd2l6LW5ld3MiDWdhbWluZyBjaGFpcnMyCxAAGIAEGLEDGIMBMgUQABiABDIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAESJYRUJAGWNMPcAJ4AJABAJgBZqAB3AaqAQQxMy4xuAEDyAEA-AEBmAIQoAL_BsICEBAAGIAEGLEDGEMYgwEYigXCAggQABiABBixA8ICChAAGIAEGEMYigXCAg0QABiABBixAxhDGIoFwgIOEAAYgAQYsQMYgwEYigXCAg0QABiABBixAxiDARgKwgIKEAAYgAQYsQMYCpgDAIgGAZIHBDE1LjGgB_FQ&sclient=gws-wiz-news" 116 | } 117 | 118 | # Data collection/inputs 119 | with st.form("company_info", clear_on_submit=False): 120 | 121 | product_name = st.text_input( 122 | label="**Product Name**:", 123 | placeholder="Enter the product name you are selling", 124 | value=demo_inputs["product_name"] if demo_mode else "" 125 | ) 126 | 127 | company_url = st.text_input( 128 | label="**Company URL**:", 129 | placeholder="Enter the company URL (e.g., www.company.com)", 130 | value=demo_inputs["company_url"] if demo_mode else "" 131 | ) 132 | 133 | product_category = st.text_input( 134 | label="**Product Category**:", 135 | placeholder="Enter the product category (e.g., 'Gaming Chair', 'Cloud Storage')", 136 | value=demo_inputs["product_category"] if demo_mode else "" 137 | ) 138 | 139 | competitors_url = st.text_input( 140 | label="**Competitors URL**:", 141 | placeholder="Enter competitor URLs separated by commas (e.g., www.apple.com, www.samsung.com)", 142 | value=demo_inputs["competitors_url"] if demo_mode else "" 143 | ) 144 | 145 | value_proposition = st.text_input( 146 | label="**Value Proposition**:", 147 | placeholder="A sentence summarizing the product’s value", 148 | value=demo_inputs["value_proposition"] if demo_mode else "" 149 | ) 150 | 151 | target_customer = st.text_input( 152 | label="**Target Customer**:", 153 | placeholder="Enter the target customer or audience", 154 | value=demo_inputs["target_customer"] if demo_mode else "" 155 | ) 156 | 157 | # Product Analytics title 158 | st.markdown("### Specific Product Analysis") 159 | st.markdown("Provides a product business forecast.", unsafe_allow_html=True) 160 | 161 | amazon_best_sellers = st.text_input( 162 | label="**Amazon Best Sellers URL**:", 163 | placeholder="Enter an Amazon URL to scrape best sellers", 164 | value=demo_inputs["amazon_best_sellers"] if demo_mode else "" 165 | ) 166 | 167 | google_trends_review = st.text_input( 168 | label="**Google Trends URL**:", 169 | placeholder="Enter a Google Trends URL for trends data", 170 | value=demo_inputs["google_trends_review"] if demo_mode else "" 171 | ) 172 | 173 | googled_news_search = st.text_input( 174 | label="**Google News URL**:", 175 | placeholder="Enter a Google News URL for the latest news", 176 | value=demo_inputs["googled_news_search"] if demo_mode else "" 177 | ) 178 | 179 | # Optional title 180 | st.markdown("### Optional") 181 | 182 | # File upload for document parsing 183 | uploaded_file = st.file_uploader("Upload a PDF or Word document for additional insights.", type=["pdf", "docx"]) 184 | 185 | # Extra data source to scrape data 186 | data_source_url = st.text_input( 187 | label="**Additional Data Source URL**", 188 | placeholder="Provides a summarized insight into the provided URL" 189 | ) 190 | 191 | 192 | # For the llm insights result 193 | company_insights = "" 194 | 195 | # Data process 196 | if st.form_submit_button("Generate Insights"): 197 | if product_name and company_url: 198 | with st.spinner("Processing..."): 199 | 200 | # Use search tool to get Company Information 201 | company_information = search.invoke(company_url) 202 | print(company_information) 203 | 204 | # TODO: Create prompt <================= 205 | prompt = """ 206 | You are a business assistant agent tasked with generating a one-page summary to assist a sales representative in gaining insights about a prospective account. 207 | Based on the inputs and additional data provided, your goal is to create a detailed and actionable report. 208 | Avoid assumptions or statements that are not backed by data. 209 | Reflect diverse perspectives and cross-verify data when possible. 210 | Use the following structure: 211 | 212 | ### Inputs: 213 | - **Company Information**: {company_information} 214 | - **Product Name**: {product_name} 215 | - **Competitor URL(s)**: {competitors_url} 216 | - **Product Category**: {product_category} 217 | - **Value Proposition**: {value_proposition} 218 | - **Target Customer**: {target_customer} 219 | - **Uploaded Document**: {uploaded_file} (summarize and add insight into summary, if uploaded). 220 | - **Scraped Data Source**: {data_source_url} (summarize and add insight into summary, if uploaded). 221 | 222 | ### Tasks: 223 | 1. **Company Strategy**: 224 | - Summarize the company’s activities, priorities, and any recent initiatives relevant to the product category. 225 | - Include mentions of key public statements, press releases, or job postings that provide insight into the company’s strategy. 226 | 227 | 2. **Competitor Mentions**: 228 | - Extract and analyze data about competitors from the provided URLs and scraped data. 229 | - Create a **detailed comparison table** with the following columns: 230 | - **Competitor Name** 231 | - **Features** 232 | - **Price** 233 | - **Durability** 234 | 235 | - Example table format: 236 | | Competitor Name | Features | Price | Durability | Comparison to Your Product | 237 | |------------------|--------------------------------|-------|------------|-----------------------------------------------| 238 | | Competitor A | Basic ergonomic design | $500 | Medium | Lacks 3D immersive experience and no cupholder | 239 | | Competitor B | Speakers, ergonomic design | $450 | High | Lacks 3D immersive experience and cupholder | 240 | 241 | 3. **Leadership Information**: 242 | - Identify key decision-makers (e.g., CEO, CTO) and summarize relevant public statements or initiatives tied to the product category. 243 | 244 | 4. **Product/Strategy Summary**: 245 | - Understand the specific characteristics of the ideal customer. Create a table with findings. 246 | - Give suggestions on where the company can sell the product (sales channels). 247 | 248 | 5. **Suggestions for Positioning**: 249 | - Provide recommendations for how the product can align with the company’s strategy and address the target customer’s pain points. 250 | 251 | 6. **Product Data Analytics**: 252 | **Amazon Best Sellers Review** 253 | - Summarize top 5 products. 254 | - Include the brand name, price, rating and key product features. 255 | - Create a table. 256 | - Summarize results to see where the value proposition can provide leverage. 257 | 258 | **Google Trends Review** 259 | - Use google_trends_review to summarize scraped data. 260 | - Predict future trends and potential market disruptions 261 | - Create a table 262 | - Summarize results to see where the value proposition can provide leverage. 263 | 264 | **Google Search Related News** 265 | - Analyze sentiment in news articles, social media posts, and customer reviews to gauge market perception. 266 | - Analyze the most up to date news related to the product. Give at least 3 to 5 most up to date topics. 267 | - Create a table. 268 | - Summarize results to see where the value proposition can provide leverage. 269 | 270 | 7. **Business Value / Forecast** 271 | - Using all gathered inputted data to provide a business forecast on the product potential. 272 | - Use a table illustrating projected profit margin and revenue everytime this prompt gets generated. 273 | - Use persuasive language and call-to-action phrases in the closing statement 274 | 275 | ## Ethical Considerations 276 | - Provide actionable insights while mitigating potential biases in decision-making. 277 | - Highlight areas where assumptions or extrapolations are based on limited data. 278 | - Use diverse data sources (Amazon Best Sellers, Google Trends, and News Search) to ensure impartial analysis. 279 | 280 | ## Language and Tone 281 | - Use a formal professional tone 282 | - Use persuasive language 283 | 284 | ### Final Deliverable: 285 | - Present the report in a structured format with clear sections: 286 | - **Company Strategy** 287 | - **Competitor Mentions (including table)** 288 | - **Leadership Information** 289 | - **Product/Strategy Summary** 290 | - **Recommendations for Positioning** 291 | - Include references or links to supporting data (articles, press releases, etc.). 292 | - Include a summary of identified biases, if any, and measures taken to mitigate them. 293 | - Present the report with fair and representative data-driven insights. 294 | 295 | 8. ### Closing Statement: 296 | - Conclude the report with a persuasive note highlighting the product’s competitive edge. 297 | - Use persuasive language and call-to-action phrases in the closing statement 298 | 299 | 300 | """ 301 | 302 | # Prompt Template 303 | prompt_template = ChatPromptTemplate([("system", prompt)]) 304 | 305 | # Chain 306 | chain = prompt_template | llm | parser 307 | 308 | # Result/Insights 309 | company_insights = chain.invoke( 310 | { 311 | "company_information": company_information, 312 | "product_name": product_name, 313 | "competitors_url": competitors_url, 314 | "product_category": product_category, 315 | "value_proposition": value_proposition, 316 | "target_customer": target_customer, 317 | "uploaded_file": uploaded_file, 318 | "data_source_url": data_source_url, 319 | "amazon_best_sellers": amazon_best_sellers, 320 | "google_trends_review": google_trends_review, 321 | "googled_news_search": googled_news_search 322 | } 323 | ) 324 | # Display the insights and download button outside the form 325 | if company_insights: 326 | st.markdown(company_insights) 327 | 328 | # Create a download button for the report 329 | st.download_button( 330 | label="Download Report", 331 | data=company_insights, 332 | file_name="report.txt", 333 | mime="text/plain" 334 | ) --------------------------------------------------------------------------------