Skip to content

Commit

Permalink
fix: Return input in write method (langchain-ai#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul authored Oct 24, 2024
1 parent 70453f2 commit 21d7992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion libs/langgraph/src/pregel/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export class ChannelWrite<
return [...writes, ...values];
}

async _write(input: unknown, config: RunnableConfig): Promise<void> {
async _write(input: unknown, config: RunnableConfig): Promise<unknown> {
const values = await this._getWriteValues(input, config);
ChannelWrite.doWrite(config, values);
return input;
}

// TODO: Support requireAtLeastOneOf
Expand Down
8 changes: 4 additions & 4 deletions libs/langgraph/src/tests/tracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ it("stream events for a multi-node graph", async () => {
{
event: "on_chain_end",
data: {
output: { output: undefined },
output: { messages: [] },
input: {
messages: [],
},
Expand Down Expand Up @@ -174,7 +174,7 @@ it("stream events for a multi-node graph", async () => {
{
event: "on_chain_end",
data: {
output: { output: undefined },
output: { messages: [new _AnyIdAIMessage("hey!")] },
input: {
messages: [new _AnyIdAIMessage("hey!")],
},
Expand Down Expand Up @@ -413,7 +413,7 @@ it("Should respect .withConfig", async () => {
{
event: "on_chain_end",
data: {
output: { output: undefined },
output: { messages: [] },
input: {
messages: [],
},
Expand Down Expand Up @@ -515,7 +515,7 @@ it("Should respect .withConfig", async () => {
{
event: "on_chain_end",
data: {
output: { output: undefined },
output: { messages: [new _AnyIdAIMessage("hey!")] },
input: {
messages: [new _AnyIdAIMessage("hey!")],
},
Expand Down

0 comments on commit 21d7992

Please sign in to comment.