Skip to content

Commit

Permalink
Fix the issue where the track function does not support the LANGCHAIN…
Browse files Browse the repository at this point in the history
…_SESSION environment variable (langchain-ai#1013)

Co-authored-by: Nuno Campos <[email protected]>
  • Loading branch information
rxliuli and nfcampos authored Apr 27, 2023
1 parent bb602ef commit 26b9e88
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion langchain/src/callbacks/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,15 @@ export class CallbackManager
(handler) => handler.name === "langchain_tracer"
)
) {
callbackManager.addHandler(await getTracingCallbackHandler(), true);
const session =
typeof process !== "undefined"
? // eslint-disable-next-line no-process-env
process.env?.LANGCHAIN_SESSION
: undefined;
callbackManager.addHandler(
await getTracingCallbackHandler(session),
true
);
}
}
return callbackManager;
Expand Down

0 comments on commit 26b9e88

Please sign in to comment.