Commit c388e78
committed
Accept both text_completion and chat.completion in completions response
The OpenRouter API returns object: "chat.completion" for the /completions
endpoint, but the SDK was only accepting "text_completion". This caused
validation errors when using the completions.generate() method.
This change updates the CompletionResponse type and Zod schema to accept
either value, since the API behavior may vary or change.
Also added an E2E test to verify completions work correctly.
Fixes #1011 parent a96ad34 commit c388e78
File tree
3 files changed
+40
-3
lines changed- .speakeasy
- src/models
- tests/e2e
3 files changed
+40
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6189 | 6189 | | |
6190 | 6190 | | |
6191 | 6191 | | |
6192 | | - | |
| 6192 | + | |
| 6193 | + | |
| 6194 | + | |
6193 | 6195 | | |
6194 | 6196 | | |
6195 | 6197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 35 | + | |
0 commit comments