Currently, Spring AI's function callbacks only support Function
and BiFunction
interfaces.
We should extend support to other common functional interfaces, specifically Consumer
and Supplier
and support the semantically equivalent Function<Void,O>
and Function<I, Void>
.
Example Usage:
@Bean
@Description("Turn light on in a room")
public Consumer<LightInfo> turnLightConsumer() {
return (LightInfo lightInfo) -> {
// Handle light control
};
}
@Bean
@Description("Get room status")
public Supplier<String> getRoomStatus() {
return () -> {
// Return room status
};
}
Comment From: jsilverman26
@tzolov thanks so much for picking this up and working on it! Really appreciate the quick response and all the effort.
Since this is my first experience with open source, I’m not entirely sure about the process. If I want to propose a new feature and start coding it myself, should I first open an issue, ask to be assigned to it, and then start coding once it’s assigned to me? Or would it be better to submit the issue and the pull request together?