Commit c93bbe5
committed
feat: add fallback to regular completion on function‑call failures
- Add comment noting that some models do not support function calls and should use regular completion directly
- Attempt a function‑call based completion first, then fall back to regular completion if it fails
- Include error handling to retry with regular completion when the function call returns an error
- Return an error when the completion response does not contain exactly one choice
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>1 parent a3c7f0e commit c93bbe5
1 file changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
68 | 71 | | |
69 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| |||
0 commit comments