Repository navigation
Commit 68e4317
authored
fix(api): avoid loading unrelated API resources on first use (openai#3898)
Importing the SDK or accessing one API resource currently loads
unrelated resources, including Assistants. Load resource exports and
streaming helpers when first accessed to reduce startup work.
Existing import paths, class identity, static typing, wildcard imports,
and discovery are preserved. Code that inspects module dictionaries
directly may observe exports appearing later; import work and import
errors move to first access.
Regression tests cover import isolation, public exports, runtime
annotations, pickling, reloads, sync/async requests and streams, and
concurrent first access. Endpoint methods, models, dependencies, and
webhook behavior are unchanged.
Validation: 682 focused tests passed (14 skipped), along with Mypy,
Pyright, and Ruff. Python 3.10/3.14, HTTPX2, build, lint, and baseline
checks passed on the final revision. End-to-end testing also passed.
Co-authored-by: marcuswood-oai <323319819+marcuswood-oai@users.noreply.github.com>1 parent dcbd6b8 commit 68e4317
44 files changed
Lines changed: 3536 additions & 1170 deletions
File tree
- src/openai
- lib/streaming
- resources
- admin
- organization
- groups
- projects
- groups
- service_accounts
- users
- users
- audio
- beta
- agents
- environments
- sessions
- subagents
- turns
- vaults
- chatkit
- responses
- threads
- runs
- chat
- completions
- containers
- files
- conversations
- evals
- runs
- fine_tuning
- alpha
- checkpoints
- jobs
- live
- realtime
- responses
- safety
- skills
- versions
- uploads
- vector_stores
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
115 | 132 | | |
116 | 133 | | |
117 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 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 | + | |
0 commit comments