Changesets · Branches · Tags · Compare
| Changeset | 494a780fdb257f42922f608db486ca3ba2e2be173103f9bfc44c61033d871fc5 |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-08-21 09:35 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-08-21 09:35 -07:00 |
| Parents | 438b2c9c3ac0 |
1 file changed
modified core/llm/openaiTypeConverters.ts +18 −14
| @@ -190,20 +190,24 @@ | ||
| 190 | 190 | content: delta.content, |
| 191 | 191 | }; |
| 192 | 192 | } else if (delta?.tool_calls) { |
| 193 | - return { | |
| 194 | - role: "assistant", | |
| 195 | - content: "", | |
| 196 | - toolCalls: delta?.tool_calls | |
| 197 | - .filter((tool_call) => !tool_call.type || tool_call.type === "function") | |
| 198 | - .map((tool_call) => ({ | |
| 199 | - id: tool_call.id, | |
| 200 | - type: "function" as const, | |
| 201 | - function: { | |
| 202 | - name: (tool_call as any).function?.name, | |
| 203 | - arguments: (tool_call as any).function?.arguments, | |
| 204 | - }, | |
| 205 | - })), | |
| 206 | - }; | |
| 193 | + const toolCalls = delta?.tool_calls | |
| 194 | + .filter((tool_call) => !tool_call.type || tool_call.type === "function") | |
| 195 | + .map((tool_call) => ({ | |
| 196 | + id: tool_call.id, | |
| 197 | + type: "function" as const, | |
| 198 | + function: { | |
| 199 | + name: (tool_call as any).function?.name, | |
| 200 | + arguments: (tool_call as any).function?.arguments, | |
| 201 | + }, | |
| 202 | + })); | |
| 203 | + | |
| 204 | + if (toolCalls.length > 0) { | |
| 205 | + return { | |
| 206 | + role: "assistant", | |
| 207 | + content: "", | |
| 208 | + toolCalls, | |
| 209 | + }; | |
| 210 | + } | |
| 207 | 211 | } |
| 208 | 212 | |
| 209 | 213 | return undefined; |