-
Notifications
You must be signed in to change notification settings - Fork 495
Open
Description
Description
I would like to contribute a new sample module to models/chat that demonstrates AI Function Calling (Tools) using the modern ChatClient Fluent API.
While there are functional tests for this feature, a dedicated, beginner-friendly sample would help developers understand how to bridge existing Java services with LLMs.
Proposed Implementation
The sample will include:
- Tool Definition: A simple @bean function (e.g., a Weather or Stock price mock) using the 'Function' interface.
- ChatClient Integration: Demonstrating how to register the function using .functions("functionName") within the fluent API.
- Observability: Integration of
SimpleLoggerAdvisorto show the underlying "Tool Call" interaction in the console logs—essential for debugging agentic behavior. - Local-First: Configuration optimized for Ollama (llama3.2) to ensure users can run it without requiring external API keys.
Why this is valuable
Function calling is a core "Agentic" feature of Spring AI. This sample provides a clear "Hello World" for connecting LLMs to external Java logic, which is a primary use case for enterprise developers.
I would love to submit a PR if the maintainers find this valuable!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels