Changesets · Branches · Tags · Compare
| Changeset | 48bdf6762488e2327d00d0adb1b3fc921281f16f60a2a345d88fc5532fb7de36 |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-08-21 08:36 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-08-21 08:36 -07:00 |
| Parents | b0fcd0e0f7a0 |
3 files changed
modified core/llm/llm.test.ts +2 −1
| @@ -145,6 +145,7 @@ | ||
| 145 | 145 | description: "Say Hello", |
| 146 | 146 | parameters: { |
| 147 | 147 | type: "object", |
| 148 | + required: ["name"], | |
| 148 | 149 | properties: { |
| 149 | 150 | name: { |
| 150 | 151 | type: "string", |
| @@ -165,7 +166,7 @@ | ||
| 165 | 166 | }, |
| 166 | 167 | )) { |
| 167 | 168 | const typedChunk = chunk as AssistantChatMessage; |
| 168 | - if (!typedChunk.toolCalls) { | |
| 169 | + if (!typedChunk.toolCalls || typedChunk.toolCalls.length === 0) { | |
| 169 | 170 | continue; |
| 170 | 171 | } |
| 171 | 172 | const toolCall = typedChunk.toolCalls[0]; |
modified core/llm/openaiTypeConverters.ts +14 −18
| @@ -190,24 +190,20 @@ | ||
| 190 | 190 | content: delta.content, |
| 191 | 191 | }; |
| 192 | 192 | } else if (delta?.tool_calls) { |
| 193 | - const toolCalls = delta?.tool_calls | |
| 194 | - .filter((tool_call) => 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 | - } | |
| 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 | + }; | |
| 211 | 207 | } |
| 212 | 208 | |
| 213 | 209 | return undefined; |
modified packages/openai-adapters/src/apis/Azure.ts +1 −1
| @@ -19,7 +19,7 @@ | ||
| 19 | 19 | const { baseURL, defaultQuery } = this._getAzureBaseURL(azureConfig); |
| 20 | 20 | |
| 21 | 21 | this.openai = new OpenAI({ |
| 22 | - apiKey: azureConfig.apiKey ?? "", | |
| 22 | + apiKey: azureConfig.apiKey, | |
| 23 | 23 | baseURL, |
| 24 | 24 | fetch: customFetch(azureConfig.requestOptions), |
| 25 | 25 | defaultQuery, |