tracer.cjs 962 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.setDefaultLangChainClientSingleton = exports.getDefaultLangChainClientSingleton = void 0;
  4. const langsmith_1 = require("langsmith");
  5. const env_js_1 = require("../utils/env.cjs");
  6. let client;
  7. const getDefaultLangChainClientSingleton = () => {
  8. if (client === undefined) {
  9. const clientParams = (0, env_js_1.getEnvironmentVariable)("LANGCHAIN_CALLBACKS_BACKGROUND") === "false"
  10. ? {
  11. // LangSmith has its own backgrounding system
  12. blockOnRootRunFinalization: true,
  13. }
  14. : {};
  15. client = new langsmith_1.Client(clientParams);
  16. }
  17. return client;
  18. };
  19. exports.getDefaultLangChainClientSingleton = getDefaultLangChainClientSingleton;
  20. const setDefaultLangChainClientSingleton = (newClient) => {
  21. client = newClient;
  22. };
  23. exports.setDefaultLangChainClientSingleton = setDefaultLangChainClientSingleton;