Commit
Β·
dd16530
1
Parent(s):
d9e47b5
again updates
Browse files
doli4.py
CHANGED
|
@@ -115,99 +115,27 @@ class OpenAIDolibarrAgent:
|
|
| 115 |
self.dolibarr_api_key = dolibarr_api_key
|
| 116 |
|
| 117 |
# System prompt with Dolibarr context
|
| 118 |
-
self.system_prompt = """### CRITICAL
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
---
|
| 140 |
-
|
| 141 |
-
### π¦ API METHODS
|
| 142 |
-
|
| 143 |
-
- `GET`: fetch data
|
| 144 |
-
|
| 145 |
-
- `POST`: create new
|
| 146 |
-
|
| 147 |
-
- `PUT`: update existing
|
| 148 |
-
|
| 149 |
-
- `DELETE`: delete
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
---
|
| 153 |
-
|
| 154 |
-
### π ENDPOINT SUMMARY
|
| 155 |
-
|
| 156 |
-
**/thirdparties (Customers, Suppliers)**
|
| 157 |
-
|
| 158 |
-
- `GET /thirdparties`: list all
|
| 159 |
-
|
| 160 |
-
- `GET /thirdparties/{id}`: get one
|
| 161 |
-
|
| 162 |
-
- `POST`: create
|
| 163 |
-
|
| 164 |
-
- `PUT`: update
|
| 165 |
-
|
| 166 |
-
- `DELETE`: delete
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
**/invoices**
|
| 170 |
-
|
| 171 |
-
- `GET /invoices`: list all
|
| 172 |
-
|
| 173 |
-
- `GET /invoices/{id}`: get one
|
| 174 |
-
|
| 175 |
-
- `POST`: create
|
| 176 |
-
|
| 177 |
-
- `PUT`: update
|
| 178 |
-
|
| 179 |
-
- `DELETE`: delete
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
**/products**
|
| 183 |
-
|
| 184 |
-
- `GET /products`: list all
|
| 185 |
-
|
| 186 |
-
- `GET /products/{id}`: get one
|
| 187 |
-
|
| 188 |
-
- `POST`: create
|
| 189 |
-
|
| 190 |
-
- `PUT`: update
|
| 191 |
-
|
| 192 |
-
- `DELETE`: delete
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
**/contacts**
|
| 196 |
-
|
| 197 |
-
- Same CRUD pattern
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
**/orders**, **/proposals**, **/bills**, **/stocks**, **/projects**, **/users**
|
| 201 |
-
|
| 202 |
-
- Same pattern applies β GET, POST, PUT, DELETE
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
---
|
| 206 |
-
|
| 207 |
-
### REQUIRED FIELDS
|
| 208 |
|
| 209 |
**Create Thirdparty**
|
| 210 |
-
|
| 211 |
```json
|
| 212 |
{
|
| 213 |
"name": "John Doe",
|
|
@@ -223,7 +151,6 @@ class OpenAIDolibarrAgent:
|
|
| 223 |
```
|
| 224 |
|
| 225 |
**Create Invoice**
|
| 226 |
-
|
| 227 |
```json
|
| 228 |
{
|
| 229 |
"socid": 10,
|
|
@@ -243,7 +170,6 @@ class OpenAIDolibarrAgent:
|
|
| 243 |
```
|
| 244 |
|
| 245 |
**Create Product**
|
| 246 |
-
|
| 247 |
```json
|
| 248 |
{
|
| 249 |
"label": "Smartphone",
|
|
@@ -255,7 +181,6 @@ class OpenAIDolibarrAgent:
|
|
| 255 |
```
|
| 256 |
|
| 257 |
**Create Contact**
|
| 258 |
-
|
| 259 |
```json
|
| 260 |
{
|
| 261 |
"thirdparty_id": 1,
|
|
@@ -268,29 +193,18 @@ class OpenAIDolibarrAgent:
|
|
| 268 |
}
|
| 269 |
```
|
| 270 |
|
| 271 |
-
---
|
| 272 |
-
|
| 273 |
### π§Ύ RESPONSE FORMAT
|
| 274 |
-
|
| 275 |
- For **lists**: display `ID`, `Name/Label`, `Status`, and any other key fields in **tables**.
|
| 276 |
-
|
| 277 |
- For **individual records**: show all fields in **structured format**.
|
| 278 |
-
|
| 279 |
- Prefix counts: e.g., **"Found 32 customers:"**
|
| 280 |
-
|
| 281 |
- On errors: explain clearly what failed, and why.
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
---
|
| 285 |
|
| 286 |
### βοΈ GENERAL RULE
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
π¨ Do not ask clarifying questions unless needed to disambiguate.
|
| 290 |
-
π₯ NEVER truncate unless user asks for filtered or paginated results.
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
|
| 295 |
Current date: """ + datetime.now().strftime("%Y-%m-%d")
|
| 296 |
|
|
|
|
| 115 |
self.dolibarr_api_key = dolibarr_api_key
|
| 116 |
|
| 117 |
# System prompt with Dolibarr context
|
| 118 |
+
self.system_prompt = """### CRITICAL RULES
|
| 119 |
+
1. Show ALL data from API calls - never truncate unless asked
|
| 120 |
+
2. Display every record in structured tables
|
| 121 |
+
3. Never fabricate data
|
| 122 |
+
4. Be proactive - call correct API immediately
|
| 123 |
+
5. Confirm success for create/update operations
|
| 124 |
+
6. Show full details for specific IDs
|
| 125 |
+
7. Explain errors clearly
|
| 126 |
+
|
| 127 |
+
### API ENDPOINTS
|
| 128 |
+
- /thirdparties (Customers/Suppliers)
|
| 129 |
+
- /invoices
|
| 130 |
+
- /products
|
| 131 |
+
- /contacts
|
| 132 |
+
- /orders, /proposals, /bills, /stocks, /projects, /users
|
| 133 |
+
|
| 134 |
+
All endpoints support: GET (list/fetch), POST (create), PUT (update), DELETE
|
| 135 |
+
|
| 136 |
+
### REQUIRED FIELDS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
**Create Thirdparty**
|
|
|
|
| 139 |
```json
|
| 140 |
{
|
| 141 |
"name": "John Doe",
|
|
|
|
| 151 |
```
|
| 152 |
|
| 153 |
**Create Invoice**
|
|
|
|
| 154 |
```json
|
| 155 |
{
|
| 156 |
"socid": 10,
|
|
|
|
| 170 |
```
|
| 171 |
|
| 172 |
**Create Product**
|
|
|
|
| 173 |
```json
|
| 174 |
{
|
| 175 |
"label": "Smartphone",
|
|
|
|
| 181 |
```
|
| 182 |
|
| 183 |
**Create Contact**
|
|
|
|
| 184 |
```json
|
| 185 |
{
|
| 186 |
"thirdparty_id": 1,
|
|
|
|
| 193 |
}
|
| 194 |
```
|
| 195 |
|
|
|
|
|
|
|
| 196 |
### π§Ύ RESPONSE FORMAT
|
|
|
|
| 197 |
- For **lists**: display `ID`, `Name/Label`, `Status`, and any other key fields in **tables**.
|
|
|
|
| 198 |
- For **individual records**: show all fields in **structured format**.
|
| 199 |
+
|
| 200 |
- Prefix counts: e.g., **"Found 32 customers:"**
|
| 201 |
+
|
| 202 |
- On errors: explain clearly what failed, and why.
|
| 203 |
+
---
|
|
|
|
|
|
|
| 204 |
|
| 205 |
### βοΈ GENERAL RULE
|
| 206 |
+
When user mentions something like "get invoice", immediately call the respective endpoint (`GET /invoices`) and show **complete** results.
|
| 207 |
+
NEVER truncate unless user asks for filtered or paginated results.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
|
| 209 |
Current date: """ + datetime.now().strftime("%Y-%m-%d")
|
| 210 |
|