ApiLogicServer 12.1.0__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.
Files changed (51) hide show
  1. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/METADATA +1 -1
  2. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/RECORD +47 -39
  3. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/WHEEL +1 -1
  4. api_logic_server_cli/api_logic_server.py +16 -4
  5. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  6. api_logic_server_cli/cli.py +20 -9
  7. api_logic_server_cli/cli_args_base.py +2 -0
  8. api_logic_server_cli/cli_args_project.py +9 -3
  9. api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
  10. api_logic_server_cli/create_from_model/__pycache__/ui_admin_creator.cpython-312.pyc +0 -0
  11. api_logic_server_cli/create_from_model/ont_create.py +3 -1
  12. api_logic_server_cli/create_from_model/ui_admin_creator.py +6 -4
  13. api_logic_server_cli/genai.py +386 -286
  14. api_logic_server_cli/logging.yml +5 -0
  15. api_logic_server_cli/prototypes/.DS_Store +0 -0
  16. api_logic_server_cli/prototypes/base/api_logic_server_run.py +0 -2
  17. api_logic_server_cli/prototypes/base/config/server_setup.py +15 -1
  18. api_logic_server_cli/prototypes/base/integration/kafka/kafka_consumer.py +1 -1
  19. api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +1 -1
  20. api_logic_server_cli/prototypes/base/readme.md +21 -8
  21. api_logic_server_cli/prototypes/manager/.DS_Store +0 -0
  22. api_logic_server_cli/prototypes/manager/.vscode/.DS_Store +0 -0
  23. api_logic_server_cli/prototypes/manager/.vscode/launch.json +20 -0
  24. api_logic_server_cli/prototypes/manager/README.md +25 -1
  25. api_logic_server_cli/prototypes/manager/system/.DS_Store +0 -0
  26. api_logic_server_cli/prototypes/manager/system/genai/.DS_Store +0 -0
  27. api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_create_db.py +1 -0
  28. api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_imports.py +10 -7
  29. api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_test_data.py +1 -1
  30. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +99 -22
  31. api_logic_server_cli/prototypes/manager/system/genai/learning_requests/logic_bank_api.prompt +120 -7
  32. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/.DS_Store +0 -0
  33. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/response_format.prompt +26 -2
  34. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/sqlite_inserts.prompt +10 -4
  35. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/{sqlite_inserts_iterations.prompt → zsqlite_inserts_iterations.prompt} +5 -2
  36. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/create_db_models.py +96 -0
  37. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_000.response +1 -0
  38. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_001.prompt +208 -0
  39. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_002.prompt +89 -0
  40. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_003.prompt +40 -0
  41. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_004.response +57 -0
  42. api_logic_server_cli/prototypes/manager/system/genai/retry/conv/inf-1_iter_1_1_005.response +57 -0
  43. api_logic_server_cli/prototypes/manager/system/genai/retry/readme.md +1 -0
  44. api_logic_server_cli/prototypes/manager/system/genai/retry/retry.response +57 -0
  45. api_logic_server_cli/genaiZ.py +0 -752
  46. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example_z +0 -130
  47. api_logic_server_cli/prototypes/manager/system/genai/prompt_inserts/web_genai copy.prompt +0 -15
  48. api_logic_server_cli/prototypes/manager/system/secrets.txt +0 -6
  49. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/LICENSE +0 -0
  50. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/entry_points.txt +0 -0
  51. {ApiLogicServer-12.1.0.dist-info → ApiLogicServer-12.1.26.dist-info}/top_level.txt +0 -0
@@ -1,130 +0,0 @@
1
- To achieve the given requirements using SQLAlchemy, follow these steps to create a SQLAlchemy ORM model for a SQLite database, create the database, and insert some test data.
2
-
3
- ### 1. Setup and Import Libraries
4
-
5
- First install SQLAlchemy if you haven't already:
6
- ```bash
7
- pip install sqlalchemy
8
- ```
9
-
10
- Then, you can write the code:
11
-
12
- ```python
13
- from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey, DECIMAL
14
- from sqlalchemy.ext.declarative import declarative_base
15
- from sqlalchemy.orm import sessionmaker, relationship
16
- import datetime
17
-
18
- # Create an instance of the declarative base class
19
- Base = declarative_base()
20
-
21
- # Define the Customer model
22
- class Customer(Base):
23
- """
24
- description: This table stores customer information, including a balance and credit limit.
25
- """
26
- __tablename__ = 'customers'
27
- id = Column(Integer, primary_key=True, autoincrement=True)
28
- name = Column(String, nullable=False)
29
- balance = Column(DECIMAL, nullable=False, default=0)
30
- credit_limit = Column(DECIMAL, nullable=False, default=0)
31
-
32
- # Define the Order model
33
- class Order(Base):
34
- """
35
- description: This table stores information about each order, including total amount and notes.
36
- """
37
- __tablename__ = 'orders'
38
- id = Column(Integer, primary_key=True, autoincrement=True)
39
- customer_id = Column(Integer, ForeignKey('customers.id'), nullable=False)
40
- date_placed = Column(DateTime, default=datetime.datetime.utcnow)
41
- date_shipped = Column(DateTime, nullable=True)
42
- amount_total = Column(DECIMAL, nullable=False)
43
- notes = Column(String, nullable=True)
44
-
45
- # Define the Product model
46
- class Product(Base):
47
- """
48
- description: This table stores product information, including unit prices.
49
- """
50
- __tablename__ = 'products'
51
- id = Column(Integer, primary_key=True, autoincrement=True)
52
- name = Column(String, nullable=False)
53
- unit_price = Column(DECIMAL, nullable=False)
54
-
55
- # Define the Item model
56
- class Item(Base):
57
- """
58
- description: This table stores each item in an order, including quantity, and unit price.
59
- """
60
- __tablename__ = 'items'
61
- id = Column(Integer, primary_key=True, autoincrement=True)
62
- order_id = Column(Integer, ForeignKey('orders.id'), nullable=False)
63
- product_id = Column(Integer, ForeignKey('products.id'), nullable=False)
64
- quantity = Column(Integer, nullable=False, default=1)
65
- unit_price = Column(DECIMAL, nullable=False)
66
- amount = Column(DECIMAL, nullable=False)
67
-
68
- # SQLite Database
69
- engine = create_engine('sqlite:///system/genai/temp/create_db_models.sqlite')
70
- Base.metadata.create_all(engine)
71
-
72
- Session = sessionmaker(bind=engine)
73
- session = Session()
74
-
75
- # Create some test data
76
- # Add test products
77
- product1 = Product(name='Product 1', unit_price=10.50)
78
- product2 = Product(name='Product 2', unit_price=15.75)
79
-
80
- # Add test customers
81
- customer1 = Customer(name='Customer 1', balance=0, credit_limit=500)
82
- customer2 = Customer(name='Customer 2', balance=0, credit_limit=1000)
83
-
84
- # Add test orders and items for customer1
85
- order1 = Order(customer_id=1, amount_total=0, notes='First Order')
86
- item1 = Item(order_id=1, product_id=1, quantity=2, unit_price=10.50, amount=21.00)
87
- item2 = Item(order_id=1, product_id=2, quantity=1, unit_price=15.75, amount=15.75)
88
-
89
- # Calculate order total
90
- order1.amount_total = item1.amount + item2.amount
91
-
92
- # Add order2
93
- order2 = Order(customer_id=1, amount_total=0, notes='Second Order')
94
- item3 = Item(order_id=2, product_id=1, quantity=1, unit_price=10.50, amount=10.50)
95
-
96
- # Calculate order2 total
97
- order2.amount_total = item3.amount
98
-
99
- # Set balance for customer1
100
- customer1.balance = order1.amount_total + order2.amount_total
101
-
102
- # Add test orders and items for customer2
103
- order3 = Order(customer_id=2, amount_total=0, notes='First Order for customer 2')
104
- item4 = Item(order_id=3, product_id=2, quantity=3, unit_price=15.75, amount=47.25)
105
-
106
- # Calculate order3 total
107
- order3.amount_total = item4.amount
108
-
109
- # Set balance for customer2
110
- customer2.balance = order3.amount_total
111
-
112
- # Add records to the session
113
- session.add_all([product1, product2, customer1, customer2, order1, item1, item2, order2, item3, order3, item4])
114
-
115
- # Commit the session
116
- session.commit()
117
-
118
- # Close the session
119
- session.close()
120
- ```
121
-
122
- ### Explanation:
123
-
124
- 1. **Database Models**: There are four main models: Customer, Order, Product, and Item. Each has its own table and columns defined.
125
-
126
- 2. **No Check Constraints**: Instead of using constraints for calculations, calculations are made in Python and are reflected in the ORM models (like order totals, item amounts, etc.).
127
-
128
- 3. **Adding Data**: Insert test data for products, customers, orders, and items. This includes calculating the amounts manually before adding them to ensure the database consistency requirements are met.
129
-
130
- Make sure to adapt the paths and environment as needed. This code should create the SQLite database, define the relationships, insert some records, and enforce the credit requirements logically within Python.
@@ -1,15 +0,0 @@
1
- Use SQLAlchemy to create a sqlite database named system/genai/temp/model.sqlite .
2
- the purpose of the database is:
3
-
4
- {{prompt}}
5
-
6
- Create at least 15 tables.
7
-
8
- Hints: use autonum keys, allow nulls, foreign keys, no check constraints.
9
- If you choose to use a date, only use python datetime datatype.
10
- Remember that SQLite DateTime type only accepts Python datetime and date objects as input, this means you can not enter string attributes where a date or datetime object is expected.
11
- Don't use python DECIMAL type.
12
- Don't install additional packages.
13
- Don't use the faker pip package.
14
-
15
- Create a few rows of sample data, use foreign key columns instead of relationship names for the data .
@@ -1,6 +0,0 @@
1
- APILOGICSERVER_CHATGPT_APIKEY=your-api-key-here
2
- # To obtain an api-key...
3
- # 1. Obtain a key: https://platform.openai.com/api-keys"
4
- # 2. Authorize payments at: https://platform.openai.com/settings/organization/billing/overview\n")
5
- # You can also store the api-key globally in the environment variable APILOGICSERVER_CHATGPT_APIKEY
6
- # but be sure to rename the key above