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

@@ -76,7 +76,7 @@
"nextjs-cors": "2.1.2", "nextjs-cors": "2.1.2",
"nodemailer": "6.9.3", "nodemailer": "6.9.3",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"openai": "4.24.1", "openai": "4.26.0",
"papaparse": "5.4.1", "papaparse": "5.4.1",
"prettier": "2.8.8", "prettier": "2.8.8",
"qs": "6.11.2", "qs": "6.11.2",

View File

@@ -20,7 +20,7 @@
"@typebot.io/js": "workspace:*", "@typebot.io/js": "workspace:*",
"@typebot.io/nextjs": "workspace:*", "@typebot.io/nextjs": "workspace:*",
"@typebot.io/prisma": "workspace:*", "@typebot.io/prisma": "workspace:*",
"ai": "2.2.31", "ai": "2.2.33",
"bot-engine": "workspace:*", "bot-engine": "workspace:*",
"cors": "2.8.5", "cors": "2.8.5",
"google-spreadsheet": "4.1.1", "google-spreadsheet": "4.1.1",
@@ -28,7 +28,7 @@
"next": "14.1.0", "next": "14.1.0",
"nextjs-cors": "2.1.2", "nextjs-cors": "2.1.2",
"nodemailer": "6.9.3", "nodemailer": "6.9.3",
"openai": "4.24.1", "openai": "4.26.0",
"qs": "6.11.2", "qs": "6.11.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",

View File

@@ -18,7 +18,7 @@
"@typebot.io/tsconfig": "workspace:*", "@typebot.io/tsconfig": "workspace:*",
"@typebot.io/variables": "workspace:*", "@typebot.io/variables": "workspace:*",
"@udecode/plate-common": "21.1.5", "@udecode/plate-common": "21.1.5",
"ai": "2.2.31", "ai": "2.2.33",
"chrono-node": "2.7.0", "chrono-node": "2.7.0",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"google-auth-library": "8.9.0", "google-auth-library": "8.9.0",
@@ -27,7 +27,7 @@
"libphonenumber-js": "1.10.37", "libphonenumber-js": "1.10.37",
"node-html-parser": "6.1.5", "node-html-parser": "6.1.5",
"nodemailer": "6.9.3", "nodemailer": "6.9.3",
"openai": "4.24.1", "openai": "4.26.0",
"qs": "6.11.2", "qs": "6.11.2",
"stripe": "12.13.0" "stripe": "12.13.0"
}, },

View File

@@ -13,7 +13,7 @@
"typescript": "5.3.2" "typescript": "5.3.2"
}, },
"dependencies": { "dependencies": {
"@mistralai/mistralai": "^0.0.10", "@mistralai/mistralai": "0.0.10",
"ai": "2.2.31" "ai": "2.2.33"
} }
} }

View File

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

View File

@@ -7,8 +7,8 @@
"author": "Baptiste Arnaud", "author": "Baptiste Arnaud",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ai": "2.2.31", "ai": "2.2.33",
"openai": "4.24.1" "openai": "4.26.0"
}, },
"devDependencies": { "devDependencies": {
"@typebot.io/forge": "workspace:*", "@typebot.io/forge": "workspace:*",

42
pnpm-lock.yaml generated
View File

@@ -222,8 +222,8 @@ importers:
specifier: 0.2.0 specifier: 0.2.0
version: 0.2.0 version: 0.2.0
openai: openai:
specifier: 4.24.1 specifier: 4.26.0
version: 4.24.1 version: 4.26.0
papaparse: papaparse:
specifier: 5.4.1 specifier: 5.4.1
version: 5.4.1 version: 5.4.1
@@ -497,8 +497,8 @@ importers:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/prisma version: link:../../packages/prisma
ai: ai:
specifier: 2.2.31 specifier: 2.2.33
version: 2.2.31(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15) version: 2.2.33(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15)
bot-engine: bot-engine:
specifier: workspace:* specifier: workspace:*
version: link:../../packages/deprecated/bot-engine version: link:../../packages/deprecated/bot-engine
@@ -521,8 +521,8 @@ importers:
specifier: 6.9.3 specifier: 6.9.3
version: 6.9.3 version: 6.9.3
openai: openai:
specifier: 4.24.1 specifier: 4.26.0
version: 4.24.1 version: 4.26.0
qs: qs:
specifier: 6.11.2 specifier: 6.11.2
version: 6.11.2 version: 6.11.2
@@ -657,8 +657,8 @@ importers:
specifier: 21.1.5 specifier: 21.1.5
version: 21.1.5(react-dom@18.2.0)(react@18.2.0)(scheduler@0.23.0)(slate-history@0.93.0)(slate-react@0.94.2)(slate@0.94.1) version: 21.1.5(react-dom@18.2.0)(react@18.2.0)(scheduler@0.23.0)(slate-history@0.93.0)(slate-react@0.94.2)(slate@0.94.1)
ai: ai:
specifier: 2.2.31 specifier: 2.2.33
version: 2.2.31(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15) version: 2.2.33(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15)
chrono-node: chrono-node:
specifier: 2.7.0 specifier: 2.7.0
version: 2.7.0 version: 2.7.0
@@ -684,8 +684,8 @@ importers:
specifier: 6.9.3 specifier: 6.9.3
version: 6.9.3 version: 6.9.3
openai: openai:
specifier: 4.24.1 specifier: 4.26.0
version: 4.24.1 version: 4.26.0
qs: qs:
specifier: 6.11.2 specifier: 6.11.2
version: 6.11.2 version: 6.11.2
@@ -1230,11 +1230,11 @@ importers:
packages/forge/blocks/mistral: packages/forge/blocks/mistral:
dependencies: dependencies:
'@mistralai/mistralai': '@mistralai/mistralai':
specifier: ^0.0.10 specifier: 0.0.10
version: 0.0.10 version: 0.0.10
ai: ai:
specifier: 2.2.31 specifier: 2.2.33
version: 2.2.31(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15) version: 2.2.33(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15)
devDependencies: devDependencies:
'@typebot.io/forge': '@typebot.io/forge':
specifier: workspace:* specifier: workspace:*
@@ -1255,11 +1255,11 @@ importers:
packages/forge/blocks/openai: packages/forge/blocks/openai:
dependencies: dependencies:
ai: ai:
specifier: 2.2.31 specifier: 2.2.33
version: 2.2.31(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15) version: 2.2.33(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15)
openai: openai:
specifier: 4.24.1 specifier: 4.26.0
version: 4.24.1 version: 4.26.0
devDependencies: devDependencies:
'@typebot.io/forge': '@typebot.io/forge':
specifier: workspace:* specifier: workspace:*
@@ -10548,8 +10548,8 @@ packages:
indent-string: 5.0.0 indent-string: 5.0.0
dev: true dev: true
/ai@2.2.31(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15): /ai@2.2.33(react@18.2.0)(solid-js@1.7.8)(svelte@4.2.9)(vue@3.4.15):
resolution: {integrity: sha512-WQH13RxP+RYo9IE/FX8foNQh9gcKO/dhl9OGy5JL2bHJVBlnugPmH2CYJWaRt+mvjXHaU8txB+jzGo/fbtH2HA==} resolution: {integrity: sha512-y9iMgt/RjFZCrjx5NuC+tdZqvunM9Bo1ufuC1BpgyjPmmE2RYduM+3Whjez0fu808KkwTQvvhUhhC5NkAy8/9g==}
engines: {node: '>=14.6'} engines: {node: '>=14.6'}
peerDependencies: peerDependencies:
react: ^18.2.0 react: ^18.2.0
@@ -17922,8 +17922,8 @@ packages:
is-docker: 2.2.1 is-docker: 2.2.1
is-wsl: 2.2.0 is-wsl: 2.2.0
/openai@4.24.1: /openai@4.26.0:
resolution: {integrity: sha512-ezm/O3eiZMnyBqirUnWm9N6INJU1WhNtz+nK/Zj/2oyKvRz9pgpViDxa5wYOtyGYXPn1sIKBV0I/S4BDhtydqw==} resolution: {integrity: sha512-HPC7tgYdeP38F3uHA5WgnoXZyGbAp9jgcIo23p6It+q/07u4C+NZ8xHKlMShsPbDDmFRpPsa3vdbXYpbhJH3eg==}
hasBin: true hasBin: true
dependencies: dependencies:
'@types/node': 18.11.18 '@types/node': 18.11.18