fix: only allow 4 stop words for openai (#2457)
Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai>
This commit is contained in:
parent
7282728c93
commit
8303f74f58
@ -335,7 +335,12 @@ export const chatCompletions = async (request: any, reply: any) => {
|
|||||||
headers['api-key'] = apiKey
|
headers['api-key'] = apiKey
|
||||||
}
|
}
|
||||||
console.debug(apiUrl)
|
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 fetch = require('node-fetch')
|
||||||
const response = await fetch(apiUrl, {
|
const response = await fetch(apiUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user