Bug description Using WatsonxAiChatClient.call with a Prompt instance with no chat options defined will lead to an error as no model is set
Environment Spring AI version 1.0.0-SNAPSHOT
Steps to reproduce Only set the connection properties, juts like the following snippet
spring:
ai:
watsonx:
ai:
base-url: ${WATSONX_BASE_URL}
stream-endpoint: ${WATSONX_STREAM_ENDPOINT}
text-endpoint: ${WATSONX_TEXT_ENDPOINT}
project-id: ${WATSONX_PROJECT_ID}
iam-token: ${WATSONX_IAM_TOKEN}
Expected behavior As the prompt class constructor allows to instantiate without setting any chat options, then watsonx default chat properties must have a default model.
Minimal Complete Reproducible example Example:
@RestController
public class WatsonxController {
private final WatsonxAiChatClient chat;
@Autowired
public WatsonxController(WatsonxAiChatClient chat) {
this.chat = chat;
}
@GetMapping("/hi")
public String sayHi() {
var prompt = new Prompt(new SystemMessage("say hi"));
var results = this.chat.call(prompt);
return results.getResult().getOutput().getContent();
}
}
NOTE: I will make a PR solving this issue