spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.32k stars 850 forks source link

feat(core): Add Supplier and Consumer function callback support #1746

Closed tzolov closed 3 days ago

tzolov commented 5 days ago

Add support for no-argument Supplier and single-argument Consumer function callbacks in the Spring AI core module. This enhancement allows:

Additional changes:

  • Add test coverage for both Supplier and Consumer callbacks in various scenarios
  • Enhance TypeResolverHelper to support Consumer input type resolution
  • Support lambda-style function declarations for improved ergonomics
  • Add test cases for void input/output handling in OpenAI chat model
  • Include examples of function calls without return values
  • Add support for parameterless functions through Supplier interface

Resolves #1718 , #1277 , #1118, #860

markpollack commented 3 days ago

Refactored some of the long methods so that it reads more cleanly. Added 'final' to the kotlin delegate classes.

markpollack commented 3 days ago

in the docs, the section "Customization Options" was empty, so I removed it.

markpollack commented 3 days ago

merged in 432954dad7f7c3a33117848a4259bc7076865c5f