This repository was archived by the owner on Mar 9, 2026. It is now read-only.
Commit ab49577
committed
Add a function for centrally handling the engine list, with caching
This commit introduces a few key changes to the `Coder` class in `coder.py`:
1. Removed an unnecessary import and added `functools` to the import list.
2. Added a new method `get_openai_supported_engines` that fetches the list of models supported by the OpenAI API key. This method uses `functools.lru_cache` for caching the result, improving efficiency.
3. Refactored `get_llm_model_name` to use the new `get_openai_supported_engines` method, reducing code duplication and improving readability.
These changes should make the `Coder` class more efficient and easier to understand. 🧠💡1 parent fe7ddda commit ab49577
1 file changed
+15
-7
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 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
45 | 55 | | |
46 | 56 | | |
47 | 57 | | |
| |||
73 | 83 | | |
74 | 84 | | |
75 | 85 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
84 | | - | |
| 92 | + | |
85 | 93 | | |
86 | 94 | | |
87 | | - | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| |||
0 commit comments