Repository navigation
Commit 9927124
fix(obs): read litellm's provider list defensively, and say so if it goes
CI's lint job runs pyright, which `ruff check` alone does not: two errors, both
mine — `"openai_compatible_providers" is not exported from module "litellm"`
(reportPrivateImportUsage). Pyright is right. The attribute is real at runtime
but is not in litellm's `__all__`, so it is not a promised export and a future
release may rename or drop it.
Read via `getattr` now, which fixes the lint and, more to the point, degrades
instead of raising if it does disappear.
But degrading quietly would silently re-introduce the exact double counting the
previous commit fixed: without litellm's list only five providers are known to
reach the model over the OpenAI client, so groq, deepseek, xai and ~50 others
would look native again and be recorded twice — once here and once by the
OpenAI client instrumentor. So the fallback warns and names what it can no
longer recognise. Covered by a test that deletes the attribute and asserts both
halves: azure still resolves, groq no longer does, and the warning fires.
Verified with the real CI entry points rather than a subset: `./scripts/lint`
(ruff over the whole tree, pyright, import check) and `./scripts/check-slim-deps`
both clean. Tests 34 in this file, 1714 repo-wide.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 3ba999c commit 9927124
2 files changed
Lines changed: 39 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
68 | 76 | | |
69 | | - | |
70 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
71 | 90 | | |
72 | | - | |
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
131 | 148 | | |
132 | 149 | | |
133 | 150 | | |
| |||
0 commit comments