ApiLogicServer 14.5.3__py3-none-any.whl → 14.5.14__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.
Files changed (57) hide show
  1. api_logic_server_cli/api_logic_server.py +4 -122
  2. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  3. api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
  4. api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
  5. api_logic_server_cli/create_from_model/api_logic_server_utils.py +29 -10
  6. api_logic_server_cli/create_from_model/dbml.py +16 -9
  7. api_logic_server_cli/database/basic_demo.sqlite +0 -0
  8. api_logic_server_cli/genai/genai.py +4 -0
  9. api_logic_server_cli/genai/genai_svcs.py +10 -2
  10. api_logic_server_cli/manager.py +3 -1
  11. api_logic_server_cli/prototypes/base/.vscode/launch.json +40 -0
  12. api_logic_server_cli/prototypes/base/api/api_discovery/mcp_discovery.py +58 -0
  13. api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.py +68 -2
  14. api_logic_server_cli/prototypes/base/database/system/SAFRSBaseX.pyZ +73 -0
  15. api_logic_server_cli/prototypes/{basic_demo/customizations/integration → base/integration/mcp}/.DS_Store +0 -0
  16. api_logic_server_cli/prototypes/base/integration/mcp/README_mcp.md +15 -0
  17. api_logic_server_cli/prototypes/base/integration/mcp/mcp_client_executor.py +296 -0
  18. api_logic_server_cli/prototypes/base/integration/mcp/mcp_schema.txt +47 -0
  19. api_logic_server_cli/prototypes/base/integration/mcp/mcp_server_discovery.json +9 -0
  20. api_logic_server_cli/prototypes/base/integration/mcp/test_notes.txt +37 -0
  21. api_logic_server_cli/prototypes/basic_demo/README.md +251 -91
  22. api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/mcp_discovery.py +1 -44
  23. api_logic_server_cli/prototypes/basic_demo/customizations/database/db.sqlite +0 -0
  24. api_logic_server_cli/prototypes/basic_demo/customizations/database/models.py +27 -12
  25. api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +5 -2
  26. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/Zmcp_client_executor.py +294 -0
  27. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_tool_context.json +25 -0
  28. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/test_notes.txt +37 -0
  29. api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +1 -20
  30. api_logic_server_cli/prototypes/basic_demo/customizations/logic/logic_discovery/email_request.py +47 -0
  31. api_logic_server_cli/prototypes/basic_demo/customizations/logic/logic_discovery/mcp_client_executor_request.py +320 -0
  32. api_logic_server_cli/prototypes/basic_demo/customizations/logic/logic_discovery/simple_constraints.py +25 -0
  33. api_logic_server_cli/prototypes/basic_demo/customizations/ui/admin/admin.yaml +39 -32
  34. api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite +0 -0
  35. api_logic_server_cli/prototypes/basic_demo/iteration/ui/admin/admin.yaml +39 -44
  36. api_logic_server_cli/prototypes/manager/.vscode/launch.json +21 -0
  37. api_logic_server_cli/prototypes/manager/{README.md → READMEz.md} +4 -4
  38. api_logic_server_cli/prototypes/manager/REAMDE.md +1057 -0
  39. api_logic_server_cli/prototypes/manager/system/genai/mcp_learning/mcp.prompt +27 -0
  40. api_logic_server_cli/prototypes/manager/system/install-ApiLogicServer-dev/install-ApiLogicServer-dev.sh +2 -1
  41. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/METADATA +1 -1
  42. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/RECORD +46 -42
  43. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/WHEEL +1 -1
  44. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +0 -350
  45. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/3_executor_test_agent.py +0 -52
  46. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/README_functon.md +0 -201
  47. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/ai_plugin.json +0 -17
  48. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/nw-swagger_3.json +0 -1731
  49. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/snippets.txt +0 -5
  50. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3 genai_demo_with_get.json +0 -1731
  51. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3.json +0 -1782
  52. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo.json +0 -264
  53. api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo_with_update.json +0 -1782
  54. api_logic_server_cli/prototypes/genai_demo/logic/logic_discovery/auto_discovery.py +0 -52
  55. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/entry_points.txt +0 -0
  56. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/licenses/LICENSE +0 -0
  57. {apilogicserver-14.5.3.dist-info → apilogicserver-14.5.14.dist-info}/top_level.txt +0 -0
