@langchain/anthropic 0.3.31 → 0.3.32

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.
@@ -615,8 +615,9 @@ class ChatAnthropicMessages extends chat_models_1.BaseChatModel {
615
615
  this.modelName = fields?.model ?? fields?.modelName ?? this.model;
616
616
  this.model = this.modelName;
617
617
  this.invocationKwargs = fields?.invocationKwargs ?? {};
618
- // Default to `undefined` for `topP` for Opus 4.1 and Sonnet 4.5 models
619
- if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")) {
618
+ if (this.model.includes("opus-4-1") ||
619
+ this.model.includes("sonnet-4-5") ||
620
+ this.model.includes("haiku-4-5")) {
620
621
  this.topP = fields?.topP === null ? undefined : fields?.topP;
621
622
  }
622
623
  else {
@@ -704,7 +705,9 @@ class ChatAnthropicMessages extends chat_models_1.BaseChatModel {
704
705
  if (this.topK !== -1) {
705
706
  throw new Error("topK is not supported when thinking is enabled");
706
707
  }
707
- if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")
708
+ if (this.model.includes("opus-4-1") ||
709
+ this.model.includes("sonnet-4-5") ||
710
+ this.model.includes("haiku-4-5")
708
711
  ? this.topP !== undefined
709
712
  : this.topP !== -1) {
710
713
  throw new Error("topP is not supported when thinking is enabled");
@@ -52,8 +52,6 @@ export interface AnthropicInput {
52
52
  *
53
53
  * To not set this field, pass `null`. If `undefined` is passed,
54
54
  * the default (-1) will be used.
55
- *
56
- * For Opus 4.1 and Sonnet 4.5, this defaults to `null`.
57
55
  */
58
56
  topP?: number | null;
59
57
  /** A maximum number of tokens to generate before stopping. */
@@ -612,8 +612,9 @@ export class ChatAnthropicMessages extends BaseChatModel {
612
612
  this.modelName = fields?.model ?? fields?.modelName ?? this.model;
613
613
  this.model = this.modelName;
614
614
  this.invocationKwargs = fields?.invocationKwargs ?? {};
615
- // Default to `undefined` for `topP` for Opus 4.1 and Sonnet 4.5 models
616
- if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")) {
615
+ if (this.model.includes("opus-4-1") ||
616
+ this.model.includes("sonnet-4-5") ||
617
+ this.model.includes("haiku-4-5")) {
617
618
  this.topP = fields?.topP === null ? undefined : fields?.topP;
618
619
  }
619
620
  else {
@@ -701,7 +702,9 @@ export class ChatAnthropicMessages extends BaseChatModel {
701
702
  if (this.topK !== -1) {
702
703
  throw new Error("topK is not supported when thinking is enabled");
703
704
  }
704
- if (this.model.includes("opus-4-1") || this.model.includes("sonnet-4-5")
705
+ if (this.model.includes("opus-4-1") ||
706
+ this.model.includes("sonnet-4-5") ||
707
+ this.model.includes("haiku-4-5")
705
708
  ? this.topP !== undefined
706
709
  : this.topP !== -1) {
707
710
  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.31",
3
+ "version": "0.3.32",
4
4
  "description": "Anthropic integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {