Repository navigation
Commit 15d92a7
opentelemetry-instrumentation-genai-qwen-agent: support strict typing (open-telemetry#366)
* chore(qwen-agent): enable strict pyright type checking
Add the package to the pyright include list and exclude its tests and
examples, following the progressive rollout the config already describes.
Strict mode reported eight errors in utils.py, all from isinstance()
narrowing producing dict[Unknown, Unknown] / list[Unknown]. Narrow those
with cast(dict[str, Any], ...) and cast(list[Any], ...), matching the
existing idiom in the agno package. No behavior change.
Assisted-by: Claude Opus 5
* Add changelog fragment for strict typing support
* chore(qwen-agent): type message elements instead of casting to Any
The strict-mode narrowing was done with cast(list[Any], ...), which
satisfies pyright but throws away the element type. qwen-agent's own
Message and ContentItem describe those elements, so annotate the
signatures with them (under TYPE_CHECKING, since qwen-agent is an
optional dependency) and let pyright narrow the isinstance checks on
its own. All five list casts are gone as a result.
---------
Co-authored-by: Liudmila Molkova <neskazu@gmail.com>1 parent 2abfeac commit 15d92a7
3 files changed
Lines changed: 31 additions & 9 deletions
File tree
- instrumentation/opentelemetry-instrumentation-genai-qwen-agent
- .changelog
- src/opentelemetry/instrumentation/genai/qwen_agent
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
| |||
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
34 | | - | |
35 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
| |||
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | | - | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
71 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
72 | 84 | | |
73 | 85 | | |
74 | 86 | | |
| |||
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
130 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
131 | 145 | | |
132 | 146 | | |
133 | 147 | | |
| |||
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
173 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
174 | 190 | | |
175 | 191 | | |
176 | 192 | | |
| |||
213 | 229 | | |
214 | 230 | | |
215 | 231 | | |
216 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
217 | 235 | | |
218 | 236 | | |
219 | 237 | | |
| |||
249 | 267 | | |
250 | 268 | | |
251 | 269 | | |
252 | | - | |
| 270 | + | |
253 | 271 | | |
254 | 272 | | |
255 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| |||
0 commit comments