Skip to content

Commit f242f85

Browse files
committed
preliminary update of genai_demo readme
1 parent aeac56e commit f242f85

File tree

3 files changed

+78
-54
lines changed

3 files changed

+78
-54
lines changed

docs/Sample-Genai.md

Lines changed: 74 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,34 @@
11
!!! pied-piper ":bulb: TL;DR - GenAI leverages AI and Microservice Automation for 'hands-free' project creation"
22

3-
API Logic Server uses ChatGPT APIs, to submit prompts and obtain data model class responses.
3+
To create projects, the system (either WebGenAI or API Logic Server CLI - for more information, [click here](https://apilogicserver.github.io/Docs/Architecture-What-Is/){:target="_blank" rel="noopener"}) performs the following:
44

5-
API Logic Server uses these to create a database and project, from a single `genai` command.
6-
7-
This document illustrates how to create, run and customize the genai_demo project.
8-
9-
> Note: if you have already created the project, proceed to "What Just Happened?".
10-
11-
 
12-
13-
[![GenAI Automation](images/sample-ai/copilot/genai-automation-video.png)](https://www.youtube.com/watch?v=LSh7mqGiT0k&t=5s "Microservice Automation"){:target="_blank" rel="noopener"}
14-
15-
 
16-
17-
## 1. Description (or Database)
18-
19-
To create a microservice, identify an existing database, or provide a natural language "prompt" description. For example, here is the `genai_demo.prompt` file:
20-
21-
!!! pied-piper ":bulb: TL;DR - GenAI Prompt"
22-
23-
Create a system with customers, orders, items and products.
5+
1. Uses ChatGPT APIs to submit prompts and obtain data model class responses
6+
7+
2. It then uses these to create a database and project
248

25-
Include a notes field for orders.
9+
This document presumes you have already created the project, and are using VSCode or GitHub to explore it. It illustrates how to run and customize the genai_demo project.
2610

27-
Enforce Check Credit:
28-
1. Customer.balance <= credit_limit
29-
2. Customer.balance = Sum(Order.amount_total where date_shipped is null)
30-
3. Order.amount_total = Sum(Item.amount)
31-
4. Item.amount = quantity * unit_price
32-
5. Store the Item.unit_price as a copy from Product.unit_price
11+
> Note: if you *not* already created the project, proceed to [the Appendix](#creating-the-genai_demo-project)
3312

3413
&nbsp;
3514

36-
## 2. GenAI Creation
37-
38-
You can explore genai_demo using the [Manager](https://apilogicserver.github.io/Docs/Manager/){:target="_blank" rel="noopener"}. Optionally, you can sign-up for ChatGPT API and Copilot, or simulate the process as described below.
39-
40-
1. If you have signed up for ChatGPT API and Copilot, this command will create and open a project called `genai_demo` from `genai_demo.prompt`:
41-
42-
```bash
43-
als genai --using=genai_demo.prompt
44-
```
15+
## Setup Codespaces
4516

46-
47-
2. ***Or,*** if you have not signed up, you can simulate the process using a pre-installed response file:
48-
49-
```bash
50-
als genai --using=genai_demo.prompt --gen-using-file=system/genai/temp/chatgpt_retry.txt
51-
```
17+
Coming soon.
5218

5319
&nbsp;
5420

55-
### What Just Happened?
21+
## What Just Happened?
5622

5723
`genai` processing is shown below (internal steps denoted in grey):
5824

5925
1. You create your.prompt file, and invoke `als genai --using=your.prompt`. genai then creates your database and project as follows:
6026

6127
a. Submits your prompt to the `ChatGPT API`
6228

63-
b. Writes the response to file, so you can correct and retry if anything goes wrong
29+
b. Writes the response to file (`system/genai/temp/response.json`), so you can correct and retry if anything goes wrong
6430

65-
c. Extracts model.py from the response
31+
c. Extracts `system/genai/temp/create_db_models.py` from the response
6632

6733
d. Invokes `als create-from-model`, which creates the database and your project
6834

@@ -74,25 +40,23 @@ als genai --using=genai_demo.prompt --gen-using-file=system/genai/temp/chatgpt_r
7440

7541
&nbsp;
7642

77-
### API/App Automation
43+
## 1. API/App Automation
7844

7945
API/App Automation means the created project is executable. To run:
8046

8147
1. Press **F5** to run
82-
2. Start your [Browser](http://localhost:5656/) to view:
48+
2. Start your Browser (use the codespaces button, or [locally](http://localhost:5656/)) to view:
8349
* App Automation: the Admin App, and
8450
* API Automation: JSON:API, with Swagger
8551
3. Stop the server when you are done (red box on VSCode Debugger panel)
8652

87-
![Microservice Automation](images/sample-ai/Microservice-Automation.png)
88-
89-
It's a modern, 3-tiered architecture, using standard Python libraries:
90-
91-
![Microservice Architecture](images/Architecture-Runtime-Stack.png)
53+
![Microservice Automation](images/sample-ai/copilot/created-microservice.png)
9254

55+
It's a modern, 3-tiered architecture, using standard Python libraries. For more information, [click here - slide 2](https://www.genai-logic.com/architecture).
56+
9357
&nbsp;
9458

95-
## 3. Customize: Rules and Python
59+
## 2. Customize: Rules and Python
9660

9761
The development environment is also standard: your IDE, standard languages, standard libraries, standard source control, etc. You customize API Logic Project in two ways, both performed in your IDE:
9862

@@ -144,7 +108,7 @@ Note: Kafka is not activated in this example. To explore a running Tutorial for
144108

145109
&nbsp;
146110

147-
## 4. Deployment: Containers, Cloud
111+
## 3. Deployment: Containers, Cloud
148112

149113
One of the best ways to de-risk projects is to verify the sponsors are in sync with what is happening. This is best addressed with *working software*, which often occurs late in project development. Surprises here can result in considerable rework... and frustrations.
150114

@@ -210,6 +174,62 @@ It's usage create the sqlite database, but running it in this mode can provide m
210174

211175
If you are using [Web/GenAI](WebGenAI.md){:target="_blank" rel="noopener"}, project files are always under /projects/gen_$ID.
212176

177+
&nbsp;
178+
179+
### Creating `genai_demo`
180+
181+
#### Using WebGenAI
182+
183+
[![GenAI Automation](images/sample-ai/copilot/genai-automation-video.png)](https://www.youtube.com/watch?v=7I33Fa9Ulos "Microservice Automation"){:target="_blank" rel="noopener"}
184+
185+
&nbsp;
186+
187+
#### Using the ALS CLI
188+
189+
[![GenAI Automation](images/sample-ai/copilot/genai-automation-video.png)](https://www.youtube.com/watch?v=LSh7mqGiT0k&t=5s "Microservice Automation"){:target="_blank" rel="noopener"}
190+
191+
192+
To create a microservice, identify an existing database, or provide a natural language "prompt" description.
193+
194+
You can explore genai_demo using the [Manager](https://apilogicserver.github.io/Docs/Manager/){:target="_blank" rel="noopener"}. Optionally, you can sign-up for ChatGPT API and Copilot, or simulate the process as described below.
195+
196+
1. If you have signed up for ChatGPT API and Copilot, this command will create and open a project called `genai_demo` from `system/genai/examples/genai_demo/genai_demo.prompt`:
197+
198+
```bash
199+
als genai --using=system/genai/examples/genai_demo/genai_demo.prompt
200+
```
201+
202+
203+
2. ***Or,*** if you have not signed up, you can simulate the process using a pre-installed response file:
204+
205+
```bash
206+
als genai --using=genai_demo.prompt --gen-using-file=system/genai/temp/chatgpt_retry.txt
207+
```
208+
209+
Here is the `system/genai/examples/genai_demo/genai_demo.prompt` file:
210+
211+
!!! pied-piper ":bulb: TL;DR - GenAI Prompt"
212+
213+
Create a system with customers, orders, items and products.
214+
215+
Include a notes field for orders.
216+
217+
Use LogicBank to enforce business logic.
218+
219+
Use case: Check Credit
220+
1. The Customer's balance is less than the credit limit
221+
2. The Customer's balance is the sum of the Order amount_total where date_shipped is null
222+
3. The Order's amount_total is the sum of the Item amount
223+
4. The Item amount is the quantity * unit_price
224+
5. The Item unit_price is copied from the Product unit_price
225+
226+
Ensure each customer has a unique name.
227+
228+
Ensure each Item quantity is not null.
229+
230+
Ensure each order has a valid customer_id that exists in the Customer table.
231+
232+
213233
&nbsp;
214234

215235
### GenAI Using Postgresql

docs/Security-Keycloak.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ cd devops/keycloak; docker compose up
2828

2929
![kc-user-roles](images/keycloak/kc-config-local-install-kc.png)
3030

31+
You may see: `Failed to load jwks_uri http://localhost:8080/realms/kcals/protocol/openid-connect/certs`.
32+
33+
* coming soon
34+
3135
&nbsp;
3236

3337
### Configure Project for Keycloak
20 KB
Loading

0 commit comments

Comments
 (0)