ApiLogicServer 14.5.0__py3-none-any.whl → 14.5.4__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.
- api_logic_server_cli/add_cust/add_cust.py +7 -21
- api_logic_server_cli/api_logic_server.py +4 -2
- api_logic_server_cli/api_logic_server_info.yaml +2 -2
- api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/dbml.py +3 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/{mcp_server_executor.py → mcp_discovery.py} +1 -43
- api_logic_server_cli/prototypes/basic_demo/customizations/config/server_setup.py +388 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +139 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/README_mcp.md +3 -1
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +144 -131
- api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +22 -2
- api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py +1 -1
- api_logic_server_cli/prototypes/nw/logic/declare_logic.py +2 -2
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/app.json +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/appearance.json +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/core-plugins.json +31 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/workspace.json +166 -0
- apilogicserver-14.5.4.dist-info/METADATA +168 -0
- {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/RECORD +25 -43
- {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/WHEEL +1 -1
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/proper_update_def.json +0 -71
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/1_langchain_loader.py +0 -71
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/2_gpt_mcp_prompt.txt +0 -19
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_flow.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_orchestration.yaml +0 -49
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/wny mcp flows.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/natlang_to_api.py +0 -73
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/curl.txt +0 -5
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP Overview.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Arch.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Overview_Executor.png +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/1 - prompt_messages_array.json +0 -10
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/2 - completion_tool_context.json +0 -12
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/llm_schema.txt +0 -38
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_2.yaml +0 -17393
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3.yaml +0 -16660
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3_relaxed.yaml +0 -109
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_server.py +0 -51
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_serverZ.py +0 -72
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/validate_jsonapi.py +0 -64
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/run_executor.py +0 -23
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/swagger_converter.py +0 -65
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/z_old/3_executor_test_agent.py +0 -52
- api_logic_server_cli/prototypes/manager/README_X.md +0 -663
- apilogicserver-14.5.0.dist-info/METADATA +0 -76
- {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/entry_points.txt +0 -0
- {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
description: Flag high-value customers with recent activity and send to marketing service
|
|
3
|
-
|
|
4
|
-
steps:
|
|
5
|
-
- id: fetch_2024_orders
|
|
6
|
-
server: https://erp.company.com
|
|
7
|
-
tool_context:
|
|
8
|
-
tool: json-api
|
|
9
|
-
method: GET
|
|
10
|
-
url: /Order
|
|
11
|
-
query_params:
|
|
12
|
-
filter[date_shipped][gte]: "2024-01-01"
|
|
13
|
-
filter[date_shipped][lte]: "2024-12-31"
|
|
14
|
-
headers:
|
|
15
|
-
Accept: application/vnd.api+json
|
|
16
|
-
expected_output: Orders shipped in 2024
|
|
17
|
-
|
|
18
|
-
- id: aggregate_by_customer
|
|
19
|
-
type: local_processing
|
|
20
|
-
input: fetch_2024_orders
|
|
21
|
-
operation: |
|
|
22
|
-
Group orders by customer_id and sum amount_total.
|
|
23
|
-
Return list of customer_ids with total > 10000.
|
|
24
|
-
|
|
25
|
-
- id: fetch_customer_details
|
|
26
|
-
server: https://crm.company.com
|
|
27
|
-
tool_context:
|
|
28
|
-
tool: json-api
|
|
29
|
-
method: GET
|
|
30
|
-
url: /Customer
|
|
31
|
-
query_params:
|
|
32
|
-
filter[id]: "{{ aggregate_by_customer.output.customer_ids }}"
|
|
33
|
-
headers:
|
|
34
|
-
Accept: application/vnd.api+json
|
|
35
|
-
expected_output: High-value customer details
|
|
36
|
-
|
|
37
|
-
- id: notify_marketing
|
|
38
|
-
server: https://marketing.company.com
|
|
39
|
-
tool_context:
|
|
40
|
-
tool: json-api
|
|
41
|
-
method: POST
|
|
42
|
-
url: /CampaignTrigger
|
|
43
|
-
body:
|
|
44
|
-
campaign: "VIP Outreach Q1"
|
|
45
|
-
customer_ids: "{{ aggregate_by_customer.output.customer_ids }}"
|
|
46
|
-
headers:
|
|
47
|
-
Accept: application/vnd.api+json
|
|
48
|
-
Content-Type: application/json
|
|
49
|
-
expected_output: Marketing campaign initiated
|
|
Binary file
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import openai
|
|
2
|
-
import requests
|
|
3
|
-
import json
|
|
4
|
-
import os
|
|
5
|
-
|
|
6
|
-
# Set your OpenAI API key here or via environment variable
|
|
7
|
-
openai.api_key = os.getenv("OPENAI_API_KEY") or "sk-proj-..."
|
|
8
|
-
|
|
9
|
-
# The base ngrok URL of your live JSON:API server
|
|
10
|
-
NGROK_BASE_URL = "https://mcp_url.ngrok-free.app"
|
|
11
|
-
|
|
12
|
-
def ask_gpt_for_tool_context(natural_language_goal):
|
|
13
|
-
prompt = f"""
|
|
14
|
-
You are an API planning assistant.
|
|
15
|
-
|
|
16
|
-
You receive a natural language goal and must generate a JSON tool_context for an API call.
|
|
17
|
-
|
|
18
|
-
The API follows JSON:API 1.1 and lives at: {NGROK_BASE_URL}/api
|
|
19
|
-
Available resources: Customer, Order, Product
|
|
20
|
-
|
|
21
|
-
Goal: "{natural_language_goal}"
|
|
22
|
-
|
|
23
|
-
Respond ONLY with JSON in the following format:
|
|
24
|
-
{{
|
|
25
|
-
"method": "GET",
|
|
26
|
-
"url": "<full URL>",
|
|
27
|
-
"query_params": {{ ... }},
|
|
28
|
-
"headers": {{
|
|
29
|
-
"Accept": "application/vnd.api+json"
|
|
30
|
-
}},
|
|
31
|
-
"expected_output": "Brief description of expected result"
|
|
32
|
-
}}
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
response = openai.ChatCompletion.create(
|
|
36
|
-
model="gpt-4",
|
|
37
|
-
messages=[{"role": "user", "content": prompt}],
|
|
38
|
-
temperature=0
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
# Extract tool_context JSON block from the assistant message
|
|
42
|
-
message = response["choices"][0]["message"]["content"]
|
|
43
|
-
try:
|
|
44
|
-
tool_context = json.loads(message)
|
|
45
|
-
return tool_context
|
|
46
|
-
except json.JSONDecodeError:
|
|
47
|
-
print("Failed to parse GPT response as JSON:")
|
|
48
|
-
print(message)
|
|
49
|
-
return None
|
|
50
|
-
|
|
51
|
-
def execute_tool_context(tool_context):
|
|
52
|
-
try:
|
|
53
|
-
response = requests.get(
|
|
54
|
-
tool_context["url"],
|
|
55
|
-
headers=tool_context["headers"],
|
|
56
|
-
params=tool_context["query_params"],
|
|
57
|
-
timeout=10
|
|
58
|
-
)
|
|
59
|
-
print(f"✅ Response ({response.status_code}):")
|
|
60
|
-
print(json.dumps(response.json(), indent=2))
|
|
61
|
-
except Exception as e:
|
|
62
|
-
print(f"❌ Request failed: {e}")
|
|
63
|
-
|
|
64
|
-
if __name__ == "__main__":
|
|
65
|
-
print("Enter your natural language goal (e.g., 'List 3 customers from Germany'):")
|
|
66
|
-
goal = input("> ")
|
|
67
|
-
|
|
68
|
-
tc = ask_gpt_for_tool_context(goal)
|
|
69
|
-
if tc:
|
|
70
|
-
print("GPT tool_context:")
|
|
71
|
-
print(json.dumps(tc, indent=2))
|
|
72
|
-
print("Executing API call...")
|
|
73
|
-
execute_tool_context(tc)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"role": "system",
|
|
4
|
-
"content": "You are a backend planner that translates natural language queries into JSON:API tool context blocks. You are given a resource schema and a user query. Respond only with a JSON block that specifies how to call the JSON:API using filter parameters."
|
|
5
|
-
},
|
|
6
|
-
{
|
|
7
|
-
"role": "user",
|
|
8
|
-
"content": "Schema:\n\nCustomer:\n - id (INTEGER)\n - name (VARCHAR)\n - balance (DECIMAL)\n - credit_limit (DECIMAL)\n * Filterable: name, balance, credit_limit\n * Example: 'List customers with credit over 5000'\n\nItem:\n - id (INTEGER)\n - order_id (INTEGER)\n - product_id (INTEGER)\n - quantity (INTEGER)\n - amount (DECIMAL)\n - unit_price (DECIMAL)\n * Filterable: order_id, product_id, unit_price\n * Relationships:\n ↪ relates to Order\n ↪ relates to Product\n * Example: 'Find all items for order 42'\n\nOrder:\n - id (INTEGER)\n - notes (VARCHAR)\n - customer_id (INTEGER)\n - date_shipped (DATE)\n - amount_total (DECIMAL)\n * Filterable: notes, customer_id, date_shipped, amount_total\n * Relationships:\n ↪ relates to Customer\n * Example: 'Get orders shipped in 2024'\n\nProduct:\n - id (INTEGER)\n - name (VARCHAR)\n - unit_price (DECIMAL)\n * Filterable: name, unit_price\n * Example: 'Show products with price over 100'\n\n---\n\nNatural language query: 'List all customers with credit limits over 4000.'\n\nRespond with a JSON object like:\n{\n \"tool\": \"json-api\",\n \"method\": \"GET\",\n \"url\": \"https://your-api-server/Customer\",\n \"query_params\": { \"filter[credit_limit][gt]\": \"4000\" },\n \"headers\": { \"Accept\": \"application/vnd.api+json\" },\n \"expected_output\": \"List of customers with high credit limits\"\n}"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tool": "json-api",
|
|
3
|
-
"method": "GET",
|
|
4
|
-
"url": "https://your-api-server/Customer",
|
|
5
|
-
"query_params": {
|
|
6
|
-
"filter[credit_limit][gt]": "4000"
|
|
7
|
-
},
|
|
8
|
-
"headers": {
|
|
9
|
-
"Accept": "application/vnd.api+json"
|
|
10
|
-
},
|
|
11
|
-
"expected_output": "List of customers with high credit limits"
|
|
12
|
-
}
|
api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/llm_schema.txt
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
Customer:
|
|
2
|
-
- id (INTEGER)
|
|
3
|
-
- name (VARCHAR)
|
|
4
|
-
- balance (DECIMAL)
|
|
5
|
-
- credit_limit (DECIMAL)
|
|
6
|
-
* Filterable: name, balance, credit_limit
|
|
7
|
-
* Example: 'List customers with credit over 5000'
|
|
8
|
-
|
|
9
|
-
Item:
|
|
10
|
-
- id (INTEGER)
|
|
11
|
-
- order_id (INTEGER)
|
|
12
|
-
- product_id (INTEGER)
|
|
13
|
-
- quantity (INTEGER)
|
|
14
|
-
- amount (DECIMAL)
|
|
15
|
-
- unit_price (DECIMAL)
|
|
16
|
-
* Filterable: order_id, product_id, unit_price
|
|
17
|
-
* Relationships:
|
|
18
|
-
↪ relates to Order
|
|
19
|
-
↪ relates to Product
|
|
20
|
-
* Example: 'Find all items for order 42'
|
|
21
|
-
|
|
22
|
-
Order:
|
|
23
|
-
- id (INTEGER)
|
|
24
|
-
- notes (VARCHAR)
|
|
25
|
-
- customer_id (INTEGER)
|
|
26
|
-
- date_shipped (DATE)
|
|
27
|
-
- amount_total (DECIMAL)
|
|
28
|
-
* Filterable: notes, customer_id, date_shipped, amount_total
|
|
29
|
-
* Relationships:
|
|
30
|
-
↪ relates to Customer
|
|
31
|
-
* Example: 'Get orders shipped in 2024'
|
|
32
|
-
|
|
33
|
-
Product:
|
|
34
|
-
- id (INTEGER)
|
|
35
|
-
- name (VARCHAR)
|
|
36
|
-
- unit_price (DECIMAL)
|
|
37
|
-
* Filterable: name, unit_price
|
|
38
|
-
* Example: 'Show products with price over 100'
|