Commit afe4a3e
Switch to eager construction-time strip instead of invoke-time context manager
Prior approach used a context manager that temporarily nulled matching fields
for the duration of each call and restored them on exit, so `chat.temperature`
read the caller's original value between invocations. That's sneaky: the
gateway will never accept the value, so reporting 0.7 on the instance is a lie
that hides the truth from the user.
Replace `disabled_fields_stripped` (context manager) with `strip_disabled_fields`
(eager, one-shot). Wire it into `UiPathBaseLLMClient.setup_model_info` so the
strip happens once, immediately after `disabled_params` resolves. Each strip
logs a warning that includes the original value, so the caller sees exactly
what was dropped at construction time rather than being silently surprised
later. The four `_generate`/`_agenerate`/`_stream`/`_astream` wrappers are now
plain again — no context-manager wrapping, no save/restore, no exception edge
cases, no generator subtlety.
Net effect for callers:
- `UiPathChatAnthropicBedrock(model="anthropic.claude-opus-4-7", temperature=0.7)`
now logs a warning and leaves `chat.temperature is None`.
- Per-call `chat.invoke(..., temperature=0.7)` still gets stripped by the
existing `strip_disabled_kwargs` filter, unchanged.
Tests updated to assert the field is None after construction (not "restored
after call"). Restore-on-exception test removed (no longer applicable). VCR
cassettes still replay — the gateway request body is unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d0ea322 commit afe4a3e
6 files changed
Lines changed: 147 additions & 227 deletions
File tree
- packages/uipath_langchain_client
- src/uipath_langchain_client
- src/uipath/llm_client/utils
- tests/langchain
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
Lines changed: 33 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | 53 | | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
| |||
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
192 | 206 | | |
193 | 207 | | |
194 | 208 | | |
| |||
423 | 437 | | |
424 | 438 | | |
425 | 439 | | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
| 440 | + | |
435 | 441 | | |
436 | 442 | | |
437 | 443 | | |
| |||
462 | 468 | | |
463 | 469 | | |
464 | 470 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| |||
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
509 | 507 | | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
518 | 512 | | |
519 | 513 | | |
520 | 514 | | |
| |||
543 | 537 | | |
544 | 538 | | |
545 | 539 | | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
551 | 543 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
560 | 548 | | |
561 | 549 | | |
562 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
100 | | - | |
101 | | - | |
| 99 | + | |
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
105 | 103 | | |
106 | 104 | | |
107 | | - | |
108 | | - | |
| 105 | + | |
| 106 | + | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 111 | + | |
| 112 | + | |
116 | 113 | | |
117 | 114 | | |
118 | 115 | | |
119 | | - | |
| 116 | + | |
| 117 | + | |
120 | 118 | | |
121 | 119 | | |
122 | | - | |
123 | 120 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
0 commit comments