Commit 04e9b4c
authored
Implement model wrapper for AI content generation (#58)
### Issue
<!-- Please link the GitHub issues related to this PR, if available -->
### Description
This PR introduces the new ModelWrapper feature, which encapsulates
model logic using the pydantic-ai Agent. The ModelWrapper enables
flexible integration with multiple LLM providers and centralizes
AI-powered content generation. Key changes include:
- Addition of the `ModelWrapper` class in
`struct_module/model_wrapper.py`
- Integration of ModelWrapper into `FileItem` and related modules
- Improved test and workflow configuration to support AI model usage
- Ensured environment variable handling for API keys in CI and local
development
These changes improve modularity, testability, and future extensibility
for AI-powered features.
### Checklist
- [x] I have read the [contributing
guidelines](https://github.com/httpdss/struct/blob/main/README.md#contributing).
- [x] My code follows the code style of this project.
- [x] I have performed a self-review of my own code.
- [x] I have added tests that prove my fix is effective or that my
feature works.
- [x] New and existing unit tests pass locally with my changes.
- [x] I have updated the documentation accordingly.
### Screenshots (if applicable)
<!-- Add screenshots to illustrate the changes made in the pull request
-->
### Additional Comments
- The main feature is the ModelWrapper, which standardizes model usage
across the codebase.
- The test workflow now sets a dummy `OPENAI_API_KEY` for CI
compatibility.1 parent ee6537a commit 04e9b4c
File tree
6 files changed
+72
-39
lines changed- .devcontainer
- .github/workflows
- struct_module
6 files changed
+72
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
1 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 14 | | |
18 | 15 | | |
19 | 16 | | |
| |||
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | | - | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
39 | | - | |
| 34 | + | |
40 | 35 | | |
41 | 36 | | |
42 | 37 | | |
| |||
45 | 40 | | |
46 | 41 | | |
47 | 42 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | 43 | | |
58 | 44 | | |
59 | 45 | | |
60 | 46 | | |
61 | 47 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 48 | | |
66 | 49 | | |
67 | 50 | | |
68 | 51 | | |
69 | 52 | | |
70 | 53 | | |
71 | | - | |
72 | 54 | | |
73 | 55 | | |
74 | 56 | | |
75 | 57 | | |
76 | 58 | | |
77 | 59 | | |
78 | 60 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
97 | 66 | | |
98 | 67 | | |
99 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments