-
-
Notifications
You must be signed in to change notification settings - Fork 727
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
Add e commerce shopping assistant #675
Conversation
WalkthroughA 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
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
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
usingpraisonaiagents
to perform product comparisons, pricing insights, and personalized recommendations. - Dependency Integration: Shows the integration of
openai
for AI capabilities andduckduckgo_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
-
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. ↩
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:
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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.
"query = \"Find the best wireless earbuds under $100 with noise cancellation\"\n", | ||
"output = assistant_system.start(input=query)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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
📒 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.
"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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Address query-task inconsistency and add error handling.
Two issues identified:
-
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.
-
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.
"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.
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 📝
E_commerce_Shopping_Assistant.ipynb
E-commerce Shopping Assistant notebook implementation
examples/cookbooks/E_commerce_Shopping_Assistant.ipynb
Summary by CodeRabbit