@langchain/langgraph 0.2.37 → 0.2.38

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.
@@ -74,7 +74,7 @@ class StreamMessagesHandler extends base_1.BaseCallbackHandler {
74
74
  handleChatModelStart(_llm, _messages, runId, _parentRunId, _extraParams, tags, metadata, name) {
75
75
  if (metadata &&
76
76
  // Include legacy LangGraph SDK tag
77
- (!tags || !(tags.includes(constants_js_1.TAG_NOSTREAM) && tags.includes("nostream")))) {
77
+ (!tags || (!tags.includes(constants_js_1.TAG_NOSTREAM) && !tags.includes("nostream")))) {
78
78
  this.metadatas[runId] = [
79
79
  metadata.langgraph_checkpoint_ns.split("|"),
80
80
  { tags, name, ...metadata },
@@ -84,13 +84,15 @@ class StreamMessagesHandler extends base_1.BaseCallbackHandler {
84
84
  handleLLMNewToken(token, _idx, runId, _parentRunId, _tags, fields) {
85
85
  const chunk = fields?.chunk;
86
86
  this.emittedChatModelRunIds[runId] = true;
87
- if (isChatGenerationChunk(chunk) && this.metadatas[runId] !== undefined) {
88
- this._emit(this.metadatas[runId], chunk.message);
89
- }
90
- else {
91
- this._emit(this.metadatas[runId], new messages_1.AIMessageChunk({
92
- content: token,
93
- }));
87
+ if (this.metadatas[runId] !== undefined) {
88
+ if (isChatGenerationChunk(chunk)) {
89
+ this._emit(this.metadatas[runId], chunk.message);
90
+ }
91
+ else {
92
+ this._emit(this.metadatas[runId], new messages_1.AIMessageChunk({
93
+ content: token,
94
+ }));
95
+ }
94
96
  }
95
97
  }
96
98
  handleLLMEnd(output, runId) {
@@ -71,7 +71,7 @@ export class StreamMessagesHandler extends BaseCallbackHandler {
71
71
  handleChatModelStart(_llm, _messages, runId, _parentRunId, _extraParams, tags, metadata, name) {
72
72
  if (metadata &&
73
73
  // Include legacy LangGraph SDK tag
74
- (!tags || !(tags.includes(TAG_NOSTREAM) && tags.includes("nostream")))) {
74
+ (!tags || (!tags.includes(TAG_NOSTREAM) && !tags.includes("nostream")))) {
75
75
  this.metadatas[runId] = [
76
76
  metadata.langgraph_checkpoint_ns.split("|"),
77
77
  { tags, name, ...metadata },
@@ -81,13 +81,15 @@ export class StreamMessagesHandler extends BaseCallbackHandler {
81
81
  handleLLMNewToken(token, _idx, runId, _parentRunId, _tags, fields) {
82
82
  const chunk = fields?.chunk;
83
83
  this.emittedChatModelRunIds[runId] = true;
84
- if (isChatGenerationChunk(chunk) && this.metadatas[runId] !== undefined) {
85
- this._emit(this.metadatas[runId], chunk.message);
86
- }
87
- else {
88
- this._emit(this.metadatas[runId], new AIMessageChunk({
89
- content: token,
90
- }));
84
+ if (this.metadatas[runId] !== undefined) {
85
+ if (isChatGenerationChunk(chunk)) {
86
+ this._emit(this.metadatas[runId], chunk.message);
87
+ }
88
+ else {
89
+ this._emit(this.metadatas[runId], new AIMessageChunk({
90
+ content: token,
91
+ }));
92
+ }
91
93
  }
92
94
  }
93
95
  handleLLMEnd(output, runId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {