Skip to content
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

New genai demo #5

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions genai-demos/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing to this repository

We welcome your contributions! There are multiple ways to contribute.

## Opening issues

For bugs or enhancement requests, please file a GitHub issue unless it's
security related. When filing a bug remember that the better written the bug is,
the more likely it is to be fixed. If you think you've found a security
vulnerability, do not raise a GitHub issue and follow the instructions in our
[security policy](./SECURITY.md).

## Contributing code

We welcome your code contributions. Before submitting code via a pull request,
you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and
your commits need to include the following line using the name and e-mail
address you used to sign the OCA:

```text
Signed-off-by: Your Name <[email protected]>
```

This can be automatically added to pull requests by committing with `--sign-off`
or `-s`, e.g.

```text
git commit --signoff
```

Only pull requests from committers that can be verified as having signed the OCA
can be accepted.

## Pull request process

1. Ensure there is an issue created to track and discuss the fix or enhancement
you intend to submit.
1. Fork this repository.
1. Create a branch in your fork to implement the changes. We recommend using
the issue number as part of your branch name, e.g. `1234-fixes`.
1. Ensure that any documentation is updated with the changes that are required
by your change.
1. Ensure that any samples are updated if the base image has been changed.
1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly
what your changes are meant to do and provide simple steps on how to validate.
your changes. Ensure that you reference the issue you created as well.
1. We will assign the pull request to 2-3 people for review before it is merged.

## Code of conduct

Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd
like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC].

[OCA]: https://oca.opensource.oracle.com
[COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/
37 changes: 37 additions & 0 deletions genai-demos/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
** Copyright (c) 2024, Oracle and/or its affiliates.
**
** The Universal Permissive License (UPL), Version 1.0
**
** Subject to the condition set forth below, permission is hereby granted to any
** person obtaining a copy of this software, associated documentation and/or data
** (collectively the "Software"), free of charge and under any and all copyright
** rights in the Software, and any and all patent rights owned or freely
** licensable by each licensor hereunder covering either (i) the unmodified
** Software as contributed to or provided by such licensor, or (ii) the Larger
** Works (as defined below), to deal in both
**
** (a) the Software, and
** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
** one is included with the Software (each a "Larger Work" to which the Software
** is contributed by such licensors),
**
** without restriction, including without limitation the rights to copy, create
** derivative works of, display, perform, and distribute the Software and make,
** use, sell, offer for sale, import, export, have made, and have sold the
** Software and the Larger Work(s), and to sublicense the foregoing rights on
** either these or other terms.
**
** This license is subject to the following condition:
** The above copyright notice and either this complete permission notice or at
** a minimum a reference to the UPL must be included in all copies or
** substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
*/
96 changes: 96 additions & 0 deletions genai-demos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Quickly Generate Text Summaries for Ecommerce Product Reviews Using HeatWave GenAI

[![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)

> 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.

## Introduction
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.

## Getting Started

### Prerequisites
**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.

### Steps

To run the following steps, you need to be in the folder where this README is contained.

1. Setup the database and create the procedures.

**Note**: this will remove the `ecommerce` database if you already have it.
```
mysql -h your_host_name -u yourusername -p < install.sql
```

Expected output:
```
-- Installation: STARTED ---

-- Dropping database if exists ---

-- Creating tables ---

-- Populating data ---

-- Creating stored procedures ---

-- Installation: DONE ---
```

2. Insert a new review, compute the sentiment of the new review, summarize and translate the summaries
```
mysql -h your_host_name -u yourusername -p < run.sql
```

Expected output:
```
################### Computing summaries for EXISTING reviews on a product ###################


--- English summary of positive reviews on the T-Shirt ---
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.
--- English summary of negative reviews on the T-Shirt ---
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.
--- Spanish summary of positive reviews on the T-Shirt ---
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.
--- Spanish summary of negative reviews on the T-Shirt ---
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.

################### Insert a new review ###################

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.

################### Done: Insert a new review ###################


--- New review ---
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.
--- Sentiment of the new review ---
POSITIVE

################### Computing summaries AFTER the review is inserted ###################


--- UPDATED English summary of positive reviews on the T-Shirt ---
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.
--- UPDATED English summary of negative reviews on the T-Shirt ---
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.
--- UPDATED Spanish summary of positive reviews on the T-Shirt ---
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.
--- UPDATED Spanish summary of negative reviews on the T-Shirt ---
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.
```


## Contributing
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.

## License
Copyright (c) 2024 Oracle and/or its affiliates.

Licensed under the Universal Permissive License (UPL), Version 1.0.

See [LICENSE](LICENSE) for more details.

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.
38 changes: 38 additions & 0 deletions genai-demos/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Reporting security vulnerabilities

Oracle values the independent security research community and believes that
responsible disclosure of security vulnerabilities helps us ensure the security
and privacy of all our users.

Please do NOT raise a GitHub Issue to report a security vulnerability. If you
believe you have found a security vulnerability, please submit a report to
[[email protected]][1] preferably with a proof of concept. Please review
some additional information on [how to report security vulnerabilities to Oracle][2].
We encourage people who contact Oracle Security to use email encryption using
[our encryption key][3].

We ask that you do not use other channels or contact the project maintainers
directly.

Non-vulnerability related security issues including ideas for new or improved
security features are welcome on GitHub Issues.

## Security updates, alerts and bulletins

Security updates will be released on a regular cadence. Many of our projects
will typically release security fixes in conjunction with the
Oracle Critical Patch Update program. Additional
information, including past advisories, is available on our [security alerts][4]
page.

## Security-related information

We will provide security related information such as a threat model, considerations
for secure use, or any known security issues in our documentation. Please note
that labs and sample code are intended to demonstrate a concept and may not be
sufficiently hardened for production use.

[1]: mailto:[email protected]
[2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html
[3]: https://www.oracle.com/security-alerts/encryptionkey.html
[4]: https://www.oracle.com/security-alerts/
Loading