Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Advisor Interfaces and add AroundAdvisor support #1310

Closed
wants to merge 1 commit into from

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Sep 4, 2024

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.

@tzolov tzolov marked this pull request as ready for review September 4, 2024 23:09
 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.
@tzolov tzolov added this to the 1.0.0-M3 milestone Sep 5, 2024
@tzolov tzolov added the advisors label Sep 5, 2024
@tzolov
Copy link
Contributor Author

tzolov commented Sep 5, 2024

Merged at 28276d1

@tzolov tzolov closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant