Feat: additive default_headers + shared UIPATH_DEFAULT_REQUEST_HEADERS constant#68
Merged
Conversation
Class-level built-in defaults (timeout + AllowFull4xxResponse) now live on
`class_default_headers: ClassVar`. Caller-supplied `default_headers` are merged
on top, so user values override on collision but never remove the built-ins.
Previously passing any `default_headers={...}` dropped the factory defaults.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add `UIPATH_DEFAULT_REQUEST_HEADERS` in `utils/headers.py` as the single source of truth for the gateway's built-in request headers. `UiPathHttpxClient._default_headers` and the langchain `UiPathBaseLLMClient.class_default_headers` both reference it, so the two copies in core + langchain stay in sync by construction. Core 1.9.4 → 1.9.5, langchain's core floor raised to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Two related changes:
1. Additive
default_headersonUiPathBaseLLMClient(langchain)class_default_headers: ClassVar[dict[str, str]].default_headersdefaults toNoneand is purely caller-supplied.class_default_headers→default_headers→client_settings.build_auth_headers(...)— user values override class defaults on collision; auth headers always win.default_headers={...}replaced the factory defaults entirely, dropping the built-in timeout/4xx headers fromself.default_headers. The core httpx client masked it on the wire, but the behavior was asymmetric.2. Single source of truth for built-in gateway headers (core + langchain)
uipath.llm_client.utils.headers.UIPATH_DEFAULT_REQUEST_HEADERS.UiPathHttpxClient._default_headersandUiPathBaseLLMClient.class_default_headersboth point at it — no more duplicated dicts across the two packages.Affected packages
Test plan
ruff checkruff format .pyrightpytest tests(1522 passed — 4 new tests intests/langchain/features/test_default_headers_merge.pycover: class defaults preserved when no user headers; additive merge; collision → user wins; async client also merges)🤖 Generated with Claude Code