@@ -1,52 +0,0 @@
1
- import requests, json
2
-
3
- # MCP-style tool_context
4
- # does not like this pagination
5
- tool_context = {
6
- "method": "GET",
7
- "url": "http://localhost:5656/api/Customer",
8
- "query_params": {
9
- "filter[Country]": "Germany",
10
- "page[limit]": 2
11
- },
12
- "headers": {
13
- "Accept": "application/vnd.api+json"
14
- }
15
- }
16
-
17
- tool_context = { # use this for nw
18
- "method": "GET",
19
- "url": "http://localhost:5656/api/Customer",
20
- "query_params": {
21
- "filter[Country]": "Germany"
22
- },
23
- "headers": {
24
- "Accept": "application/vnd.api+json"
25
- , "Authorization": "Bearer your_token"
26
- }
27
- }
28
-
29
- tool_context = { # use this for genai_demo
30
- "method": "GET",
31
- "url": "http://localhost:5656/api/Customer",
32
- "query_params": {
33
- "filter[name]": "Alice"
34
- },
35
- "headers": {
36
- "Accept": "application/vnd.api+json"
37
- , "Authorization": "Bearer your_token"
38
- }
39
- }
40
-
41
- # Execute as a simulated MCP executor
42
- response = requests.get( # use this for genai_demo
43
- tool_context["url"],
44
- headers=tool_context["headers"],
45
- params=tool_context["query_params"]
46
- )
47
-
48
- # Display result
49
- print(response.status_code)
50
- # Print the response, format it as JSON with indent
51
- print(json.dumps(response.json(), indent=4))
52
-
@@ -1,201 +0,0 @@
1
- **OpenAI functions** are tools that extend the capabilities of ChatGPT by allowing it to access real-time data, perform actions, or connect with external services via APIs. .
2
-
3
- Instead of being limited to its pre-trained knowledge, ChatGPT can use plugins to retrieve up-to-date information (like live weather, stock prices, or databases) or perform tasks (like booking a flight or running a query).
4
-
5
- The goal is to turn ChatGPT into a more useful, interactive assistant that can bridge AI language understanding with real-world actions and live data.
6
-
7
- >For example, in large companies, it can be remarkably hard to find corporate systems via an Intranet, and use different user interfaces. ChatGPT can simplify finding these, and interacting with Natural Language.
8
-
9
- This is to explore:
10
-
11
- | Explore | Status |
12
- | ------------------------------------------ | -------------------- |
13
- | Nat Lang ALS Access using OpenAI Functions | Initial Test Running |
14
- | | |
15
-
16
- A value prop might be summarized: *instantly expose legacy DBs to Natural Language, including critical business logic and security, to simplify user discovery and operation.*
17
-
18
- <br>
19
-
20
- ## Status: Technology Exploration
21
-
22
- This is an initial experiment, without automation. Many substantive issues need to be addressed, including but not limited to security, update, etc.
23
-
24
- We welcome participation in this exploration. Please contact us via [discord](https://discord.gg/HcGxbBsgRF).
25
-
26
- This exploration is changing rapidly. For updates, replace `integration/mcp` from [integration/msp](https://github.com/ApiLogicServer/ApiLogicServer-src/tree/main/api_logic_server_cli/prototypes/nw_no_cust/integration/openai_plugin)
27
-
28
- <br>
29
-
30
- ## Nat Lang ALS Access using OpenAI Plugin
31
-
32
- Requires tunnel to local host such as [ngrok](https://ngrok.com/downloads/mac-os?tab=download), then
33
-
34
- ```
35
- ngrok config add-authtoken <obtain from https://dashboard.ngrok.com/get-started/setup/macos>
36
- ```
37
-
38
- then start the tunnel
39
-
40
- ```
41
- ngrok http 5656
42
- ```
43
-
44
- You should see:
45
-
46
- ![ngrok](https://github.com/ApiLogicServer/Docs/blob/main/docs/images/integration/mcp/ngrok.png?raw=true)
47
-
48
- and note the url like: `https://42da-2601-644-4900-etc.ngrok-free.app -> http://localhost:5656`
49
-
50
- We'll call it `tunnel_url`
51
-
52
- Enter this into `config/default.env`
53
-
54
- <br>
55
-
56
- ### Use GenAI_Demo
57
-
58
- See `mcp/README_mcp.md`
59
-
60
- <br>
61
-
62
- ### Obtain swagger_3
63
-
64
- This has already been done using the procedure described below.
65
-
66
- Obtain swagger 2 from API Logic Server, eg, http://localhost:5656/api/swagger.json)
67
-
68
- Convert to 3: https://converter.swagger.io or other.
69
-
70
- <br>
71
-
72
- #### Reduce to 30 Operations
73
-
74
- Reduce down to 30 operations (genai_demo has 69).
75
-
76
- For testing, you can copy `integration/openai_plugin/swagger_3_genai_demo.json` or `integration/openai_plugin/nw-swagger_3.json` over `integration/openai_plugin/swagger_3.json`.
77
-
78
- This was obtained using ChatGPT with prompts like:
79
-
80
- 1. Optionally collapse GET by ID and GET collection into a single endpoint using query params
81
- 2. remove POST from relationship endpoints
82
- 3. remove delete
83
- 4. collapse relationship endpoints further
84
-
85
- then fix the result:
86
-
87
- 1. ensure servers and paths is retained (got deleted for me), and includes https:
88
- 2. version 3.1.0
89
-
90
- Still seeing (fix with Chat):
91
-
92
- ```
93
- In path /Customer, method get is missing operationId; skipping
94
- In path /Customer, method post is missing operationId; skipping
95
- In path /Order, method get is missing operationId; skipping
96
- In path /Order, method post is missing operationId; skipping
97
- In path /Item, method get is missing operationId; skipping
98
- In path /Item, method post is missing operationId; skipping
99
- In path /Product, method get is missing operationId; skipping
100
- In path /Product, method post is missing operationId; skipping
101
- ```
102
-
103
- <br>
104
-
105
- ### Custom endpoint for openapi
106
-
107
- OpenAI requires a openai document, so observe the custom endpoint - `api/api_discovery/openapi` - eg, to test locally: `http://localhost:5656/api/openai.json`
108
-
109
- Note: the url for use in ChatGPT is the tunnelled version, from the env variable.
110
-
111
- <br>
112
-
113
- ### Configure in ChatGPT
114
-
115
- Then, upload it to the **Web** version of ChatGPT:
116
-
117
- 1. Explore GPTs
118
- 2. Create
119
- 3. Configure
120
- 4. Create New Action
121
-
122
- Provide the url of the openai endpoint:
123
-
124
- https://tunnel_url.ngrok-free.app/api/openapi.json
125
-
126
- <br>
127
-
128
- ### Retrieval worked:
129
-
130
- - list customers
131
- - list the items of order 1 with their product names
132
-
133
- <br>
134
-
135
- ### Update: Resoved, pending verification
136
-
137
- We also experimented with update, using `integration/openai_plugin/swagger_3.json`.
138
-
139
- > It initially failed to load, which we repaired as noted in Appendix 2.
140
-
141
- > It then failed to generate proper update API, evidently due to bad OpenAPI spec as noted in Appendix 3.
142
-
143
- <br>
144
-
145
- ## Appendices
146
-
147
- <br>
148
-
149
- ### Appendix 1: Create ai_plug_in.json
150
-
151
- We also looked at openai plugins. These appear to be discontinued.
152
-
153
- Prepare `ai_plug_in.json` as shown in this directory. Observe that it It identifies the url for finding the openapi through the tunnel.
154
-
155
- Note: both ALS and and `ai_plug_in.json` presume the swagger and api are consistent:
156
-
157
- - swagger is at `http://localhost:5656/api/swagger.json`,
158
- - typical API at `http://localhost:5656/api/Category`
159
-
160
- Not required for function - **Settings / Beta / Plugins > Plugin install → expects the ai-plugin.json manifest URL**
161
-
162
- This appears to be unavailable for ChatGPT 4o
163
-
164
- <br>
165
-
166
- ### Appendix 2: Updateable openapi
167
-
168
- It initially failed to load with
169
-
170
- ```
171
- In context=('paths', '/Customer/{CustomerId}/', 'patch', 'requestBody', 'content', 'application/json', 'schema'), reference to unknown component Customer_inst; using empty schema
172
-
173
- In path /Customer/{CustomerId}/, method patch, operationId UpdateCustomer_0, request body schema is not an object schema; skipping
174
-
175
- In path /Customer/{CustomerId}/, method patch, operationId UpdateCustomer_0, skipping function due to errors
176
- ```
177
-
178
- We requested a revised jasonapi from ChatGPT to clear these errors, which loaded.
179
-
180
- <br>
181
-
182
- ### Appendix 3: Invalid Data Object
183
-
184
- This appears to be caused by improper JSON:API openAPI spec, which caused ChatGPT to generate an improper json PATCH payload:
185
-
186
- ```python
187
- chatgpt_request_json = {
188
- "credit_limit": 25000,
189
- }
190
- standard_request_json = {
191
- "data": {
192
- "type": "Customer",
193
- "id": "ALFKI",
194
- "attributes": {
195
- "name": "Alice",
196
- "credit_limit": 25000,
197
- "balance": 12345
198
- }
199
- }
200
- }
201
- ```
@@ -1,17 +0,0 @@
1
- {
2
- "schema_version": "v1",
3
- "name_for_human": "ALS NW-",
4
- "name_for_model": "ALS NW",
5
- "description_for_human": "Access and manage categories, customers, and more.",
6
- "description_for_model": "Plugin for interacting with the API Logic Server.",
7
- "auth": {
8
- "type": "none"
9
- },
10
- "api": {
11
- "type": "openapi",
12
- "url": "https://tunnel_url.ngrok-free.app/api/openapi"
13
- },
14
- "logo_url": "https://your-logo-url/logo.png",
15
- "contact_email": "support@yourdomain.com",
16
- "legal_info_url": "https://yourdomain.com/legal"
17
- }