Skip to content

Commit a36d0b4

Browse files
authored
chore: changed log statements from info to debug. (#189)
1 parent 86c1048 commit a36d0b4

File tree

7 files changed

+17
-14
lines changed

7 files changed

+17
-14
lines changed

lmos-classifier-core/src/main/kotlin/org/eclipse/lmos/classifier/core/AgentClassifier.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ data class SystemContext(
6363
* @property candidateAgents The agents considered during classification, depending on the classification strategy:
6464
* - **Embedding-based classifier**; candidates originate from semantic search.
6565
* - **LLM-based classifier**; candidates derived from [AgentProvider]s.
66+
* @property reason A concise explanation of the classification decision, present only for LLM-based classifications.
6667
*/
6768
open class ClassificationResult(
6869
var classifiedAgents: List<ClassifiedAgent>,
6970
val candidateAgents: List<Agent> = emptyList(),
71+
val reason: String = "",
7072
)
7173

7274
/**

lmos-classifier-hybrid/src/main/kotlin/org/eclipse/lmos/classifier/hybrid/FastTrackAgentClassifier.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class FastTrackAgentClassifier(
6767
) {
6868
val classifiedAgentId = result.classifiedAgents.firstOrNull()?.id ?: "none"
6969
this
70-
.atInfo()
70+
.atDebug()
7171
.addKeyValue("classifier-type", "Hybrid-Fasttrack")
7272
.addKeyValue("classifier-user-message", request.inputContext.userMessage)
7373
.addKeyValue("classifier-is-fasttrack", isFastTrack)

lmos-classifier-llm/src/main/kotlin/org/eclipse/lmos/classifier/llm/ChatModelPrompts.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ fun defaultSystemPrompt(): String =
3030
3131
Format your answer as a single JSON object, for example:
3232
Example question: "Mobile"
33-
Example answer: {"agentId": null, "reason": "It is unclear what the customer means by 'Mobile'."}
33+
Example answer: {"reason": "It is unclear what the customer means by 'Mobile'.", "agentId": null}
3434
3535
Example question: "Order status"
36-
Example answer: {"agentId": "order-agent-service", "reason": "Customer wants to know the status of their order."}
36+
Example answer: {"reason": "Customer wants to know the status of their order.", "agentId": "order-agent-service"}
3737
3838
Example question: "Hello"
39-
Example answer: {"agentId": null, "reason": "The request is a greeting and there is no agent for that."}
39+
Example answer: {"reason": "The request is a greeting and there is no agent for that.", "agentId": null}
4040
""".trimIndent()
4141

4242
fun defaultGermanSystemPrompt(): String =
@@ -65,11 +65,11 @@ fun defaultGermanSystemPrompt(): String =
6565
6666
Antworte in einem einzelnen JSON-Format wie im Beispiel.
6767
Beispielanfrage: "Mobilfunk"
68-
Beispielantwort: {"agentId": null, "reason": "Es ist nicht klar was der Kunde mit \"Mobilfunk\" meint."}
68+
Beispielantwort: {"reason": "Es ist nicht klar was der Kunde mit \"Mobilfunk\" meint.", agentId": null}
6969
7070
Beispielanfrage: "Auftragsstatus"
71-
Beispielantwort: {"agentId": "order-agent-service", "reason": "Der Kunde will den Status eines Auftrags erfahren"}
71+
Beispielantwort: {"reason": "Der Kunde will den Status eines Auftrags erfahren", "agentId": "order-agent-service"}
7272
7373
Beispielanfrage: "Guten Tag"
74-
Beispielantwort: {"agentId": null, "reason": "Die Anfrage eine Begrüßung und ist nicht Telekom-spezifisch"}
74+
Beispielantwort: {"reason": "Die Anfrage eine Begrüßung und ist nicht Telekom-spezifisch", agentId": null}
7575
""".trimIndent()

lmos-classifier-llm/src/main/kotlin/org/eclipse/lmos/classifier/llm/DefaultModelAgentClassifier.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class DefaultModelAgentClassifier(
104104
return if (agent == null) {
105105
ClassificationResult(emptyList(), agents)
106106
} else {
107-
ClassificationResult(listOf(ClassifiedAgent(agent.id, agent.name, agent.address)), agents)
107+
ClassificationResult(listOf(ClassifiedAgent(agent.id, agent.name, agent.address)), agents, response.reason)
108108
}
109109
}
110110

@@ -118,7 +118,7 @@ class DefaultModelAgentClassifier(
118118
}
119119
val classifiedAgentId = result.classifiedAgents.firstOrNull()?.id ?: "none"
120120
this
121-
.atInfo()
121+
.atDebug()
122122
.addKeyValue("classifier-type", "LLM")
123123
.addKeyValue("classifier-user-message", request.inputContext.userMessage)
124124
.addKeyValue("classifier-candidate-agents", candidateAgents)
@@ -137,8 +137,8 @@ class DefaultModelAgentClassifier(
137137
}
138138

139139
data class ClassifiedAgentResult(
140-
val agentId: String?,
141140
val reason: String,
141+
val agentId: String?,
142142
)
143143

144144
data class LlmCandidateAgent(

lmos-classifier-llm/src/test/kotlin/org/eclipse/lmos/classifier/llm/DefaultModelAgentClassifierTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal class DefaultModelAgentClassifierTest {
5858
// given
5959
val request = modelClassificationRequest()
6060

61-
val expectedAgentId = jacksonObjectMapper().writeValueAsString(ClassifiedAgentResult("weather-bot", "customer wants weather info"))
61+
val expectedAgentId = jacksonObjectMapper().writeValueAsString(ClassifiedAgentResult("customer wants weather info", "weather-bot"))
6262
val expectedClassifiedAgent = ClassifiedAgent("weather-bot", "weather-bot-name", "weather-bot-address")
6363
val expectedCandidateAgents = agentProvider.provide(request)
6464
val chatResponse = ChatResponse.builder().aiMessage(AiMessage((expectedAgentId))).build()
@@ -71,6 +71,7 @@ internal class DefaultModelAgentClassifierTest {
7171
// then
7272
assertThat(classification.classifiedAgents).isEqualTo(listOf(expectedClassifiedAgent))
7373
assertThat(classification.candidateAgents).isEqualTo(expectedCandidateAgents)
74+
assertThat(classification.reason).isEqualTo("customer wants weather info")
7475
assertThat(messagesSlot.captured.messages()).hasSize(4)
7576

7677
assertThat(messagesSlot.captured.messages()[0]).isInstanceOf(SystemMessage::class.java)
@@ -91,7 +92,7 @@ internal class DefaultModelAgentClassifierTest {
9192
// given
9293
val request = modelClassificationRequest()
9394

94-
val expectedAgentId = jacksonObjectMapper().writeValueAsString(ClassifiedAgentResult(null, "no suitable agent found"))
95+
val expectedAgentId = jacksonObjectMapper().writeValueAsString(ClassifiedAgentResult("no suitable agent found", null))
9596
val expectedCandidateAgents = agentProvider.provide(request)
9697
val chatResponse = ChatResponse.builder().aiMessage(AiMessage((expectedAgentId))).build()
9798
val messagesSlot = slot<ChatRequest>()

lmos-classifier-vector/src/main/kotlin/org/eclipse/lmos/classifier/vector/DefaultEmbeddingAgentClassifier.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DefaultEmbeddingAgentClassifier(
4747
) {
4848
val classifiedAgentId = result.classifiedAgents.firstOrNull()?.id ?: "none"
4949
this
50-
.atInfo()
50+
.atDebug()
5151
.addKeyValue("classifier-type", "Vector")
5252
.addKeyValue("classifier-user-message", request.inputContext.userMessage)
5353
.addKeyValue("classifier-embedding-search-queries", searchQueries)

lmos-classifier-vector/src/main/kotlin/org/eclipse/lmos/classifier/vector/ranker/SingleAgentEmbeddingRanker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class SingleAgentEmbeddingRanker(
8484
rankingMatch: Boolean,
8585
) {
8686
this
87-
.atInfo()
87+
.atDebug()
8888
.addKeyValue("classifier-embedding-ranking-thresholds", thresholds)
8989
.addKeyValue("classifier-embedding-ranking-evaluation", embeddingRankingEvaluation)
9090
.addKeyValue("classifier-embedding-ranking-top-agent", topAgent)

0 commit comments

Comments
 (0)