Skip to content

Feat: additive default_headers + shared UIPATH_DEFAULT_REQUEST_HEADERS constant#68

Merged
cosminacho merged 2 commits into
mainfrom
feat/merge-default-headers
Apr 20, 2026
Merged

Feat: additive default_headers + shared UIPATH_DEFAULT_REQUEST_HEADERS constant#68
cosminacho merged 2 commits into
mainfrom
feat/merge-default-headers

Conversation

@cosminacho

@cosminacho cosminacho commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related changes:

1. Additive default_headers on UiPathBaseLLMClient (langchain)

  • Built-in header defaults now live on a class-level class_default_headers: ClassVar[dict[str, str]].
  • Instance default_headers defaults to None and is purely caller-supplied.
  • Merge order at httpx-client construction: class_default_headersdefault_headersclient_settings.build_auth_headers(...) — user values override class defaults on collision; auth headers always win.
  • Why: previously, passing any default_headers={...} replaced the factory defaults entirely, dropping the built-in timeout/4xx headers from self.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)

  • New public constant uipath.llm_client.utils.headers.UIPATH_DEFAULT_REQUEST_HEADERS.
  • UiPathHttpxClient._default_headers and UiPathBaseLLMClient.class_default_headers both point at it — no more duplicated dicts across the two packages.

Affected packages

  • core 1.9.4 → 1.9.5 (new public constant)
  • langchain 1.9.4 → 1.9.5 (additive default_headers; core floor bumped to 1.9.5)

Test plan

  • ruff check
  • ruff format .
  • pyright
  • pytest tests (1522 passed — 4 new tests in tests/langchain/features/test_default_headers_merge.py cover: class defaults preserved when no user headers; additive merge; collision → user wins; async client also merges)

🤖 Generated with Claude Code

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>
@cosminacho cosminacho changed the title Feat: additive default_headers on UiPathBaseLLMClient Feat: additive default_headers + shared UIPATH_DEFAULT_REQUEST_HEADERS constant Apr 20, 2026
@cosminacho cosminacho merged commit b83a8a0 into main Apr 20, 2026
8 checks passed
@cosminacho cosminacho deleted the feat/merge-default-headers branch April 20, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant