Commit 849db5e
fix(openai): remove unreachable None type assignments for OpenAI classes (#1546)
The second try/except block that assigns None to AsyncOpenAI,
AsyncAzureOpenAI, AzureOpenAI, and OpenAI is unreachable because:
1. The first try/except raises ModuleNotFoundError if openai is missing
2. Line 28 already imports from openai._types (v1.x only), so if
execution reaches the second block, openai 1.x is installed
Merge both imports into a single try/except so type checkers correctly
infer these as their actual types instead of type | None.
Co-authored-by: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com>1 parent 3e0fa96 commit 849db5e
1 file changed
Lines changed: 1 addition & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 46 | | |
54 | 47 | | |
55 | 48 | | |
| |||
0 commit comments