feat: make maxResponseTokenLength configurable (#170, #171)

This commit is contained in:
josc146
2023-04-10 22:33:48 +08:00
parent cf4120531b
commit bda56b3ae8
9 changed files with 35 additions and 17 deletions
+1 -2
View File
@@ -20,13 +20,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import { maxResponseTokenLength } from '../config/index.mjs'
import { encode } from '@nem035/gpt-3-encoder'
// TODO add model support
export function cropText(
text,
maxLength = 3900 - maxResponseTokenLength,
maxLength = 3900 - 1000,
startLength = 400,
endLength = 300,
tiktoken = true,