Commit fea1700
authored
Fix parametrized 'model' api key auto-loading (#1436)
# why
Auto-loading different provider api keys isn't working on parametrized
act/extract/observe `model` string definitions
# what changed
- Added prepareModelConfig helper method that ensures model
configurations
include the appropriate API key
- When a model string or object is passed without an API key, the
method:
- Uses the default modelApiKey if the provider matches the one from init
- Auto-loads the API key from environment variables (via
`loadApiKeyFromEnv`) if the provider differs
- Applied the helper to `act`, `extract`, and `observe` methods
# test plan
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes API key auto-loading for parametrized model inputs in act,
extract, and observe. Ensures the correct provider key is attached
automatically, falling back to env vars when switching providers.
- **Bug Fixes**
- Added prepareModelConfig to attach apiKey to model strings/objects.
- Detects provider from modelName and uses loadApiKeyFromEnv when it
differs from the initialized provider; otherwise uses the default
modelApiKey.
- Applied to act, extract, and observe option handling.
<sup>Written for commit 28d764b.
Summary will update automatically on new commits.</sup>
<!-- End of auto-generated description by cubic. -->1 parent b48c9c6 commit fea1700
File tree
2 files changed
+68
-0
lines changed- .changeset
- packages/core/lib/v3
2 files changed
+68
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
| |||
147 | 154 | | |
148 | 155 | | |
149 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
150 | 160 | | |
151 | 161 | | |
152 | 162 | | |
| |||
175 | 185 | | |
176 | 186 | | |
177 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
178 | 191 | | |
179 | 192 | | |
180 | 193 | | |
| |||
199 | 212 | | |
200 | 213 | | |
201 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
| |||
365 | 381 | | |
366 | 382 | | |
367 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
368 | 431 | | |
369 | 432 | | |
370 | 433 | | |
| |||
0 commit comments