This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new c4b6863c9f8c CAMEL-23206: Fix flaky SpringAiChatParameterOverrideIT
c4b6863c9f8c is described below

commit c4b6863c9f8c13a1056837227ce731df89605e93
Author: Guillaume Nodet <[email protected]>
AuthorDate: Thu Mar 19 09:27:05 2026 +0100

    CAMEL-23206: Fix flaky SpringAiChatParameterOverrideIT
    
    Replace fragile assertion on LLM content (checking for specific words like
    "blue", "above", "high") with stable structural assertions: verify the
    response contains multiple words and that token usage metadata is present.
---
 .../component/springai/chat/SpringAiChatParameterOverrideIT.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatParameterOverrideIT.java
 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatParameterOverrideIT.java
index 8ef46256bd4e..081a21613b1f 100644
--- 
a/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatParameterOverrideIT.java
+++ 
b/components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/test/java/org/apache/camel/component/springai/chat/SpringAiChatParameterOverrideIT.java
@@ -67,8 +67,10 @@ public class SpringAiChatParameterOverrideIT extends 
OllamaTestSupport {
 
         String response = exchange.getMessage().getBody(String.class);
         assertThat(response).isNotNull();
-        // With low top_p, should get more deterministic responses
-        assertThat(response.toLowerCase()).containsAnyOf("blue", "above", 
"high");
+        assertThat(response.split("\\s+")).hasSizeGreaterThan(1);
+
+        Integer totalTokens = 
exchange.getMessage().getHeader(SpringAiChatConstants.TOTAL_TOKEN_COUNT, 
Integer.class);
+        assertThat(totalTokens).isNotNull().isGreaterThan(0);
     }
 
     @Test

Reply via email to