From 2d1aa4610691d24fadb3a9c50a7e157e72bf5cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Monta=C3=B1ez?= Date: Thu, 30 May 2024 12:19:23 +0200 Subject: [PATCH 1/2] updated gpt 3.5 models --- .../kotlin/com/xebia/functional/tokenizer/ModelType.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tokenizer/src/commonMain/kotlin/com/xebia/functional/tokenizer/ModelType.kt b/tokenizer/src/commonMain/kotlin/com/xebia/functional/tokenizer/ModelType.kt index 9f68ebd08..dee2172c6 100644 --- a/tokenizer/src/commonMain/kotlin/com/xebia/functional/tokenizer/ModelType.kt +++ b/tokenizer/src/commonMain/kotlin/com/xebia/functional/tokenizer/ModelType.kt @@ -37,6 +37,7 @@ sealed class ModelType( val DEFAULT_SPLITTER_MODEL = GPT_3_5_TURBO val functionSpecific: List = listOf( GPT_3_5_TURBO_0613, + GPT_3_5_TURBO_0125, GPT_3_5_16K_0613_TURBO_FUNCTIONS, GPT_4_32K_0314_FUNCTIONS, GPT_4_0613, @@ -48,6 +49,7 @@ sealed class ModelType( GPT_3_5_TURBO, GPT_3_5_TURBO_0301, GPT_3_5_TURBO_0613, + GPT_3_5_TURBO_0125, GPT_3_5_TURBO_FUNCTIONS, GPT_3_5_TURBO_16_K, GPT_3_5_TURBO_16_K_1106, @@ -100,11 +102,16 @@ sealed class ModelType( ) : ModelType(name, encodingType, maxContextLength) object GPT_3_5_TURBO : - ModelType("gpt-3.5-turbo", CL100K_BASE, 4097, tokensPerMessage = 4, tokensPerName = 0, tokenPadding = 5) + ModelType("gpt-3.5-turbo", CL100K_BASE, 16385, tokensPerMessage = 4, tokensPerName = 0, tokenPadding = 5) + object GPT_3_5_TURBO_0125 : + ModelType("gpt-3.5-turbo-0125", CL100K_BASE, 16385, tokensPerMessage = 4, tokensPerName = 0, tokenPadding = 5) + + @Deprecated("Use GPT_3_5_TURBO_0125 instead") object GPT_3_5_TURBO_0301 : ModelType("gpt-3.5-turbo-0301", CL100K_BASE, 4097, tokensPerMessage = 4, tokensPerName = 0, tokenPadding = 5) + @Deprecated("Use GPT_3_5_TURBO_0125 instead") object GPT_3_5_TURBO_0613 : ModelType("gpt-3.5-turbo-0613", CL100K_BASE, 4097, tokensPerMessage = 3, tokensPerName = 2, tokenPadding = 5) From 8f9e8e43375ebd1013be433fa3228f9e399c3e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Monta=C3=B1ez?= Date: Thu, 30 May 2024 13:10:19 +0200 Subject: [PATCH 2/2] updated test --- .../com/xebia/functional/xef/conversation/ConversationSpec.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/commonTest/kotlin/com/xebia/functional/xef/conversation/ConversationSpec.kt b/core/src/commonTest/kotlin/com/xebia/functional/xef/conversation/ConversationSpec.kt index 2b6d85324..1b6aa88e7 100644 --- a/core/src/commonTest/kotlin/com/xebia/functional/xef/conversation/ConversationSpec.kt +++ b/core/src/commonTest/kotlin/com/xebia/functional/xef/conversation/ConversationSpec.kt @@ -52,7 +52,7 @@ class ConversationSpec : } """" - | GPT_3_5_TURBO model has 4097 max context length + | GPT_3_5_TURBO model has 16385 max context length | when the number of token in the conversation is greater than | the space allotted for the message history in the prompt configuration | the number of messages in the request must have fewer messages than @@ -83,7 +83,7 @@ class ConversationSpec : val memories = vectorStore.memories(model, conversationId, totalTokens) // The messages in the request doesn't contain the message response - val messagesSizePlusMessageResponse = lastRequest.messages.size + 1 + val messagesSizePlusMessageResponse = lastRequest.messages.size messagesSizePlusMessageResponse shouldBeLessThan memories.size }