Non-destructive retrying on nemotron-parse API#1281
Merged
jamesbraza merged 3 commits intomainfrom Jan 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts retry behavior for the nemotron-parse Nvidia API calls to avoid “stacked” retry loops that could previously result in more than 3 total retries across different failure modes.
Changes:
- Combine multiple Tenacity retry decorators into a single retry policy capped at 3 total attempts.
- Introduce a custom Tenacity
waitfunction to apply exponential backoff only for theTimeoutError(rate-limit) failure mode. - Add a unit test validating the conditional backoff behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/paper-qa-nemotron/src/paperqa_nemotron/api.py |
Consolidates retry logic and adds conditional exponential backoff helper. |
packages/paper-qa-nemotron/tests/test_api.py |
Adds test coverage for the new conditional wait/backoff logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sidnarayanan
approved these changes
Jan 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously we could have a destructive interference with retrying in
nemotron-parse:This PR tightens up retrying to just retry 3X cumulatively
Note
Medium Risk
Touches external API retry/backoff behavior, which can change throughput and error handling under load; logic is small and covered by a new unit test but still affects request timing.
Overview
Tightens Nvidia
nemotron-parseretry behavior so failures across bbox validation errors, rate-limitTimeoutErrors, and LiteLLM 408 timeouts share a singlestop_after_attempt(3)budget instead of potentially retrying in multiple stacked phases.Adds a custom tenacity wait strategy that applies exponential backoff only for the rate-limit
TimeoutErrorpath (not for inference-timeoutlitellm.Timeout), and updates the LiteLLM timeout type check accordingly; includes a focused unit test for the new wait/backoff logic.Written by Cursor Bugbot for commit 84efd89. Configure here.