-
Notifications
You must be signed in to change notification settings - Fork 55
feat(middleware): document new retry_model_request hook #747
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
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.
Pull Request Overview
This PR documents the new retry_model_request
hook functionality for LangChain middleware, which allows middleware to handle model execution failures and implement retry logic with modified parameters.
Key changes:
- Documents the new
retry_model_request
/retryModelRequest
hook for both Python and JavaScript - Adds comprehensive documentation for the new
ModelFallbackMiddleware
that uses this hook - Updates middleware execution order documentation to include retry behavior
Preview ID generated: preview-cbretr-1759749913-4c2b387 |
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.
Some nits but otherwise looks good
Co-authored-by: Lauren Hirata Singh <[email protected]>
Co-authored-by: Lauren Hirata Singh <[email protected]>
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Preview ID generated: preview-cbretr-1759825760-5ab4575 |
Preview ID generated: preview-cbretr-1759826112-955d806 |
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
```python | ||
from langchain.agents import create_agent | ||
from langchain.agents.middleware import AgentState, ModelRequest, modify_model_request | ||
from langchain.agents.middleware.types import AgentState, ModelRequest, modify_model_request |
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 import path has been changed from langchain.agents.middleware
to langchain.agents.middleware.types
. This appears to be a breaking change that should be highlighted in the documentation or migration guide, as existing code using the old import path will fail.
Copilot uses AI. Check for mistakes.
Preview ID generated: preview-cbretr-1759826292-33b6b4e |
Standby as we might be changing this hook to on_model_call |
Introduced in:
JS: langchain-ai/langchainjs#9128
Py: langchain-ai/langchain#33275