File size: 2,106 Bytes
7c7ef49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Backend Development Plan

## 1. Category-Based System Instructions

- **Goal:** Support system instructions tailored to specific engineering categories (e.g., mechanical, structural, civil, architectural, electrical, aerospace).
- **Approach:**
  - Define a set of system instructions for each category.
  - **Allowed Categories:** 
    - mechanical
    - structural
    - civil
    - architectural
    - electrical
    - aerospace
  - Store these instructions in a configuration file (e.g., JSON or YAML) or a database.
  - Update API endpoints to accept a `category` parameter.
  - Use the selected category in the generation logic to apply corresponding instructions.
  - Provide a fallback to default instructions if the category isn't recognized.

## 2. API Changes

- **Add `category` field** to relevant request models (e.g., `TextGenerateRequest`, `ImageTextGenerateRequest`).
- **Validate the category** against the allowed values.
- **Pass category** to generation utilities to select appropriate instructions.
- **Logging and Error Handling:**
  - Log usage statistics for different categories.
  - Return clear error messages if an invalid category is provided.

## 3. Future Ideas and Enhancements

- Allow users to define custom categories or instructions.
- Add endpoints to list available categories along with their descriptions.
- Implement advanced logging and analytics to observe category usage.
- Support multi-category or hybrid instructions.
- **Extend the configuration:**
  - Provide detailed parameters per category (e.g., style, tone, structural guidelines).
  - Create a configuration file to manage these parameters centrally.
- Explore caching mechanisms for repeated generation requests per category.

---

## Next Steps

1. Define allowed categories and specify instructions per category.
2. Refactor request models and endpoints to include a `category` parameter.
3. Update generation logic to utilize category-specific instructions.
4. Develop a configuration file for system instructions per category.
5. Enhance error handling and logging for better maintainability.