You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ce90661
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(anthropic): support Claude Sonnet 5.5 compatibility (#40882)
Copy file name to clipboardExpand all lines: libs/partners/anthropic/README.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,27 @@ As an open-source project in a rapidly developing field, we are extremely open t
31
31
32
32
For detailed information on how to contribute, see the [Contributing Guide](https://docs.langchain.com/oss/python/contributing/overview).
33
33
34
+
## Migrating to Claude Sonnet 5.5
35
+
36
+
```python
37
+
from langchain_anthropic import ChatAnthropic
38
+
39
+
model = ChatAnthropic(
40
+
model="claude-sonnet-5-5",
41
+
max_tokens=16000,
42
+
output_config={"effort": "medium"},
43
+
)
44
+
```
45
+
46
+
- Use `with_structured_output(schema, method="json_schema")` for native structured output. Sonnet 5.5 rejects forced tool choice (`"any"` or a tool name). Function-calling structured output does not force a call and raises a parsing error if the model answers without one.
47
+
- Thinking is adaptive by default. For no up-front thinking, use `thinking={"type": "between_tools"}` at `high` effort or below, with no additional thinking fields. `disabled` and budgeted `enabled` thinking are unsupported.
48
+
- Omit sampling settings; non-default `temperature`, `top_p`, and `top_k` are rejected. Budget output tokens for both thinking and text.
49
+
- Preserve signed thinking blocks, including empty ones, and keep history append-only. Use mid-conversation system messages to change instructions or tools rather than editing earlier turns.
50
+
- Progress updates can arrive as thinking blocks. Use adaptive thinking with `display="summarized"` or `display="updates"` to display them; the latter's beta header is added automatically.
51
+
- Computer use on the direct Claude API requires `computer_toolset_20260801`. Preserve the returned tool-use content: its `toolset_name` is retained on replay and copied to matching tool results. Remove the old fine-grained streaming beta when using toolsets.
52
+
53
+
See the [migration guide](https://platform.claude.com/docs/en/models/sonnet-5-5/migration-guide) for platform-specific restrictions, advisor pairings, and refusal/fallback behavior.
54
+
34
55
## Resources
35
56
36
57
-[LangChain Academy](https://academy.langchain.com/) — comprehensive, free courses on LangChain libraries and products, made by the LangChain team
0 commit comments