chore: moving from im_end to completion params

As we allow the constructor to define completionParams, it would be better to allow devs using the library to use the specified stop token.
As of right now, the library allows such stop to be passed but it isn't considered in the class itself.
pull/299/head
Michael Di Prisco 2023-02-04 09:44:51 +01:00 zatwierdzone przez GitHub
rodzic d8072bb3e1
commit 329e076189
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -307,7 +307,7 @@ Current date: ${currentDate}\n\n`
const maxNumTokens = this._maxModelTokens - this._maxResponseTokens const maxNumTokens = this._maxModelTokens - this._maxResponseTokens
let { parentMessageId } = opts let { parentMessageId } = opts
let nextPromptBody = `${this._userLabel}:\n\n${message}<|im_end|>` let nextPromptBody = `${this._userLabel}:\n\n${message}${this._completionParams.stop}`
let promptBody = '' let promptBody = ''
let prompt: string let prompt: string
let numTokens: number let numTokens: number
@ -343,7 +343,7 @@ Current date: ${currentDate}\n\n`
parentMessageRole === 'user' ? this._userLabel : this._assistantLabel parentMessageRole === 'user' ? this._userLabel : this._assistantLabel
// TODO: differentiate between assistant and user messages // TODO: differentiate between assistant and user messages
const parentMessageString = `${parentMessageRoleDesc}:\n\n${parentMessage.text}<|im_end|>\n\n` const parentMessageString = `${parentMessageRoleDesc}:\n\n${parentMessage.text}${this._completionParams.stop}\n\n`
nextPromptBody = `${parentMessageString}${promptBody}` nextPromptBody = `${parentMessageString}${promptBody}`
parentMessageId = parentMessage.parentMessageId parentMessageId = parentMessage.parentMessageId
} while (true) } while (true)