-
Notifications
You must be signed in to change notification settings - Fork 19.9k
feat: LLM node support model list fallback #31688
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
base: main
Are you sure you want to change the base?
Conversation
…NodeRunExceptionEvent`
Summary of ChangesHello @CrabSAMA, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness of workflows by introducing an automated fallback mechanism for Large Language Model (LLM) nodes. Instead of requiring manual intervention or complex error branches, users can now specify a sequence of alternative LLM models directly within an LLM node's configuration. This ensures that if the primary model fails, the system will seamlessly attempt to use other models, thereby increasing the resilience and reliability of LLM-powered applications and simplifying workflow design. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a robust fallback model mechanism for LLM nodes, which is a great enhancement for workflow reliability. The changes are well-structured across the backend and frontend, with comprehensive test coverage for the new logic. The backend implementation in the ErrorHandler and LLMNode is solid, and the frontend correctly visualizes the fallback attempts. I have a few suggestions for minor improvements regarding code duplication and clarity, but overall, this is an excellent contribution.
| return self._handle_abort(event) | ||
|
|
||
| # Check if node has fallback_models configured | ||
| if not hasattr(node.node_data, "fallback_models") or not node.node_data.fallback_models: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hasattr(node.node_data, "fallback_models") check is redundant. Since you've already verified that node.node_type is NodeType.LLM on line 241, node.node_data is guaranteed to be an instance of LLMNodeData and will have the fallback_models attribute. The check not node.node_data.fallback_models is sufficient.
| if not hasattr(node.node_data, "fallback_models") or not node.node_data.fallback_models: | |
| if not node.node_data.fallback_models: |
| fallback_model_index_str = ( | ||
| fallback_model_index_var.text | ||
| if hasattr(fallback_model_index_var, "text") | ||
| else str(fallback_model_index_var.value) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fallbackDetail.push({ | ||
| ...data, | ||
| retry_index: (data.execution_metadata?.fallback_model_index ?? 0), | ||
| } as NodeTracing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are assigning fallback_model_index to the retry_index field. This is confusing because they represent different concepts (fallback vs. retry). The FallbackResultPanel component doesn't use this retry_index for displaying the attempt number; it uses the array index instead. To avoid future confusion, it's better to remove this assignment.
fallbackDetail.push(data as NodeTracing)
Important
Fixes #<issue number>.Summary
Fixes #31118
This pr introduce new error handling of LLM node, which user can select fallback model list when model run throw exception.
Before: every LLM node need add exception branch or use tool to make model fallback.
LLM node run failed -> error branch -> some logic about handle fallback -> end
Now: it can config fallback model in LLM node which need fallback.
LLM node run failed -> traverse fallback model list -> retry with fallback model -> end
Some edge case:
Changelog:
ERROR_STRATEGY, add some metadata field to store fallback model infoTODO:
Screenshots
Add
Fallback Modeloption only in LLM node error handingFallback model error handling select model list to fallback
Fallback success, LLM node status will stay
exception, but we can access model retry informationFallback model error handling with empty fallback model list
Fallback model list has been retried and still failed
Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods