@langchain/anthropic 0.3.29 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -635,6 +635,8 @@ class ChatAnthropicMessages extends chat_models_1.BaseChatModel {
635
635
  this.streaming = fields?.streaming ?? false;
636
636
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
637
637
  this.thinking = fields?.thinking ?? this.thinking;
638
+ this.contextManagement =
639
+ fields?.contextManagement ?? this.contextManagement;
638
640
  this.createClient =
639
641
  fields?.createClient ??
640
642
  ((options) => new sdk_1.Anthropic(options));
@@ -702,7 +704,7 @@ class ChatAnthropicMessages extends chat_models_1.BaseChatModel {
702
704
  if (this.topK !== -1) {
703
705
  throw new Error("topK is not supported when thinking is enabled");
704
706
  }
705
- if (this.model.includes("opus-4-1")
707
+ if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")
706
708
  ? this.topP !== undefined
707
709
  : this.topP !== -1) {
708
710
  throw new Error("topP is not supported when thinking is enabled");
@@ -632,6 +632,8 @@ export class ChatAnthropicMessages extends BaseChatModel {
632
632
  this.streaming = fields?.streaming ?? false;
633
633
  this.streamUsage = fields?.streamUsage ?? this.streamUsage;
634
634
  this.thinking = fields?.thinking ?? this.thinking;
635
+ this.contextManagement =
636
+ fields?.contextManagement ?? this.contextManagement;
635
637
  this.createClient =
636
638
  fields?.createClient ??
637
639
  ((options) => new Anthropic(options));
@@ -699,7 +701,7 @@ export class ChatAnthropicMessages extends BaseChatModel {
699
701
  if (this.topK !== -1) {
700
702
  throw new Error("topK is not supported when thinking is enabled");
701
703
  }
702
- if (this.model.includes("opus-4-1")
704
+ if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")
703
705
  ? this.topP !== undefined
704
706
  : this.topP !== -1) {
705
707
  throw new Error("topP is not supported when thinking is enabled");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/anthropic",
3
- "version": "0.3.29",
3
+ "version": "0.3.31",
4
4
  "description": "Anthropic integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {