v1.2.5.1 gpt-4 possible
This commit is contained in:
parent
f61603d1ac
commit
9d4fff4e53
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM openjdk:18
|
||||
RUN mkdir diet4you
|
||||
RUN mkdir diet4you/data
|
||||
RUN mkdir diet4you/data/db
|
||||
COPY update*.sql ./diet4you/data/db/
|
||||
RUN cd diet4you
|
||||
COPY aitrainer_server.jar ./diet4you/
|
||||
WORKDIR /diet4you
|
||||
|
||||
ENV PORT=8843
|
||||
EXPOSE 8843
|
@ -48,7 +48,7 @@ dependencies {
|
||||
implementation("jakarta.mail:jakarta.mail-api:2.1.1")
|
||||
implementation("org.eclipse.angus:angus-mail:2.0.1")
|
||||
|
||||
implementation ("com.aallam.openai:openai-client:3.0.0")
|
||||
implementation ("com.aallam.openai:openai-client:3.2.2")
|
||||
implementation("io.ktor:ktor-client-java:2.2.3")
|
||||
|
||||
runtimeOnly("mysql:mysql-connector-java")
|
||||
|
1
build_api_test
Normal file
1
build_api_test
Normal file
@ -0,0 +1 @@
|
||||
docker build --no-cache -t diet4you_api_test -f Dockerfile .
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user