Commit 32a031f
committed
fix(agent): make reasoning_effort a real Literal instead of a function call
`reasoning_effort: Literal[get_reasoning_efforts()]` is not valid typing.
Literal takes literal members, so every type checker rejects a call there,
and the annotation is evaluated when the class body runs -- which calls
get_reasoning_efforts(), and that function does `import litellm` to read the
values off litellm.completion's signature.
Spell the members out as a ReasoningEffort Literal and derive the tuple from
it with get_args, so the static type and the runtime tuple cannot disagree.
get_reasoning_efforts() is unchanged and still unions whatever the installed
litellm advertises, so no accepted value is narrowed.1 parent cfc4366 commit 32a031f
2 files changed
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
0 commit comments