Skip to content

Commit

Permalink
Merge pull request #5 from oracle-devrel/markdown-updates
Browse files Browse the repository at this point in the history
Markdown updates
  • Loading branch information
peppertech authored Jan 26, 2024
2 parents f455214 + b7122b9 commit cb1b839
Showing 1 changed file with 84 additions and 48 deletions.
132 changes: 84 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,37 @@ Oracle JET(Preact) allows you to craft pixel-perfect UIs which are fast, lightwe

Oracle's Generative AI service allows developers to unlock a better user experience for chat systems, question-and-answer solutions, and much more. This project provides a front end to that service so you can experiment and get a sense of the immense power of Oracle Generative AI. This is an excellent starting point on your AI journey, and experienced developers will be able to quickly port their LLMs to leverage this powerful service.

![alt text here](images/demo.gif)
Check out [demo here](https://youtu.be/hpRoQ93YeaQ)

Check [demo here](https://youtu.be/hpRoQ93YeaQ)
![alt text here](images/demo.gif)

## Getting Started

### 0. Set up
### 0. Prerequisites and setup

- Oracle Cloud Infrastructure (OCI) Account
- Oracle Cloud Infrastructure (OCI) Generative AI Service - [Getting Started with Generative AI](https://docs.oracle.com/en-us/iaas/Content/generative-ai/getting-started.htm)
- Oracle Cloud Infrastructure Documentation - [Generative AI](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm)
- Oracle Cloud Infrastructure (OCI) Generative AI Service SDK - [Oracle Cloud Infrastructure Python SDK](https://pypi.org/project/oci/)
- Node v16 - [Node homepage](https://nodejs.org/en)
- Oracle JET v15 - [Oracle JET Homepage](https://www.oracle.com/webfolder/technetwork/jet/index.html)

Follow the links below to generate a config file and a key pair in your ~/.oci directory

- [SDK config](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm)
- [API signing key](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm)
- [CLI install](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm#configfile)

After completion, you should have the following 2 things in your `~/.oci directory `

a. A config file(where key file point to private key:key_file=`~/.oci/oci_api_key.pem`)
b. A key pair named `oci_api_key.pem` and `oci_api_key_public.pem`
Now make sure you change the reference of the key file in the config file (where the key file points to private key:key_file=/YOUR_DIR_TO_KEY_FILE/oci_api_key.pem)
After completion, you should have the following 2 things in your `~/.oci directory`

- A config file(where key file point to private key:key_file=`~/.oci/oci_api_key.pem`)
- A key pair named `oci_api_key.pem` and `oci_api_key_public.pem`
- Now make sure you change the reference of the key file in the config file
- Append OCI Generative-AI service compartment and endpoint URL
`vim service/python/server.py`

```console
vim service/python/server.py
```

```Python
#TODO: Update this section with your tenancy details
Expand All @@ -52,14 +61,20 @@ generative_ai_inference_client = (
### 1. (Optional) Modify websocket ports

- In the root of the project directory run to edit ports
`vim app/web/components/content/index.tsx`

```console
vim app/web/components/content/index.tsx
```

```Javascript
const gateway = `ws://${window.location.hostname}:1234`;
```js
const gateway = ws://${window.location.hostname}:1234;
```

- Update default port in Python websocket server:
`vim service/python/server.py`

```console
vim service/python/server.py
```

```Python
async def start_server():
Expand All @@ -71,50 +86,75 @@ async def start_server():
- Upload your oci_api_key_public.pem to console:
[API signing key](https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#three)

### 3. Make sure you have Python installed on your machine
### 3. Install all dependencies

- In cli run the following command to validate the Python version
`python --version`
We suggest you install dependencies in a virtual environment to avoid conflicts on your system.

You should see similar output:
- Navigate to the server root folder

```shell
Python 3.8.3
```console
cd service/python
```

### 4. Install all dependencies
- Create a virtual environment:

```console
python3 -m venv venv
```

We suggest you install dependencies in a virtual environment to avoid conflicts on your system.
- Activate your virtual environment:

```console
. venv/bin/activate
```

- Upgrade pip:

```console
pip3 install --upgrade pip
```

- Navigate to the server root folder
`cd service/python`
- Create a virtual environment:
`python3 -m venv venv`
- Activate your virtual environment:
`. venv/bin/activate`
- Upgrade pip:
`pip3 install --upgrade pip`
- Install requirements:
`pip3 install -r requirements.txt`
- Install requirements:

```console
pip3 install -r requirements.txt
```

## 5. Start the websocket server app
## 4. Start the websocket server app

Once dependencies are installed and your service credentials are updated you can run server.py

- `python3 server.py`
```console
python3 server.py
```

## 5. Start JET Client

- Open app directory:

## 6. Start JET Client
```console
cd ../../app
```

- Open app directory:
`cd ../../app ` or `cd app/` in the root folder
- Install dependencies:
`npm install`
- Run local version:
`npx ojet serve`

```console
npm install
```

- Run local version:

```console
npx ojet serve
```

- Or package for web deployment
`npx ojet build web`

Ask question to generate LLM response.
```console
npx ojet build web
```

You can now ask question to generate LLM based response.
![alt text here](images/QandA.png)

Note that sample app can generate markdown.
Expand All @@ -140,12 +180,6 @@ endpoint = "https://generativeai.aiservice.<Region>.oci.oraclecloud.com"
generative_ai_client = oci.generative_ai.generative_ai_client.GenerativeAiClient(config=config, service_endpoint=endpoint, retry_strategy=oci.retry.NoneRetryStrategy(), signer=signer)
```

### Prerequisites

- OCI Account
- OCI Generative AI Service
- Oracle JET/Node

## Notes/Issues

Additional Use Cases like summarization and embedding coming soon.
Expand All @@ -165,13 +199,15 @@ To change output parameters edit server.py
- [AI for Developers](https://developer.oracle.com/technologies/ai.html)

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

0 comments on commit cb1b839

Please sign in to comment.