Add StructuredOutputRetryLimitMiddleware and default retry limit#756
Add StructuredOutputRetryLimitMiddleware and default retry limit#756mateusz834 wants to merge 1 commit intodevelopfrom
StructuredOutputRetryLimitMiddleware and default retry limit#756Conversation
4058eb3 to
11db930
Compare
StructuredOutputRetryLimitMiddleware and default retry limit
11db930 to
4f91f65
Compare
11b9c6d to
a4b880c
Compare
29bea8d to
11d5bcb
Compare
3bdfa63 to
41a8ba5
Compare
dfecb28 to
bd48ef4
Compare
| # NOTE: we're creating separate instances per agent - TimeoutLimitMiddleware is stateful | ||
| # and sharing one would cause agents to overwrite each other's deadline. | ||
| predefined: list[AgentMiddleware] = [ | ||
| predefined_before: list[AgentMiddleware] = [ |
There was a problem hiding this comment.
why did you dive it?
There was a problem hiding this comment.
The StructuredOutputRetryLimitMiddleware must be first in the list (L97 below) since it has to execute after all other user_middleware have been executed, otherwise, if some user_middleware raised the StructuredOutputGenerationException we would not have catched that and the agent loop would have re-tried the structured output generation, without any re-try limits.
| @pytest.mark.asyncio | ||
| @ai_snapshot_test() | ||
| async def test_default_retry_limit(self) -> None: | ||
| pytest.importorskip("langchain_openai") |
There was a problem hiding this comment.
[nitpick] can't we add module level guard instead of repeating ? I mean this whole file depends on langchain_openai
There was a problem hiding this comment.
We have this skip basically in every test now, if we are going to change anything related to this i think we should just remove them.
I’m not aware of any way to apply this globally, especially in a way that plays nicely with pytest, since these skips are actually executed per test and are visible in the pytest output.
Regenreated `test_agent_understands_other_agents.json`, since the previous recoding hit that default limit.
bd48ef4 to
99ff354
Compare
Regenerated
test_agent_understands_other_agents.json, since the previous recoding hit that default limit.