diff --git a/core/src/node/api/restful/helper/builder.ts b/core/src/node/api/restful/helper/builder.ts index 1ef8d34a4..e34fb606b 100644 --- a/core/src/node/api/restful/helper/builder.ts +++ b/core/src/node/api/restful/helper/builder.ts @@ -335,7 +335,12 @@ export const chatCompletions = async (request: any, reply: any) => { headers['api-key'] = apiKey } console.debug(apiUrl) - console.debug(JSON.stringify(headers)) + + if (requestedModel.engine === 'openai' && request.body.stop) { + // openai only allows max 4 stop words + request.body.stop = request.body.stop.slice(0, 4) + } + const fetch = require('node-fetch') const response = await fetch(apiUrl, { method: 'POST',