2
0

🐛 (openai) Fix 400 error when tools array empty

Closes #1205
This commit is contained in:
Baptiste Arnaud
2024-02-02 11:03:17 +01:00
parent b660611573
commit c6161179d0
7 changed files with 32 additions and 32 deletions

View File

@ -230,7 +230,7 @@ export const createChatCompletion = createAction({
? Number(options.temperature)
: undefined,
messages,
tools,
tools: (tools?.length ?? 0) > 0 ? tools : undefined,
}
let totalTokens = 0
@ -329,7 +329,7 @@ export const createChatCompletion = createAction({
: undefined,
stream: true,
messages,
tools,
tools: (tools?.length ?? 0) > 0 ? tools : undefined,
})
return OpenAIStream(response, {