Commit 4e744a8
authored
fix(drivers-prompt-anthropic): make top_p and top_k optional to avoid API conflict (#2070)
* fix(drivers-prompt-anthropic): make top_p and top_k optional to avoid API conflict
Newer Anthropic models (Claude 4.6+) reject requests that specify both
`temperature` and `top_p`. Change `top_p` and `top_k` to Optional fields
defaulting to None, and only include them in the API params when
explicitly set. This follows Anthropic's recommendation to use
`temperature` alone for most use cases.
Made-with: Cursor
* fix: exclude temperature from API params when top_p is explicitly set
When top_p is provided, temperature is now omitted from the Anthropic
API request to avoid the mutual exclusivity conflict on newer models.
This ensures callers who prefer top_p-based sampling don't hit a 400.
Made-with: Cursor1 parent c3b8f01 commit 4e744a8
File tree
3 files changed
+40
-11
lines changed- griptape/drivers/prompt
- tests/unit
- configs/drivers
- drivers/prompt
3 files changed
+40
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | 126 | | |
128 | | - | |
129 | | - | |
130 | 127 | | |
131 | 128 | | |
| 129 | + | |
| 130 | + | |
132 | 131 | | |
133 | 132 | | |
134 | 133 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
Lines changed: 34 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
386 | | - | |
387 | 385 | | |
388 | 386 | | |
389 | 387 | | |
| |||
430 | 428 | | |
431 | 429 | | |
432 | 430 | | |
433 | | - | |
434 | | - | |
435 | 431 | | |
436 | 432 | | |
437 | 433 | | |
| |||
464 | 460 | | |
465 | 461 | | |
466 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
467 | 497 | | |
468 | 498 | | |
469 | 499 | | |
| |||
0 commit comments