Refactoring and enhancements to the advisor functionality.
New Advisor interfaces in the org.springframework.ai.chat.client.advisor.api package:
- Advisor: Base interface for all advisor types.
- RequestAdvisor: For advising on request data before execution.
- ResponseAdvisor: For advising on response data after execution, with enhanced streaming modes.
- CallAroundAdvisor and StreamAroundAdvisor: For around advice on synchronous and streaming requests respectively.
- AroundAdvisorChain and DefaultAroundAdvisorChain: To manage chaining of around advisors.
Advisor Chain and Prompt Generation:
- Added the DefaultAroundAdvisorChain class to manage the sequence of advisors applied around chat model methods.
- Adjusted the prompt generation (toPrompt) to integrate with the refactored AdvisedRequest object.
Refactoring and Updates:
- Replaced the deprecated RequestResponseAdvisor interface with RequestAdvisor and ResponseAdvisor across the spring-ai-core and test modules.
- Updated the DefaultChatClient and related classes to use the new Advisor interface, improving modularity and consistency.
- Refactored DefaultAdvisorSpec and DefaultChatClientRequestSpec to handle the new Advisor type, and revised advisor lists and methods accordingly.
- Enhanced the handling of streaming responses, introducing StreamResponseMode for better control during streaming scenarios.
Comment From: tzolov
Merged at 28276d14a4f0ca7d47212e66494804c90e2360dc