Skip to content

fix: adapt UiPathChatAnthropic to the langchain-anthropic 1.7.0 raw-response contract - #133

Open
andreibalas-uipath wants to merge 2 commits into
mainfrom
fix/langchain-anthropic-1.7.0-raw-response
Open

fix: adapt UiPathChatAnthropic to the langchain-anthropic 1.7.0 raw-response contract#133
andreibalas-uipath wants to merge 2 commits into
mainfrom
fix/langchain-anthropic-1.7.0-raw-response

Conversation

@andreibalas-uipath

@andreibalas-uipath andreibalas-uipath commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Follow-up to #132, which pinned langchain-anthropic<1.7.0 as an interim mitigation. This PR is the real fix, plus a downstream CI gate so this class of breakage is caught before publish in the future.

langchain-anthropic 1.7.0 contract fix

  • UiPathChatAnthropic._create/._acreate now route through with_raw_response.create(...) (both the plain and betas branches). langchain-anthropic 1.7.0 changed these private methods to return a raw-response wrapper and calls .parse() on the result; the previous override bodies returned parsed objects, so every operation failed with 'Message'/'Stream'/'AsyncStream' object has no attribute 'parse'.
  • langchain-anthropic bound on the anthropic and bedrock extras moves from >=1.4.1,<1.7.0 (the fix: bound langchain-anthropic<1.7.0 in uipath-langchain-client #132 pin) to >=1.7.0,<2.0.0.
  • UiPathChatLiteLLM no longer lets ChatLiteLLM's before-validator mark streaming=False as explicitly set: langchain-core >= 1.4 treats that as a hard streaming opt-out, silently downgrading .stream()/.astream() to non-streaming invokes.
  • New tests: tests/langchain/clients/anthropic/test_raw_response_contract.py and tests/langchain/clients/litellm/test_streaming_dispatch.py.

Downstream integration gate (new CI)

.github/workflows/test-downstream-langchain.yml + .github/scripts/inject_uv_overrides.py: on every PR that touches package source, build both wheels from the PR, inject tool.uv.override-dependencies into a checkout of uipath-langchain-python main (the UV_OVERRIDE env var used by uipath-python's cross-tests is silently ignored by uv project commands — verified), then run the chat-models and multimodal-invoke live integration testcases against alpha via the downstream's own run.sh/validate_output.sh — the two testcases that exercise the LLM client end to end.

A single downstream-gate check summarizes (passes when jobs were legitimately skipped), suitable for branch protection. skip:downstream label bypasses.

Prerequisite before the integration jobs can pass: repo secrets ALPHA_TEST_CLIENT_ID, ALPHA_TEST_CLIENT_SECRET, ALPHA_BASE_URL (same values as uipath-langchain-python's integration workflow). Until they're added, the two live jobs (and the gate) will fail on this PR. Do not mark downstream-gate required until secrets are in and a burn-in period has passed.

Affected packages

  • uipath-langchain-client only (1.18.3 → 1.18.4). Core untouched (CI files are workflow-level).

Verification

  • ruff check, ruff format --check, pyright clean; full suite green (2110 passed, cassette replay).
  • Anthropic fix: with main's code + langchain-anthropic 1.7.0, the Anthropic suite fails 121 tests with exactly the errors from the uipath-langchain-python chat-models CI failure; with this branch it passes 133/133 including VCR replay of recorded gateway traffic for the failing CI config (anthropic.claude-haiku-4-5-20251001-v1:0, vendor_type="awsbedrock").
  • Gate rehearsed locally against a clean clone of uipath-langchain-python main: wheels built, overrides injected (both [tool.uv] present/absent paths), the testcase resolution picks the PR wheels with wheel-metadata-driven transitive pins and survives the testcase's own uv add uipath-langchain[bedrock/vertex] steps, and the agent graph constructs all six chat-model classes against the injected packages. The only un-rehearsed step is the live testcase run (needs the alpha secrets).

Side-finding for a separate PR

Rehearsing the gate surfaced a pre-existing latent drift bug: the fireworks extra has no fireworks-ai bound, so fresh resolutions pull fireworks-ai 1.x, which breaks UiPathChatFireworks imports (fireworks.client.api_client removed; 0.16+ also collides with the google/vertexai gRPC protos). Hidden today by committed lockfiles holding 0.15.x. Fix (fireworks-ai>=0.15.0,<0.16.0) to land separately.

🤖 Generated with Claude Code

…nse contract

- _create/_acreate now return raw-response wrappers (with_raw_response) since
  langchain-anthropic 1.7.0 calls .parse() on the result; previously every
  invoke/stream/tool-calling/structured-output call failed with
  "'Message' object has no attribute 'parse'"
- raise langchain-anthropic floor to >=1.7.0,<2.0.0 (anthropic extra, and
  explicitly on the bedrock extra which pulls it transitively)
- fix UiPathChatLiteLLM stream()/astream() silently degrading to non-streaming
  on langchain-core >= 1.4 (pulled in by langchain-anthropic 1.7.0), caused by
  ChatLiteLLM's validator marking streaming=False as explicitly set
- regenerate uv.lock (langchain-anthropic 1.7.0, anthropic 0.125.0 — still <1.0.0)
- bump uipath-langchain-client to 1.18.2 with changelog entry

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Builds both wheels from the PR, injects tool.uv.override-dependencies
into the downstream checkout (UV_OVERRIDE is silently ignored by uv
project commands), runs the downstream unit suite and the chat-models /
multimodal-invoke live testcases, and exposes a single downstream-gate
check suitable for branch protection. Requires ALPHA_TEST_CLIENT_ID/
ALPHA_TEST_CLIENT_SECRET/ALPHA_BASE_URL secrets; skip:downstream label
bypasses.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@andreibalas-uipath
andreibalas-uipath force-pushed the fix/langchain-anthropic-1.7.0-raw-response branch from 8c4bc1c to ebac946 Compare September 3, 2026 14:11
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