feat: add configurable max_retries to Junction and AsyncJunction clients#6
Merged
Merged
Conversation
Expose a new optional `max_retries` parameter on both the sync `Junction` and async `AsyncJunction` client constructors, allowing callers to control the default number of HTTP retries at the client level. The default value is 2. Per-request `max_retries` in `request_options` continues to take precedence over this client-level default. Also includes internal improvements to SSE stream handling (proper incremental decoding and `\r\n`/`\r` line-ending normalization) and widens the `pydantic-core` version constraint from `<2.44.0` to `<3.0.0`. Key changes: - Add optional `max_retries` parameter to `Junction.__init__` and `AsyncJunction.__init__` (defaults to 2) - Add `get_max_retries()` method to `BaseClientWrapper` and thread `max_retries` through `SyncClientWrapper` and `AsyncClientWrapper` - Refactor SSE `iter_sse` / `aiter_sse` to use incremental codec decoding and normalize `\r\n`/`\r` line endings per the SSE spec - Widen `pydantic-core` dependency upper bound to `<3.0.0` 🌿 Generated with Fern
ItachiEU
approved these changes
May 7, 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.
1.0.0 → 1.1.0
Added
max_retries— new optional constructor parameter onJunctionandAsyncJunctionthat sets the client-level default retry count (defaults to2); per-requestmax_retriesinrequest_optionsstill takes precedence.Changed
pydantic-coredependency upper bound widened from<2.44.0to<3.0.0, allowing compatibility with newer pydantic-core releases.iter_sse/aiter_sse) now uses incremental codec decoding and normalizes\r\nand bare\rline endings per the SSE specification, improving reliability with chunked streams.See full changelog