-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Milestone
Description
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
};
}