Add simple hello world test to reproduce issue #2957 with qwen/ollama

This commit is contained in:
Mark Pollack
2025-05-03 18:22:05 -04:00
parent bfcaad7b54
commit 6ffbb3acc6

View File

@@ -25,6 +25,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.messages.UserMessage;
import org.springframework.ai.chat.model.ChatResponse;
@@ -65,6 +66,24 @@ public class OllamaFunctionCallbackIT extends BaseOllamaIT {
initializeOllama(MODEL_NAME);
}
/**
* See https://github.com/spring-projects/spring-ai/issues/2957
*/
@Test
void chatClientHelloWorld() {
this.contextRunner.run(context -> {
OllamaChatModel chatModel = context.getBean(OllamaChatModel.class);
ChatClient chatClient = ChatClient.builder(chatModel).build();
UserMessage userMessage = new UserMessage("What is 2+2");
var response = chatClient.prompt(new Prompt(userMessage)).call().content();
logger.info("Response: " + response);
});
}
@Test
void functionCallTest() {
this.contextRunner.run(context -> {