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 restTemplate: RestTemplate,
private val objectMapper: ObjectMapper, private val objectMapper: ObjectMapper,
@Value("\${ai.llama.baseUrl}") @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 = private val systemPrompt =
"Look only at visible text. " + "Look only at visible text. " +
@@ -24,6 +34,11 @@ class LlamaClient(
fun ask(imageUrl: String, question: String): String { fun ask(imageUrl: String, question: String): String {
val payload = mapOf( val payload = mapOf(
"model" to "qwen", "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( "messages" to listOf(
mapOf( mapOf(
"role" to "system", "role" to "system",
@@ -44,6 +59,11 @@ class LlamaClient(
fun askText(content: String, question: String): String { fun askText(content: String, question: String): String {
val payload = mapOf( val payload = mapOf(
"model" to "qwen", "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( "messages" to listOf(
mapOf( mapOf(
"role" to "system", "role" to "system",

View File

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

View File

@@ -1,4 +1,4 @@
spring.datasource.url=jdbc:postgresql://localhost:5432/trisolaris spring.datasource.url=jdbc:postgresql://localhost:5432/trisolaris
ai.llama.baseUrl=http://localhost:8089/v1/chat/completions ai.llama.baseUrl=http://localhost:8089/v1/chat/completions
logging.level.com.android.trisolarisserver.controller.Auth=INFO logging.level.com.android.trisolarisserver.controller.Auth=INFO
storage.documents.aiBaseUrl=http://127.0.0.1:18921 storage.documents.aiBaseUrl=http://127.0.0.1:18921

View File

@@ -1,25 +1,5 @@
spring.application.name=TrisolarisServer ai.llama.temperature=0.7
spring.datasource.username=android ai.llama.topP=0.8
spring.datasource.password=taddymydoggy! ai.llama.minP=0.2
spring.jpa.hibernate.ddl-auto=update ai.llama.repeatPenalty=1.0
spring.jpa.open-in-view=false ai.llama.topK=40
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