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",