v1.2.5.1 gpt-4 possible
This commit is contained in:
@@ -24,7 +24,6 @@ class OpenAIController() {
|
||||
}
|
||||
runBlocking {
|
||||
result = deferred.await()
|
||||
//println("Result: $result" )
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class OpenAIService(@Value("\${openai.key}") private val openaiKey: String, priv
|
||||
|
||||
/* models:
|
||||
gpt-3.5-turbo chat/completion
|
||||
gpt-4-0314 chat/completion
|
||||
text-davinci-003 completion
|
||||
*/
|
||||
|
||||
@@ -79,10 +80,10 @@ class OpenAIService(@Value("\${openai.key}") private val openaiKey: String, priv
|
||||
lengthQuestion += message.content.length
|
||||
}
|
||||
|
||||
val realModelName = "gpt-3.5-turbo"
|
||||
/*if ( modelName != null) {
|
||||
var realModelName = "gpt-3.5-turbo"
|
||||
if ( modelName != null) {
|
||||
realModelName = modelName
|
||||
}*/
|
||||
}
|
||||
var realTemperature = 0.1
|
||||
if ( temperature != null ) {
|
||||
realTemperature = temperature
|
||||
@@ -90,11 +91,15 @@ class OpenAIService(@Value("\${openai.key}") private val openaiKey: String, priv
|
||||
if (openAI == null) {
|
||||
connect(realModelName)
|
||||
}
|
||||
var tokens = 4096
|
||||
if (realModelName.contains("gpt-4")) {
|
||||
tokens = 8192
|
||||
}
|
||||
println("OpenAI Chat Last Question: $lastQuestion")
|
||||
val completionRequest = ChatCompletionRequest(
|
||||
model = ModelId(realModelName),
|
||||
messages = messages,
|
||||
maxTokens = 4096 - lengthQuestion,
|
||||
maxTokens = tokens - lengthQuestion,
|
||||
temperature = realTemperature,
|
||||
)
|
||||
val completion: ChatCompletion = openAI!!.chatCompletion(completionRequest)
|
||||
|
||||
Reference in New Issue
Block a user