Skip to content

Add e commerce shopping assistant #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Dhivya-Bharathy
Copy link
Contributor

@Dhivya-Bharathy Dhivya-Bharathy commented Jun 22, 2025

User description

An AI assistant for e-commerce shoppers that provides product comparisons, reviews, pricing insights, and personalized recommendations.


PR Type

Enhancement


Description

  • Add E-commerce Shopping Assistant Jupyter notebook

  • Implement AI agent for product comparison and recommendations

  • Include interactive example for wireless earbuds search

  • Provide structured output with pros, cons, and pricing


Changes walkthrough 📝

Relevant files
Enhancement
E_commerce_Shopping_Assistant.ipynb
E-commerce Shopping Assistant notebook implementation       

examples/cookbooks/E_commerce_Shopping_Assistant.ipynb

  • Add complete Jupyter notebook for e-commerce shopping assistant
  • Implement PraisonAI agent with product research capabilities
  • Include example task for finding wireless earbuds under $100
  • Provide structured output with detailed product comparisons
  • +558/-0 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • New Features
      • Added a new Jupyter notebook example for an E-commerce Shopping Assistant that helps users discover and compare wireless earbuds under $100.
      • The assistant provides a user-friendly list of recommended products, including pros, cons, and prices.
      • Step-by-step guidance and explanations are included to help users interact with the shopping assistant.

    Copy link
    Contributor

    coderabbitai bot commented Jun 22, 2025

    Walkthrough

    A new Jupyter notebook example, "E-commerce Shopping Assistant," has been added. It demonstrates building an AI agent-based system using PraisonAI Agents to help users find, compare, and decide on wireless earbuds under $100. The notebook includes setup, agent and task definition, system creation, execution, and result display.

    Changes

    File(s) Change Summary
    examples/cookbooks/E_commerce_Shopping_Assistant.ipynb Added a new notebook showcasing an AI-powered e-commerce shopping assistant using PraisonAI Agents.

    Sequence Diagram(s)

    sequenceDiagram
        participant User
        participant Notebook
        participant PraisonAIAgents
        participant EcommerceShoppingAgent
        participant OpenAI API
        participant DuckDuckGo Search
    
        User->>Notebook: Provide OpenAI API key and run cells
        Notebook->>PraisonAIAgents: Create system with agent and task
        Notebook->>PraisonAIAgents: Run query for earbuds under $100
        PraisonAIAgents->>EcommerceShoppingAgent: Assign shopping task
        EcommerceShoppingAgent->>DuckDuckGo Search: Search for products
        EcommerceShoppingAgent->>OpenAI API: Analyze and compare products
        EcommerceShoppingAgent->>PraisonAIAgents: Return recommendations
        PraisonAIAgents->>Notebook: Output formatted results
        Notebook->>User: Display recommendations
    
    Loading

    Suggested labels

    Review effort 2/5

    Poem

    In the land of code, a new friend appears,
    Shopping for earbuds, it calms all your fears.
    With agents and tasks, it scours the net,
    Finding the deals you’ll never forget.
    So hop along, shopper, let AI assist—
    The best buys await, right here on your list!
    🛒🐇✨


    📜 Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between c409c80 and 9a3b6dd.

    📒 Files selected for processing (1)
    • examples/cookbooks/E_commerce_Shopping_Assistant.ipynb (1 hunks)
    🚧 Files skipped from review as they are similar to previous changes (1)
    • examples/cookbooks/E_commerce_Shopping_Assistant.ipynb
    ⏰ Context from checks skipped due to timeout of 90000ms (4)
    • GitHub Check: test-core (3.11)
    • GitHub Check: Run tests and collect coverage
    • GitHub Check: quick-test
    • GitHub Check: performance-test

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❤️ Share
    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Explain this complex logic.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai explain this code block.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and explain its main purpose.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    Copy link
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Summary of Changes

    Hello @DhivyaBharathy-web, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

    This pull request introduces a new example Jupyter Notebook that showcases an AI-powered e-commerce shopping assistant. The assistant is designed to help users with product discovery, comparison, and decision-making by leveraging AI agents to research and synthesize information from online sources.

    Highlights

    • New E-commerce Shopping Assistant Notebook: Introduces a new Jupyter Notebook (E_commerce_Shopping_Assistant.ipynb) that demonstrates how to build an AI-powered e-commerce shopping assistant.
    • AI Agent Implementation: The notebook sets up an EcommerceShoppingAgent using praisonaiagents to perform product comparisons, pricing insights, and personalized recommendations.
    • Dependency Integration: Shows the integration of openai for AI capabilities and duckduckgo_search for online research within the agent's workflow.
    Using Gemini Code Assist

    The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

    Invoking Gemini

    You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

    Feature Command Description
    Code Review /gemini review Performs a code review for the current pull request in its current state.
    Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
    Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
    Help /gemini help Displays a list of available commands.

    Customization

    To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

    Limitations & Feedback

    Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

    You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

    Footnotes

    1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

    Copy link

    You are nearing your monthly Qodo Merge usage quota. For more information, please visit here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The notebook prompts users to enter their OpenAI API key using getpass, which is good practice for hiding the input. However, the API key is stored in environment variables and assigned to openai.api_key, which could potentially be exposed in notebook outputs or logs if not handled carefully.

    ⚡ Recommended focus areas for review

    Broken Link

    The Colab badge link points to an incorrect path that doesn't match the actual file name, which will result in a 404 error when users try to open the notebook in Google Colab.

     "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/commerce_Shopping_Assistant.ipynb)"
    ]
    
    Hardcoded Query

    The query variable contains a hardcoded search for noise cancellation earbuds, but the task description and expected output don't mention noise cancellation, creating a mismatch between the query and task definition.

    "query = \"Find the best wireless earbuds under $100 with noise cancellation\"\n",
    "output = assistant_system.start(input=query)\n",
    

    Copy link

    qodo-merge-pro bot commented Jun 22, 2025

    You are nearing your monthly Qodo Merge usage quota. For more information, please visit here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix broken Colab badge URL
    Suggestion Impact:The commit directly implements the suggested fix by correcting the filename in the Colab badge URL from "commerce_Shopping_Assistant.ipynb" to "E_commerce_Shopping_Assistant.ipynb"

    code diff:

    -    "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/commerce_Shopping_Assistant.ipynb)"
    -   ]
    +       "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/E_commerce_Shopping_Assistant.ipynb)"

    The Colab badge URL contains an incorrect filename. The notebook is named
    "E_commerce_Shopping_Assistant.ipynb" but the URL references
    "commerce_Shopping_Assistant.ipynb" (missing "E_"). This will result in a 404
    error when users click the badge.

    examples/cookbooks/E_commerce_Shopping_Assistant.ipynb [22]

    -"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/commerce_Shopping_Assistant.ipynb)"
    +"[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/E_commerce_Shopping_Assistant.ipynb)"

    [Suggestion processed]

    Suggestion importance[1-10]: 8

    __

    Why: The suggestion correctly identifies a typo in the Colab badge URL. The notebook filename is E_commerce_Shopping_Assistant.ipynb, but the link in the badge points to commerce_Shopping_Assistant.ipynb, which would result in a 404 error. This is a functional issue that directly impacts user experience.

    Medium
    • Update

    Copy link

    codecov bot commented Jun 22, 2025

    Codecov Report

    All modified and coverable lines are covered by tests ✅

    Project coverage is 14.50%. Comparing base (8ee013e) to head (9a3b6dd).
    Report is 232 commits behind head on main.

    Additional details and impacted files
    @@           Coverage Diff           @@
    ##             main     #675   +/-   ##
    =======================================
      Coverage   14.50%   14.50%           
    =======================================
      Files          25       25           
      Lines        2517     2517           
      Branches      357      357           
    =======================================
      Hits          365      365           
      Misses       2136     2136           
      Partials       16       16           
    Flag Coverage Δ
    quick-validation 0.00% <ø> (ø)
    unit-tests 14.50% <ø> (ø)

    Flags with carried forward coverage won't be shown. Click here to find out more.

    ☔ View full report in Codecov by Sentry.
    📢 Have feedback on the report? Share it here.

    🚀 New features to boost your workflow:
    • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
    • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

    Copy link
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Code Review

    The pull request introduces an E-commerce Shopping Assistant Jupyter notebook with an AI agent for product comparison and recommendations. The notebook includes an interactive example for wireless earbuds search, providing structured output with pros, cons, and pricing. The review focuses on ensuring the query aligns with the notebook's intended functionality.

    Comment on lines +539 to +540
    "query = \"Find the best wireless earbuds under $100 with noise cancellation\"\n",
    "output = assistant_system.start(input=query)\n",
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    medium

    The query lacks noise cancellation criteria, while the comment above cell 35 states that the query should include noise cancellation. This discrepancy should be addressed to align the query with the intended functionality.

    query = "Find the best wireless earbuds under $100 with noise cancellation"
    

    Copy link
    Contributor

    @coderabbitai coderabbitai bot left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Actionable comments posted: 2

    🧹 Nitpick comments (1)
    examples/cookbooks/E_commerce_Shopping_Assistant.ipynb (1)

    94-100: Update to use modern OpenAI client initialization.

    The openai.api_key assignment on line 99 is deprecated in newer versions of the OpenAI library. Consider using the modern client initialization pattern.

     import os
     from getpass import getpass
     
     os.environ["OPENAI_API_KEY"] = getpass("Enter your OpenAI API key: ")
    -import openai
    -openai.api_key = os.getenv("OPENAI_API_KEY")
    +from openai import OpenAI
    +client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between 851d43f and c409c80.

    📒 Files selected for processing (1)
    • examples/cookbooks/E_commerce_Shopping_Assistant.ipynb (1 hunks)
    ⏰ Context from checks skipped due to timeout of 90000ms (4)
    • GitHub Check: test-core (3.11)
    • GitHub Check: performance-test
    • GitHub Check: Run tests and collect coverage
    • GitHub Check: quick-test
    🔇 Additional comments (3)
    examples/cookbooks/E_commerce_Shopping_Assistant.ipynb (3)

    60-60: LGTM!

    The dependency installation correctly includes all necessary packages for the e-commerce shopping assistant functionality.


    143-179: LGTM!

    The agent and task definitions are well-structured with clear instructions and expected outputs. The agent's role as an e-commerce shopping assistant is properly defined.


    201-206: LGTM!

    The system configuration is appropriate with sequential processing for the single task and verbose mode enabled for better demonstration visibility.

    Comment on lines +539 to +543
    "query = \"Find the best wireless earbuds under $100 with noise cancellation\"\n",
    "output = assistant_system.start(input=query)\n",
    "\n",
    "# 📄 Display Output\n",
    "print(\"🛍️ Shopping Assistant Output:\\n\", output)\n"
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    🛠️ Refactor suggestion

    ⚠️ Potential issue

    Address query-task inconsistency and add error handling.

    Two issues identified:

    1. Query-task mismatch: The query specifically requests "noise cancellation" but the task description doesn't mention this requirement, and all recommended earbuds lack active noise cancellation.

    2. Missing error handling: No error handling around the system execution could lead to unhandled exceptions.

    -query = "Find the best wireless earbuds under $100 with noise cancellation"
    +query = "Find the best wireless earbuds under $100"
    -output = assistant_system.start(input=query)
    +try:
    +    output = assistant_system.start(input=query)
    +except Exception as e:
    +    print(f"Error executing assistant system: {e}")
    +    output = "Unable to process request at this time."

    Alternatively, update the task description to specifically mention noise cancellation requirements if that's the intended functionality.

    📝 Committable suggestion

    ‼️ IMPORTANT
    Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    Suggested change
    "query = \"Find the best wireless earbuds under $100 with noise cancellation\"\n",
    "output = assistant_system.start(input=query)\n",
    "\n",
    "# 📄 Display Output\n",
    "print(\"🛍️ Shopping Assistant Output:\\n\", output)\n"
    # Update the query if you want to drop the noise-cancellation requirement
    query = "Find the best wireless earbuds under $100"
    # Add error handling around the assistant call
    try:
    output = assistant_system.start(input=query)
    except Exception as e:
    print(f"Error executing assistant system: {e}")
    output = "Unable to process request at this time."
    # 📄 Display Output
    print("🛍️ Shopping Assistant Output:\n", output)
    🤖 Prompt for AI Agents
    In examples/cookbooks/E_commerce_Shopping_Assistant.ipynb around lines 539 to
    543, the query requests earbuds with noise cancellation but the task description
    and recommendations do not reflect this requirement, causing inconsistency.
    Update the task description to explicitly include the noise cancellation feature
    or modify the query to match the current task scope. Additionally, wrap the
    assistant_system.start call in a try-except block to catch and handle potential
    errors gracefully, preventing unhandled exceptions during execution.
    

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant