Skip to content

Commit f93c979

Browse files
authored
Merge pull request #5 from oracle-devrel/heatwave-genai-ecommerce
New genai demo
2 parents be6e5a0 + 3abaee1 commit f93c979

File tree

10 files changed

+482
-0
lines changed

10 files changed

+482
-0
lines changed

genai-demos/CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing to this repository
2+
3+
We welcome your contributions! There are multiple ways to contribute.
4+
5+
## Opening issues
6+
7+
For bugs or enhancement requests, please file a GitHub issue unless it's
8+
security related. When filing a bug remember that the better written the bug is,
9+
the more likely it is to be fixed. If you think you've found a security
10+
vulnerability, do not raise a GitHub issue and follow the instructions in our
11+
[security policy](./SECURITY.md).
12+
13+
## Contributing code
14+
15+
We welcome your code contributions. Before submitting code via a pull request,
16+
you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and
17+
your commits need to include the following line using the name and e-mail
18+
address you used to sign the OCA:
19+
20+
```text
21+
Signed-off-by: Your Name <[email protected]>
22+
```
23+
24+
This can be automatically added to pull requests by committing with `--sign-off`
25+
or `-s`, e.g.
26+
27+
```text
28+
git commit --signoff
29+
```
30+
31+
Only pull requests from committers that can be verified as having signed the OCA
32+
can be accepted.
33+
34+
## Pull request process
35+
36+
1. Ensure there is an issue created to track and discuss the fix or enhancement
37+
you intend to submit.
38+
1. Fork this repository.
39+
1. Create a branch in your fork to implement the changes. We recommend using
40+
the issue number as part of your branch name, e.g. `1234-fixes`.
41+
1. Ensure that any documentation is updated with the changes that are required
42+
by your change.
43+
1. Ensure that any samples are updated if the base image has been changed.
44+
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
45+
what your changes are meant to do and provide simple steps on how to validate.
46+
your changes. Ensure that you reference the issue you created as well.
47+
1. We will assign the pull request to 2-3 people for review before it is merged.
48+
49+
## Code of conduct
50+
51+
Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd
52+
like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC].
53+
54+
[OCA]: https://oca.opensource.oracle.com
55+
[COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/

genai-demos/LICENSE

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
** Copyright (c) 2024, Oracle and/or its affiliates.
3+
**
4+
** The Universal Permissive License (UPL), Version 1.0
5+
**
6+
** Subject to the condition set forth below, permission is hereby granted to any
7+
** person obtaining a copy of this software, associated documentation and/or data
8+
** (collectively the "Software"), free of charge and under any and all copyright
9+
** rights in the Software, and any and all patent rights owned or freely
10+
** licensable by each licensor hereunder covering either (i) the unmodified
11+
** Software as contributed to or provided by such licensor, or (ii) the Larger
12+
** Works (as defined below), to deal in both
13+
**
14+
** (a) the Software, and
15+
** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
16+
** one is included with the Software (each a "Larger Work" to which the Software
17+
** is contributed by such licensors),
18+
**
19+
** without restriction, including without limitation the rights to copy, create
20+
** derivative works of, display, perform, and distribute the Software and make,
21+
** use, sell, offer for sale, import, export, have made, and have sold the
22+
** Software and the Larger Work(s), and to sublicense the foregoing rights on
23+
** either these or other terms.
24+
**
25+
** This license is subject to the following condition:
26+
** The above copyright notice and either this complete permission notice or at
27+
** a minimum a reference to the UPL must be included in all copies or
28+
** substantial portions of the Software.
29+
**
30+
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31+
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32+
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33+
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34+
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35+
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36+
** SOFTWARE.
37+
*/

genai-demos/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Quickly Generate Text Summaries for Ecommerce Product Reviews Using HeatWave GenAI
2+
3+
[![License: UPL](https://img.shields.io/badge/license-UPL-green)](https://img.shields.io/badge/license-UPL-green) [![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=oracle-devrel_heatwave-genai-demos)](https://sonarcloud.io/dashboard?id=oracle-devrel_heatwave-genai-demos)
4+
5+
> This repository contains code samples to demonstrates how to use HeatWave GenAI to summarize and/or translate text for example products reviews from an e-commerce website. With just a few steps, one can leverage HeatWave GenAI to enhance an e-commerce website with new capabilities.
6+
7+
## Introduction
8+
HeatWave GenAI allows you to perform natural language queries on unstructured data using a familiar SQL and JavaScript interface. In the following code samples we can show how easy is it setup and run GenAI applications.
9+
10+
## Getting Started
11+
12+
### Prerequisites
13+
**HeatWave-Enabled Database System**: Ensure you have a database system(version 9.1 or above) with HeatWave enabled. Refer to the [Getting Started with MySQL HeatWave on OCI]( https://www.oracle.com/developer/getting-started-with-mysql-heatwave-on-oci/) guide for setup instructions.
14+
15+
### Steps
16+
17+
To run the following steps, you need to be in the folder where this README is contained.
18+
19+
1. Setup the database and create the procedures.
20+
21+
**Note**: this will remove the `ecommerce` database if you already have it.
22+
```
23+
mysql -h your_host_name -u yourusername -p < install.sql
24+
```
25+
26+
Expected output:
27+
```
28+
-- Installation: STARTED ---
29+
30+
-- Dropping database if exists ---
31+
32+
-- Creating tables ---
33+
34+
-- Populating data ---
35+
36+
-- Creating stored procedures ---
37+
38+
-- Installation: DONE ---
39+
```
40+
41+
2. Insert a new review, compute the sentiment of the new review, summarize and translate the summaries
42+
```
43+
mysql -h your_host_name -u yourusername -p < run.sql
44+
```
45+
46+
Expected output:
47+
```
48+
################### Computing summaries for EXISTING reviews on a product ###################
49+
50+
51+
--- English summary of positive reviews on the T-Shirt ---
52+
The T-Shirt is made from high-quality cotton and has a comfortable fit, making it perfect for everyday wear. The washing instructions are clear and easy to follow. However, the lack of bleach instructions may be a concern for some customers. Overall, the T-Shirt is a good option for casual outings and special occasion clothes.
53+
--- English summary of negative reviews on the T-Shirt ---
54+
The reviewer found the T-shirt to be of poor quality, with unsatisfactory material and unclear washing instructions. They would not recommend it to those seeking a long-lasting and easy-to-care-for shirt. Another reviewer also found the T-shirt to fall short of their expectations, citing unbreathable material and an ill-fitting size. They too would not recommend this product to others.
55+
--- Spanish summary of positive reviews on the T-Shirt ---
56+
La camiseta está hecha de algodón de alta calidad y tiene un ajuste cómodo, lo que la hace perfecta para usar a diario. Las instrucciones de lavado son claras y fáciles de seguir. Sin embargo, la falta de instrucciones sobre el uso de blanqueador puede ser una preocupación para algunos clientes. En general, la camiseta es una buena opción para salidas informales y ropa para ocasiones especiales.
57+
--- Spanish summary of negative reviews on the T-Shirt ---
58+
El revisor encontró que la camiseta era de baja calidad, con un material insatisfactorio y unas instrucciones de lavado poco claras. No la recomendaría a aquellos que buscan una prenda duradera y fácil de cuidar. Otro revisor también encontró que la camiseta no cumplía con sus expectativas, citando un material que no permite la transpiración y una talla inadecuada. Tampoco recomendaría este producto a otros.
59+
60+
################### Insert a new review ###################
61+
62+
Review: The T-Shirt is fantastic as it is not only comfortable but it is also made of sustainable material. The organic cotton feels like normal cotton while being environment-friendly. However, the washing instruction is difficult to follow.
63+
64+
################### Done: Insert a new review ###################
65+
66+
67+
--- New review ---
68+
Review: The T-Shirt is fantastic as it is not only comfortable but it is also made of sustainable material. The organic cotton feels like normal cotton while being environment-friendly. However, the washing instruction is difficult to follow.
69+
--- Sentiment of the new review ---
70+
POSITIVE
71+
72+
################### Computing summaries AFTER the review is inserted ###################
73+
74+
75+
--- UPDATED English summary of positive reviews on the T-Shirt ---
76+
The T-Shirt is a soft and comfortable option for everyday wear due to its high-quality cotton material and comfortable fit. The washing instructions are clear and easy to follow, ensuring that the T-Shirt retains its quality. However, some customers may be concerned about the lack of bleach instructions. Overall, the T-Shirt is a good option for casual outings and special occasion clothes. It is also made from sustainable material, making it environmentally friendly.
77+
--- UPDATED English summary of negative reviews on the T-Shirt ---
78+
The reviewer found the T-shirt to be of poor quality, with unsatisfactory material and unclear washing instructions. They would not recommend it to those seeking a long-lasting and easy-to-care-for shirt. Another reviewer also found the T-shirt to fall short of their expectations, citing unbreathable material and an ill-fitting size. They too would not recommend this product to others.
79+
--- UPDATED Spanish summary of positive reviews on the T-Shirt ---
80+
La camiseta es una opción suave y cómoda para el uso diario gracias a su material de algodón de alta calidad y su ajuste confortable. Las instrucciones de lavado son claras y fáciles de seguir, lo que garantiza que la camiseta mantenga su calidad. Sin embargo, algunos clientes pueden estar preocupados por la falta de instrucciones sobre el uso de lejía. En general, la camiseta es una buena opción para salidas informales y ropa para ocasiones especiales. También está hecha de material sostenible, lo que la hace respetuosa con el medio ambiente.
81+
--- UPDATED Spanish summary of negative reviews on the T-Shirt ---
82+
El revisor encontró que la camiseta era de baja calidad, con un material insatisfactorio y unas instrucciones de lavado poco claras. No la recomendaría a aquellos que buscan una prenda duradera y fácil de cuidar. Otro revisor también encontró que la camiseta no cumplía con sus expectativas, citando un material que no permite la transpiración y una talla inadecuada. Tampoco recomendaría este producto a otros.
83+
```
84+
85+
86+
## Contributing
87+
This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.
88+
89+
## License
90+
Copyright (c) 2024 Oracle and/or its affiliates.
91+
92+
Licensed under the Universal Permissive License (UPL), Version 1.0.
93+
94+
See [LICENSE](LICENSE) for more details.
95+
96+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.

genai-demos/SECURITY.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Reporting security vulnerabilities
2+
3+
Oracle values the independent security research community and believes that
4+
responsible disclosure of security vulnerabilities helps us ensure the security
5+
and privacy of all our users.
6+
7+
Please do NOT raise a GitHub Issue to report a security vulnerability. If you
8+
believe you have found a security vulnerability, please submit a report to
9+
[[email protected]][1] preferably with a proof of concept. Please review
10+
some additional information on [how to report security vulnerabilities to Oracle][2].
11+
We encourage people who contact Oracle Security to use email encryption using
12+
[our encryption key][3].
13+
14+
We ask that you do not use other channels or contact the project maintainers
15+
directly.
16+
17+
Non-vulnerability related security issues including ideas for new or improved
18+
security features are welcome on GitHub Issues.
19+
20+
## Security updates, alerts and bulletins
21+
22+
Security updates will be released on a regular cadence. Many of our projects
23+
will typically release security fixes in conjunction with the
24+
Oracle Critical Patch Update program. Additional
25+
information, including past advisories, is available on our [security alerts][4]
26+
page.
27+
28+
## Security-related information
29+
30+
We will provide security related information such as a threat model, considerations
31+
for secure use, or any known security issues in our documentation. Please note
32+
that labs and sample code are intended to demonstrate a concept and may not be
33+
sufficiently hardened for production use.
34+
35+
[1]: mailto:[email protected]
36+
[2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html
37+
[3]: https://www.oracle.com/security-alerts/encryptionkey.html
38+
[4]: https://www.oracle.com/security-alerts/

0 commit comments

Comments
 (0)