llama settings
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user