llama settings

This commit is contained in:
androidlover5842
2026-01-31 03:19:06 +05:30
parent 3af51b77b1
commit b5aacfc8c6
4 changed files with 27 additions and 28 deletions

View File

@@ -13,7 +13,17 @@ class LlamaClient(
private val restTemplate: RestTemplate,
private val objectMapper: ObjectMapper,
@Value("\${ai.llama.baseUrl}")
private val baseUrl: String
private val baseUrl: String,
@Value("\${ai.llama.temperature:0.7}")
private val temperature: Double,
@Value("\${ai.llama.topP:0.8}")
private val topP: Double,
@Value("\${ai.llama.minP:0.2}")
private val minP: Double,
@Value("\${ai.llama.repeatPenalty:1.0}")
private val repeatPenalty: Double,
@Value("\${ai.llama.topK:40}")
private val topK: Int
) {
private val systemPrompt =
"Look only at visible text. " +
@@ -24,6 +34,11 @@ class LlamaClient(
fun ask(imageUrl: String, question: String): String {
val payload = mapOf(
"model" to "qwen",
"temperature" to temperature,
"top_p" to topP,
"min_p" to minP,
"repeat_penalty" to repeatPenalty,
"top_k" to topK,
"messages" to listOf(
mapOf(
"role" to "system",
@@ -44,6 +59,11 @@ class LlamaClient(
fun askText(content: String, question: String): String {
val payload = mapOf(
"model" to "qwen",
"temperature" to temperature,
"top_p" to topP,
"min_p" to minP,
"repeat_penalty" to repeatPenalty,
"top_k" to topK,
"messages" to listOf(
mapOf(
"role" to "system",

View File

@@ -220,7 +220,6 @@ class GuestDocuments(
"IS THIS A VEHICLE NUMBER PLATE PHOTO? Answer YES or NO only."
)
if (isYes(results["isVehiclePhoto"])) {
results["vehicleNumber"] = llamaClient.ask(
imageUrl,

View File

@@ -1,25 +1,5 @@
spring.application.name=TrisolarisServer
spring.datasource.username=android
spring.datasource.password=taddymydoggy!
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.flyway.enabled=false
spring.flyway.locations=classpath:db/migration
storage.documents.root=/home/androidlover5842/docs
storage.documents.publicBaseUrl=https://api.hoteltrisolaris.in
storage.documents.tokenSecret=change-me
storage.documents.tokenTtlSeconds=300
storage.emails.root=/home/androidlover5842/docs/emails
storage.emails.publicBaseUrl=https://api.hoteltrisolaris.in
storage.rooms.root=/home/androidlover5842/docs/rooms
storage.rooms.publicBaseUrl=https://api.hoteltrisolaris.in
mail.imap.host=localhost
mail.imap.port=993
mail.imap.protocol=imaps
mail.imap.username=
mail.imap.password=
mail.imap.pollMs=60000
mail.imap.enabled=false
server.port=18921
spring.servlet.multipart.max-file-size=20MB
spring.servlet.multipart.max-request-size=20MB
ai.llama.temperature=0.7
ai.llama.topP=0.8
ai.llama.minP=0.2
ai.llama.repeatPenalty=1.0
ai.llama.topK=40