fix(openai/completions): use old method for instruct/davinci/text gen models (#1166)

This commit is contained in:
Danny Avila 2023-11-10 10:33:56 -05:00 committed by GitHub
parent d5259e1525
commit 9ca84edb9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -367,7 +367,7 @@ If your reverse proxy is compatible to OpenAI specs in every other way, it may s
let streamResult = null;
this.modelOptions.user = this.user;
const invalidBaseUrl = this.completionsUrl && extractBaseURL(this.completionsUrl) === null;
const useOldMethod = !!(this.azure || invalidBaseUrl);
const useOldMethod = !!(this.azure || invalidBaseUrl || !this.isChatCompletion);
if (typeof opts.onProgress === 'function' && useOldMethod) {
await this.getCompletion(
payload,
@ -702,9 +702,10 @@ ${convo}
if (typeof onProgress === 'function') {
modelOptions.stream = true;
}
if (this.isChatGptModel) {
if (this.isChatCompletion) {
modelOptions.messages = payload;
} else {
// TODO: unreachable code. Need to implement completions call for non-chat models
modelOptions.prompt = payload;
}