ApiLogicServer 12.0.4__py3-none-any.whl → 12.1.26__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/METADATA +2 -1
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/RECORD +63 -40
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/WHEEL +1 -1
- api_logic_server_cli/api_logic_server.py +23 -204
- api_logic_server_cli/api_logic_server_info.yaml +2 -2
- api_logic_server_cli/cli.py +25 -84
- api_logic_server_cli/cli_args_base.py +2 -0
- api_logic_server_cli/cli_args_project.py +9 -3
- api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/meta_model.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/model_creation_services.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ui_admin_creator.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/meta_model.py +1 -1
- api_logic_server_cli/create_from_model/model_creation_services.py +3 -1
- api_logic_server_cli/create_from_model/ont_create.py +3 -1
- api_logic_server_cli/create_from_model/ui_admin_creator.py +6 -4
- api_logic_server_cli/genai.py +420 -198
- api_logic_server_cli/logging.yml +5 -0
- api_logic_server_cli/prototypes/.DS_Store +0 -0
- api_logic_server_cli/prototypes/base/api_logic_server_run.py +0 -2
- api_logic_server_cli/prototypes/base/config/server_setup.py +15 -1
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_consumer.py +1 -1
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +1 -1
- api_logic_server_cli/prototypes/base/readme.md +21 -8
- api_logic_server_cli/prototypes/genai_demo/logic/declare_logic.py +11 -12
- api_logic_server_cli/prototypes/manager/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/.vscode/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/.vscode/launch.json +98 -1
- api_logic_server_cli/prototypes/manager/README.md +40 -3
- api_logic_server_cli/prototypes/manager/system/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_create_db.py +11 -0
- api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_imports.py +22 -0
- api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_test_data.py +7 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/emp_depts/emp_dept.prompt +4 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.prompt +1 -1
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +133 -130
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_informal.prompt +10 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_000.response +1 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_001.prompt +171 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_002.prompt +21 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_003.response +94 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_004.prompt +6 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_iterative_logic/genai_demo_iterative_logic_005.response_example +122 -0
- api_logic_server_cli/prototypes/manager/system/genai/learning_requests/logic_bank_api.prompt +162 -12
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/.DS_Store +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/logic_inserts.prompt +1 -0
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/response_format.prompt +30 -0
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/sqlite_inserts.prompt +17 -2
- api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/zsqlite_inserts_iterations.prompt +28 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/create_db_models.py +96 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_000.response +1 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_001.prompt +208 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_002.prompt +89 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_003.prompt +40 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_004.response +57 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_005.response +57 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/readme.md +1 -0
- api_logic_server_cli/prototypes/manager/system/genai/retry/retry.response +57 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/emp_depts/emp_dept_explicit.prompt +0 -7
- api_logic_server_cli/prototypes/manager/system/genai/examples/emp_depts/emp_dept_implicit_fails.prompt +0 -5
- api_logic_server_cli/prototypes/manager/system/secrets.txt +0 -6
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/LICENSE +0 -0
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/entry_points.txt +0 -0
- {ApiLogicServer-12.0.4.dist-info → ApiLogicServer-12.1.26.dist-info}/top_level.txt +0 -0
api_logic_server_cli/logging.yml
CHANGED
|
Binary file
|
|
@@ -68,8 +68,6 @@ import ui.admin.admin_loader as AdminLoader
|
|
|
68
68
|
from security.system.authentication import configure_auth
|
|
69
69
|
import database.multi_db as multi_db
|
|
70
70
|
import oracledb
|
|
71
|
-
import integration.kafka.kafka_producer as kafka_producer
|
|
72
|
-
import integration.kafka.kafka_consumer as kafka_consumer
|
|
73
71
|
|
|
74
72
|
|
|
75
73
|
app_logger = server_setup.logging_setup()
|
|
@@ -317,7 +317,21 @@ def api_logic_server_setup(flask_app: Flask, args: Args):
|
|
|
317
317
|
if logic_logger_activate_debug == False:
|
|
318
318
|
logic_logger.setLevel(logging.INFO)
|
|
319
319
|
app_logger.info("")
|
|
320
|
-
|
|
320
|
+
disable_rules = False
|
|
321
|
+
if os.getenv('APILOGICPROJECT_DISABLE_RULES'):
|
|
322
|
+
disable_rules = os.getenv('APILOGICPROJECT_DISABLE_RULES').startswith("1") or \
|
|
323
|
+
os.getenv('APILOGICPROJECT_DISABLE_RULES').startswith("T") or \
|
|
324
|
+
os.getenv('APILOGICPROJECT_DISABLE_RULES').startswith("t") or \
|
|
325
|
+
os.getenv('APILOGICPROJECT_DISABLE_RULES').startswith("Y") or \
|
|
326
|
+
os.getenv('APILOGICPROJECT_DISABLE_RULES').startswith("y")
|
|
327
|
+
if disable_rules:
|
|
328
|
+
app_logger.info("LogicBank rules disabled") # db opened 1st access
|
|
329
|
+
else: # genai may insert rules with no columns... WebG restarts with rules disabled
|
|
330
|
+
try:
|
|
331
|
+
LogicBank.activate(session=session, activator=declare_logic.declare_logic, constraint_event=constraint_handler)
|
|
332
|
+
except Exception as e:
|
|
333
|
+
app_logger.error("Logic Bank Activation Error: " + str(e))
|
|
334
|
+
app_logger.exception(e)
|
|
321
335
|
logic_logger.setLevel(logic_logger_level)
|
|
322
336
|
app_logger.info("Declare Logic complete - logic/declare_logic.py (rules + code)"
|
|
323
337
|
+ f' -- {len(database.models.metadata.tables)} tables loaded\n') # db opened 1st access
|
|
@@ -98,19 +98,32 @@ As shown above:
|
|
|
98
98
|
|
|
99
99
|
Your project is ready to run, but it's likely you'll want to customize it - declare logic, new endpoints, etc.
|
|
100
100
|
|
|
101
|
-
>> Tip: in particular, use the sample app to explore the value of ___declarative logic and security.___ Unique to API Logic Server, this is critical to unlocking the full value of API Logic Server.
|
|
102
101
|
|
|
103
|
-
|
|
102
|
+
<details markdown>
|
|
104
103
|
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
<summary>Important: explore customization examples</summary>
|
|
105
|
+
<br>
|
|
106
|
+
In particular, use the sample app to explore the value of declarative logic and security. Unique to API Logic Server, these are critical to unlocking the full value of API Logic Server.
|
|
107
107
|
|
|
108
|
-
>
|
|
109
|
-
|
|
108
|
+
<br>
|
|
109
|
+
|
|
110
|
+
To create the sample app for customization examples:
|
|
111
|
+
|
|
112
|
+
* `ApiLogicServer create --project-name=nw_sample --db_url=nw+`
|
|
113
|
+
* Or, open it in GitHub (use Shift + "." to view in project mode) - [click here](https://github.com/ApiLogicServer/demo)
|
|
110
114
|
|
|
111
|
-
To make customizations easy to explore,
|
|
115
|
+
To make customizations easy to explore, search for:
|
|
112
116
|
* `#als` will reveal key customization examples
|
|
113
|
-
* `Your Code Goes Here` to find key files to customize, summarized below
|
|
117
|
+
* `Your Code Goes Here` to find key files to customize, summarized in the table below.
|
|
118
|
+
|
|
119
|
+
</details>
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
The ___Key Customization Files___ listed in the table below are created as stubs, intended for you to add customizations that extend the created API, Logic and Web App.
|
|
124
|
+
|
|
125
|
+
* Since they are separate files, the project can be
|
|
126
|
+
[rebuilt](https://apilogicserver.github.io/Docs/Project-Rebuild/) (e.g., synchronized with a revised schema), preserving your customizations.
|
|
114
127
|
|
|
115
128
|
<br>
|
|
116
129
|
|
|
@@ -37,17 +37,19 @@ def declare_logic():
|
|
|
37
37
|
|
|
38
38
|
from logic_bank.logic_bank import Rule
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
error_msg="balance exceeds credit limit",
|
|
43
|
-
as_condition=lambda row: row.Balance <= row.CreditLimit)
|
|
44
|
-
|
|
45
|
-
# 2. Customer.Balance = Sum(Order.AmountTotal where date shipped is null)
|
|
46
|
-
Rule.sum(derive=Customer.Balance, as_sum_of=Order.AmountTotal,
|
|
47
|
-
where=lambda row: row.ShipDate is None)
|
|
40
|
+
from logic.logic_discovery.auto_discovery import discover_logic
|
|
41
|
+
discover_logic()
|
|
48
42
|
|
|
49
|
-
#
|
|
43
|
+
# Logic from GenAI: (or, use your IDE w/ code completion)n
|
|
44
|
+
Rule.sum(derive=Customer.Balance, as_sum_of=Order.AmountTotal, where=lambda row: row.ShipDate is None)
|
|
50
45
|
Rule.sum(derive=Order.AmountTotal, as_sum_of=Item.Amount)
|
|
46
|
+
# Rule.formula(derive=Item.amount, as_expression=lambda row: row.quantity * row.unit_price)
|
|
47
|
+
Rule.copy(derive=Item.UnitPrice, from_parent=Product.UnitPrice)
|
|
48
|
+
Rule.constraint(validate=Customer,
|
|
49
|
+
as_condition=lambda row: row.Balance <= row.CreditLimit,
|
|
50
|
+
error_msg="Customer balance ({row.balance}) exceeds credit limit ({row.credit_limit})")
|
|
51
|
+
|
|
52
|
+
# End Logic from GenAI
|
|
51
53
|
|
|
52
54
|
def derive_amount(row: Item, old_row: Item, logic_row: LogicRow):
|
|
53
55
|
amount = row.Quantity * row.UnitPrice
|
|
@@ -58,9 +60,6 @@ def declare_logic():
|
|
|
58
60
|
# 4. Items.Amount = Quantity * UnitPrice
|
|
59
61
|
Rule.formula(derive=Item.Amount, calling=derive_amount)
|
|
60
62
|
|
|
61
|
-
# 5. Store the Items.UnitPrice as a copy from Product.UnitPrice
|
|
62
|
-
Rule.copy(Item.UnitPrice, from_parent=Product.UnitPrice)
|
|
63
|
-
|
|
64
63
|
#als: Demonstrate that logic == Rules + Python (for extensibility)
|
|
65
64
|
|
|
66
65
|
def send_order_to_shipping(row: Order, old_row: Order, logic_row: LogicRow):
|
|
Binary file
|
|
Binary file
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"version": "0.2.0",
|
|
6
6
|
"configurations": [
|
|
7
7
|
{
|
|
8
|
-
"name": "GENAI",
|
|
8
|
+
"name": " * GENAI",
|
|
9
9
|
"type": "debugpy",
|
|
10
10
|
"request": "launch",
|
|
11
11
|
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
@@ -218,6 +218,103 @@
|
|
|
218
218
|
"NODE_ENV": "development"
|
|
219
219
|
}
|
|
220
220
|
},
|
|
221
|
+
{
|
|
222
|
+
"name": "Internal - GenAI smoke test - genai_demo",
|
|
223
|
+
"type": "debugpy",
|
|
224
|
+
"request": "launch",
|
|
225
|
+
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
226
|
+
"redirectOutput": true,
|
|
227
|
+
"cwd": "${workspaceFolder}",
|
|
228
|
+
"env": {
|
|
229
|
+
"PYTHONPATH": "",
|
|
230
|
+
"SECURITY_ENABLED": "False",
|
|
231
|
+
"PYTHONHASHSEED": "0",
|
|
232
|
+
"APILOGICSERVER_DEBUG": "False",
|
|
233
|
+
"OPT_LOCKING": "optional"},
|
|
234
|
+
"justMyCode": false,
|
|
235
|
+
"args": [ "genai", "--retries=-1",
|
|
236
|
+
"--using=${workspaceFolder}/system/genai/examples/genai_demo/genai_demo.prompt"],
|
|
237
|
+
"console": "internalConsole",
|
|
238
|
+
"internalConsoleOptions": "openOnSessionStart"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"name": " - GenAI informal logic - genai_demo",
|
|
242
|
+
"type": "debugpy",
|
|
243
|
+
"request": "launch",
|
|
244
|
+
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
245
|
+
"redirectOutput": true,
|
|
246
|
+
"cwd": "${workspaceFolder}",
|
|
247
|
+
"env": {
|
|
248
|
+
"PYTHONPATH": "",
|
|
249
|
+
"SECURITY_ENABLED": "False",
|
|
250
|
+
"PYTHONHASHSEED": "0",
|
|
251
|
+
"APILOGICSERVER_DEBUG": "False",
|
|
252
|
+
"OPT_LOCKING": "optional"},
|
|
253
|
+
"justMyCode": false,
|
|
254
|
+
"args": [ "genai", "--retries=-1",
|
|
255
|
+
"--using=${workspaceFolder}/system/genai/examples/genai_demo/genai_demo_informal.prompt"],
|
|
256
|
+
"console": "internalConsole",
|
|
257
|
+
"internalConsoleOptions": "openOnSessionStart"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"name": " - GenAI informal logic - emp_depts",
|
|
261
|
+
"type": "debugpy",
|
|
262
|
+
"request": "launch",
|
|
263
|
+
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
264
|
+
"redirectOutput": true,
|
|
265
|
+
"cwd": "${workspaceFolder}",
|
|
266
|
+
"env": {
|
|
267
|
+
"PYTHONPATH": "",
|
|
268
|
+
"SECURITY_ENABLED": "False",
|
|
269
|
+
"PYTHONHASHSEED": "0",
|
|
270
|
+
"APILOGICSERVER_DEBUG": "False",
|
|
271
|
+
"OPT_LOCKING": "optional"},
|
|
272
|
+
"justMyCode": false,
|
|
273
|
+
"args": [ "genai", "--retries=-1",
|
|
274
|
+
"--using=${workspaceFolder}/system/genai/examples/emp_depts/emp_dept.prompt"],
|
|
275
|
+
"console": "internalConsole",
|
|
276
|
+
"internalConsoleOptions": "openOnSessionStart"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": " - retry repaired-response",
|
|
280
|
+
"type": "debugpy",
|
|
281
|
+
"request": "launch",
|
|
282
|
+
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
283
|
+
"redirectOutput": true,
|
|
284
|
+
"cwd": "${workspaceFolder}",
|
|
285
|
+
"env": {
|
|
286
|
+
"PYTHONPATH": "",
|
|
287
|
+
"SECURITY_ENABLED": "False",
|
|
288
|
+
"PYTHONHASHSEED": "0",
|
|
289
|
+
"APILOGICSERVER_DEBUG": "False",
|
|
290
|
+
"OPT_LOCKING": "optional"},
|
|
291
|
+
"justMyCode": false,
|
|
292
|
+
"args": [ "genai", "--retries=-1",
|
|
293
|
+
"--using=genai_demo",
|
|
294
|
+
"--repaired-response=system/genai/examples/genai_demo/genai_demo.response_example"],
|
|
295
|
+
"console": "internalConsole",
|
|
296
|
+
"internalConsoleOptions": "openOnSessionStart"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"name": " - retry conversation",
|
|
300
|
+
"type": "debugpy",
|
|
301
|
+
"request": "launch",
|
|
302
|
+
"program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
|
|
303
|
+
"redirectOutput": true,
|
|
304
|
+
"cwd": "${workspaceFolder}",
|
|
305
|
+
"env": {
|
|
306
|
+
"PYTHONPATH": "",
|
|
307
|
+
"SECURITY_ENABLED": "False",
|
|
308
|
+
"PYTHONHASHSEED": "0",
|
|
309
|
+
"APILOGICSERVER_DEBUG": "False",
|
|
310
|
+
"OPT_LOCKING": "optional"},
|
|
311
|
+
"justMyCode": false,
|
|
312
|
+
"args": [ "genai", "--retries=-1",
|
|
313
|
+
"--using=retry-project",
|
|
314
|
+
"--using=system/genai/retry/conv"],
|
|
315
|
+
"console": "internalConsole",
|
|
316
|
+
"internalConsoleOptions": "openOnSessionStart"
|
|
317
|
+
},
|
|
221
318
|
{
|
|
222
319
|
"name": "Python: Module",
|
|
223
320
|
"type": "debugpy",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
version info: 0.
|
|
2
|
+
version info: 0.8 (10/24/2024)
|
|
3
3
|
---
|
|
4
4
|
## Welcome to API Logic Server
|
|
5
5
|
|
|
@@ -152,7 +152,7 @@ als genai --using=system/genai/examples/genai_demo/genai_demo.prompt
|
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
|
-
als genai --using=genai_demo.prompt --repaired-response=system/genai/
|
|
155
|
+
als genai --using=genai_demo.prompt --repaired-response=system/genai/examples/genai_demo/genai_demo_conversation/genai_demo_conversation_005.response-example
|
|
156
156
|
```
|
|
157
157
|
</br>
|
|
158
158
|
|
|
@@ -194,6 +194,43 @@ als genai --project-name='genai_demo_conversation' --using=system/genai/examples
|
|
|
194
194
|
```
|
|
195
195
|
</details>
|
|
196
196
|
</br>
|
|
197
|
+
<details markdown>
|
|
198
|
+
|
|
199
|
+
<summary> You can iterate with logic</summary>
|
|
200
|
+
|
|
201
|
+
<br>You can add new columns/tables, while keeping the prior model intact:
|
|
202
|
+
|
|
203
|
+
```bash title="Iterate With Logic"
|
|
204
|
+
als genai --project-name='genai_demo_iterative_logic' --using=system/genai/examples/genai_demo/genai_demo_iterative_logic
|
|
205
|
+
# open Docs/db.dbml
|
|
206
|
+
```
|
|
207
|
+
</details>
|
|
208
|
+
</br>
|
|
209
|
+
|
|
210
|
+
<details markdown>
|
|
211
|
+
|
|
212
|
+
<summary> You can declare informal logic</summary>
|
|
213
|
+
|
|
214
|
+
<br>You can declare rules using dot notation, or more informally:
|
|
215
|
+
|
|
216
|
+
```bash title="Informal Logic (no dot notation)"
|
|
217
|
+
als genai --using=system/genai/examples/genai_demo/genai_demo_informal.prompt
|
|
218
|
+
```
|
|
219
|
+
</details>
|
|
220
|
+
</br>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<details markdown>
|
|
224
|
+
|
|
225
|
+
<summary> Multi-Rule Logic</summary>
|
|
226
|
+
|
|
227
|
+
<br>You can add new columns/tables, while keeping the prior model intact:
|
|
228
|
+
|
|
229
|
+
```bash title="Multi-Rule Logic"
|
|
230
|
+
als genai --using=system/genai/examples/emp_depts/emp_dept.prompt
|
|
231
|
+
```
|
|
232
|
+
</details>
|
|
233
|
+
</br>
|
|
197
234
|
|
|
198
235
|
<details markdown>
|
|
199
236
|
|
|
@@ -225,7 +262,7 @@ als create --project-name=genai_demo --from-model=system/genai/temp/create_db_mo
|
|
|
225
262
|
Or, correct the chatgpt response, and
|
|
226
263
|
|
|
227
264
|
```bash
|
|
228
|
-
als genai --using=genai_demo.prompt --repaired-response=system/genai/
|
|
265
|
+
als genai --using=genai_demo.prompt --repaired-response=system/genai/examples/genai_demo/genai_demo.response_example
|
|
229
266
|
```
|
|
230
267
|
|
|
231
268
|
We have seen failures such as:
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# ALS/GenAI: Create an SQLite database
|
|
4
|
+
engine = create_engine('sqlite:///system/genai/temp/create_db_models.sqlite')
|
|
5
|
+
Base.metadata.create_all(engine)
|
|
6
|
+
|
|
7
|
+
Session = sessionmaker(bind=engine)
|
|
8
|
+
session = Session()
|
|
9
|
+
|
|
10
|
+
# ALS/GenAI: Prepare for sample data
|
|
11
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# created from response, to create create_db_models.sqlite, with test data
|
|
2
|
+
# that is used to create project
|
|
3
|
+
# should run without error in manager
|
|
4
|
+
# if not, check for decimal, indent, or import issues
|
|
5
|
+
|
|
6
|
+
import decimal
|
|
7
|
+
import logging
|
|
8
|
+
import sqlalchemy
|
|
9
|
+
from sqlalchemy.sql import func
|
|
10
|
+
from logic_bank.logic_bank import Rule
|
|
11
|
+
from sqlalchemy import create_engine, Column, Integer, String, Float, ForeignKey, Date, DateTime, Numeric, Boolean, Text
|
|
12
|
+
from sqlalchemy.types import *
|
|
13
|
+
from sqlalchemy.ext.declarative import declarative_base
|
|
14
|
+
from sqlalchemy.orm import sessionmaker
|
|
15
|
+
from sqlalchemy.orm import relationship
|
|
16
|
+
from datetime import date
|
|
17
|
+
from datetime import datetime
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
logging.getLogger('sqlalchemy.engine.Engine').disabled = True # remove for additional logging
|
|
21
|
+
|
|
22
|
+
Base = declarative_base() # from system/genai/create_db_models_inserts/create_db_models_prefix.py
|
|
@@ -2,7 +2,7 @@ Create a system with customers, orders, items and products.
|
|
|
2
2
|
|
|
3
3
|
Include a notes field for orders.
|
|
4
4
|
|
|
5
|
-
Use LogicBank to
|
|
5
|
+
Use LogicBank to enforce the Check Credit requirement:
|
|
6
6
|
1. Customer.balance <= credit_limit
|
|
7
7
|
2. Customer.balance = Sum(Order.amount_total where date_shipped is null)
|
|
8
8
|
3. Order.amount_total = Sum(Item.amount)
|