Skip to content

Commit

Permalink
fix(openai/completions): use old method for instruct/davinci/text gen…
Browse files Browse the repository at this point in the history
… models (danny-avila#1166)
  • Loading branch information
danny-avila authored Nov 10, 2023
1 parent d5259e1 commit 9ca84ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/app/clients/OpenAIClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9ca84ed

Please sign in to comment.