langchain-ai / langchainjs

🦜🔗 Build context-aware reasoning applications 🦜🔗
https://js.langchain.com/docs/
MIT License
12.68k stars 2.18k forks source link

Clear `AsyncLocalStorage` when calling callbacks #7168

Closed drewmacneil closed 1 day ago

drewmacneil commented 5 days ago

Checked other resources

Example Code

Given the following graph and callbacks:

  const logger = RunnableLambda.from(async (_, config) => {
    console.log("SECOND CONFIG", config);
    return "bar";
  });
  class EvalCallback extends BaseTracer {
    name = "eval";

    protected async persistRun(): Promise<void> {
      await logger.batch(["1", "2", "3"]);
    }
  }
  const StateAnnotation = Annotation.Root({});
  const graph = new StateGraph(StateAnnotation)
    .addNode("foo", async (_, config) => {
      console.log("FIRST CONFIG", config);
      const foo = RunnableLambda.from(async () => {
        return "foo";
      });
      await foo.invoke("foo");
      return "bar";
    })
    .addEdge("__start__", "foo")
    .compile();

Error Message and Stack Trace (if applicable)

No response

Description

If you execute the above code the following way:

  const runnable = RunnableLambda.from(async (args) => args))
  .pipe(RunnablePassthrough.assign({ graphOutput: graph }))
  .pipe(RunnableLambda.from(async (args) => args.graphOutput));

await runnable.invoke(args, { callbacks: [new EvalCallback()] });

I observe that the logger chain is reported by LangSmith as a sibling node to the LangGraph node and not as its own independent root. Given that chain is executed within a callback, I'd have expected it to be logged as its own root.

System Info

yarn info langchain
yarn info v1.22.22
{
  name: 'langchain',
  'dist-tags': {
    next: '0.3.2-rc.0',
    'tag-for-publishing-older-releases': '0.2.20',
    latest: '0.3.5'
  },
  versions: [
    '0.0.4',
    '0.0.5',
    '0.0.6',
    '0.0.7',
    '0.0.8',
    '0.0.9',
    '0.0.10',
    '0.0.11',
    '0.0.12',
    '0.0.13',
    '0.0.14',
    '0.0.15',
    '0.0.16',
    '0.0.17',
    '0.0.18',
    '0.0.19',
    '0.0.20',
    '0.0.21',
    '0.0.22',
    '0.0.23',
    '0.0.24',
    '0.0.25',
    '0.0.26',
    '0.0.27',
    '0.0.28',
    '0.0.29',
    '0.0.30',
    '0.0.31',
    '0.0.32',
    '0.0.33',
    '0.0.34',
    '0.0.35',
    '0.0.36',
    '0.0.37',
    '0.0.38',
    '0.0.39',
    '0.0.40',
    '0.0.41',
    '0.0.42',
    '0.0.43',
    '0.0.44',
    '0.0.45',
    '0.0.46',
    '0.0.47',
    '0.0.48',
    '0.0.49-0',
    '0.0.49-1',
    '0.0.49',
    '0.0.50',
    '0.0.51',
    '0.0.52-0',
    '0.0.52',
    '0.0.53',
    '0.0.54',
    '0.0.55',
    '0.0.56',
    '0.0.57',
    '0.0.58',
    '0.0.59',
    '0.0.60',
    '0.0.61',
    '0.0.62',
    '0.0.63',
    '0.0.64',
    '0.0.65',
    '0.0.66',
    '0.0.67',
    '0.0.68',
    '0.0.69',
    '0.0.70',
    '0.0.71',
    '0.0.72',
    '0.0.73',
    '0.0.74',
    '0.0.75',
    '0.0.76',
    '0.0.77',
    '0.0.78',
    '0.0.79',
    '0.0.80',
    '0.0.81',
    '0.0.82',
    '0.0.83',
    '0.0.84',
    '0.0.85',
    '0.0.86',
    '0.0.87',
    '0.0.88',
    '0.0.89',
    '0.0.90',
    '0.0.91',
    '0.0.92',
    '0.0.93',
    '0.0.94',
    '0.0.95',
    '0.0.96',
    '0.0.97',
    '0.0.98',
    '0.0.99',
    '0.0.100',
    '0.0.101',
    '0.0.102',
    '0.0.103',
    '0.0.104',
    '0.0.105',
    '0.0.106',
    '0.0.107',
    '0.0.108',
    '0.0.109',
    '0.0.110',
    '0.0.111',
    '0.0.112',
    '0.0.113',
    '0.0.114',
    '0.0.115',
    '0.0.116',
    '0.0.117',
    '0.0.118',
    '0.0.119',
    '0.0.120',
    '0.0.121',
    '0.0.122',
    '0.0.123',
    '0.0.124',
    '0.0.125',
    '0.0.126',
    '0.0.127',
    '0.0.128',
    '0.0.129',
    '0.0.130',
    '0.0.131',
    '0.0.132',
    '0.0.133',
    '0.0.134',
    '0.0.135',
    '0.0.136',
    '0.0.137',
    '0.0.138',
    '0.0.139',
    '0.0.140',
    '0.0.141',
    '0.0.142',
    '0.0.143',
    '0.0.144',
    '0.0.145',
    '0.0.146',
    '0.0.147',
    '0.0.148',
    '0.0.149',
    '0.0.150',
    '0.0.151',
    '0.0.152',
    '0.0.153',
    '0.0.154',
    '0.0.155',
    '0.0.156',
    '0.0.157',
    '0.0.158',
    '0.0.159',
    '0.0.160',
    '0.0.161',
    '0.0.162',
    '0.0.163',
    '0.0.164',
    '0.0.165',
    '0.0.166',
    '0.0.167',
    '0.0.168',
    '0.0.169',
    '0.0.170',
    '0.0.171',
    '0.0.172',
    '0.0.173',
    '0.0.174',
    '0.0.175',
    '0.0.176',
    '0.0.177',
    '0.0.178',
    '0.0.179',
    '0.0.180',
    '0.0.181',
    '0.0.182-rc.0',
    '0.0.182-rc.1',
    '0.0.182',
    '0.0.183',
    '0.0.184',
    '0.0.185',
    '0.0.186',
    '0.0.187',
    '0.0.188',
    '0.0.189',
    '0.0.190',
    '0.0.191',
    '0.0.192',
    '0.0.193',
    '0.0.194',
    '0.0.195',
    '0.0.196',
    '0.0.197-rc.0',
    '0.0.197-rc.1',
    '0.0.197',
    '0.0.198',
    '0.0.199',
    '0.0.200',
    '0.0.201',
    '0.0.202',
    '0.0.203',
    '0.0.204-rc.0',
    '0.0.204-rc.1',
    '0.0.204-rc.2',
    '0.0.204',
    '0.0.205',
    '0.0.206',
    '0.0.207',
    '0.0.208',
    '0.0.209-rc.0',
    '0.0.209',
    '0.0.210',
    '0.0.211',
    '0.0.212',
    '0.0.213',
    '0.0.214',
    '0.1.0-rc.0',
    '0.1.0-rc.1',
    '0.1.0',
    '0.1.1',
    '0.1.2',
    '0.1.3',
    '0.1.4',
    '0.1.5',
    '0.1.6',
    '0.1.7',
    '0.1.8',
    '0.1.9-rc.0',
    '0.1.9',
    '0.1.10',
    '0.1.11',
    '0.1.12',
    '0.1.13',
    '0.1.14',
    '0.1.15',
    '0.1.16-rc.0',
    '0.1.16',
    '0.1.17',
    '0.1.18',
    '0.1.19-rc.0',
    '0.1.19-rc.1',
    '0.1.19-rc.2',
    '0.1.19',
    '0.1.20',
    '0.1.21',
    '0.1.22',
    '0.1.23',
    '0.1.24',
    '0.1.25',
    '0.1.26',
    '0.1.27',
    '0.1.28',
    '0.1.29-rc.0',
    '0.1.29',
    '0.1.30',
    '0.1.31',
    '0.1.32',
    '0.1.33',
    '0.1.34',
    '0.1.35',
    '0.1.36',
    '0.1.37',
    '0.2.0-rc.0',
    '0.2.0-rc.1',
    '0.2.0',
    '0.2.1',
    '0.2.2',
    '0.2.3-rc.0',
    '0.2.3',
    '0.2.4',
    '0.2.5',
    '0.2.6',
    '0.2.7',
    '0.2.8',
    '0.2.9',
    '0.2.10',
    '0.2.11',
    '0.2.12',
    '0.2.13',
    '0.2.14',
    '0.2.15',
    '0.2.16',
    '0.2.17',
    '0.2.18',
    '0.2.19',
    '0.2.20',
    '0.3.0-rc.0',
    '0.3.0',
    '0.3.1',
    '0.3.2-rc.0',
    '0.3.2',
    '0.3.3',
    '0.3.4',
    '0.3.5'
  ],
  time: {
    created: '2023-02-14T18:06:57.074Z',
    modified: '2024-10-28T00:27:15.088Z',
    '1.0.0': '2023-01-20T03:45:29.634Z',
    '1.0.9': '2023-01-22T02:02:57.467Z',
    '0.0.1': '2023-01-26T21:22:58.657Z',
    '0.0.4': '2023-02-14T18:06:57.434Z',
    '0.0.5': '2023-02-17T05:51:37.227Z',
    '0.0.6': '2023-02-17T08:53:32.946Z',
    '0.0.7': '2023-02-18T00:31:00.386Z',
    '0.0.8': '2023-02-20T04:56:45.683Z',
    '0.0.9': '2023-02-21T07:17:14.208Z',
    '0.0.10': '2023-02-22T18:48:35.631Z',
    '0.0.11': '2023-02-23T16:12:41.455Z',
    '0.0.12': '2023-02-26T18:49:26.071Z',
    '0.0.13': '2023-02-27T16:03:50.432Z',
    '0.0.14': '2023-02-27T16:59:17.082Z',
    '0.0.15': '2023-02-27T17:59:53.741Z',
    '0.0.16': '2023-02-28T16:41:21.705Z',
    '0.0.17': '2023-03-01T15:28:09.338Z',
    '0.0.18': '2023-03-01T20:00:24.554Z',
    '0.0.19': '2023-03-01T20:58:49.811Z',
    '0.0.20': '2023-03-02T17:11:30.882Z',
    '0.0.21': '2023-03-03T19:23:04.354Z',
    '0.0.22': '2023-03-04T16:00:04.873Z',
    '0.0.23': '2023-03-06T16:42:44.996Z',
    '0.0.24': '2023-03-07T18:10:28.933Z',
    '0.0.25': '2023-03-08T17:42:24.706Z',
    '0.0.26': '2023-03-09T19:36:23.799Z',
    '0.0.27': '2023-03-10T16:24:31.279Z',
    '0.0.28': '2023-03-11T19:41:29.182Z',
    '0.0.29': '2023-03-12T07:41:25.588Z',
    '0.0.30': '2023-03-13T19:27:19.085Z',
    '0.0.31': '2023-03-13T22:48:33.902Z',
    '0.0.32': '2023-03-14T08:48:30.479Z',
    '0.0.33': '2023-03-14T18:36:54.970Z',
    '0.0.34': '2023-03-15T18:20:43.233Z',
    '0.0.35': '2023-03-15T18:59:13.048Z',
    '0.0.36': '2023-03-17T18:55:33.715Z',
    '0.0.37': '2023-03-20T20:10:36.444Z',
    '0.0.38': '2023-03-21T18:31:14.819Z',
    '0.0.39': '2023-03-22T15:47:46.529Z',
    '0.0.40': '2023-03-24T15:13:53.947Z',
    '0.0.41': '2023-03-24T19:33:29.565Z',
    '0.0.42': '2023-03-27T18:47:07.410Z',
    '0.0.43': '2023-03-28T18:43:21.068Z',
    '0.0.44': '2023-03-29T18:45:08.636Z',
    '0.0.45': '2023-03-31T15:55:26.705Z',
    '0.0.46': '2023-04-03T15:46:07.061Z',
    '0.0.47': '2023-04-03T15:55:06.384Z',
    '0.0.48': '2023-04-04T17:25:41.531Z',
    '0.0.49-0': '2023-04-05T12:56:44.659Z',
    '0.0.49-1': '2023-04-05T13:07:31.197Z',
    '0.0.49': '2023-04-06T10:31:23.786Z',
    '0.0.50': '2023-04-07T21:46:20.961Z',
    '0.0.51': '2023-04-08T17:07:19.121Z',
    '0.0.52-0': '2023-04-09T17:48:55.378Z',
    '0.0.52': '2023-04-10T18:57:02.678Z',
    '0.0.53': '2023-04-11T15:51:36.258Z',
    '0.0.54': '2023-04-12T16:59:09.975Z',
    '0.0.55': '2023-04-13T16:22:58.352Z',
    '0.0.56': '2023-04-14T17:47:49.152Z',
    '0.0.57': '2023-04-17T17:01:13.362Z',
    '0.0.58': '2023-04-18T18:51:48.339Z',
    '0.0.59': '2023-04-18T20:23:09.912Z',
    '0.0.60': '2023-04-21T18:45:14.498Z',
    '0.0.61': '2023-04-21T20:58:46.669Z',
    '0.0.62': '2023-04-22T20:27:37.499Z',
    '0.0.63': '2023-04-23T15:27:57.932Z',
    '0.0.64': '2023-04-25T15:58:01.314Z',
    '0.0.65': '2023-04-28T11:29:13.611Z',
    '0.0.66': '2023-04-28T12:48:12.798Z',
    '0.0.67': '2023-05-01T14:55:22.206Z',
    '0.0.68': '2023-05-02T19:51:47.329Z',
    '0.0.69': '2023-05-04T17:35:32.223Z',
    '0.0.70': '2023-05-05T16:40:01.904Z',
    '0.0.71': '2023-05-06T15:19:04.361Z',
    '0.0.72': '2023-05-08T07:03:31.569Z',
    '0.0.73': '2023-05-09T18:50:58.586Z',
    '0.0.74': '2023-05-10T15:50:49.597Z',
    '0.0.75': '2023-05-11T18:54:42.166Z',
    '0.0.76': '2023-05-17T19:35:53.355Z',
    '0.0.77': '2023-05-18T15:25:50.965Z',
    '0.0.78': '2023-05-19T15:18:20.002Z',
    '0.0.79': '2023-05-23T16:30:38.510Z',
    '0.0.80': '2023-05-23T18:18:28.751Z',
    '0.0.81': '2023-05-23T18:57:35.910Z',
    '0.0.82': '2023-05-25T00:15:56.768Z',
    '0.0.83': '2023-05-25T16:48:27.312Z',
    '0.0.84': '2023-05-26T20:43:14.443Z',
    '0.0.85': '2023-05-30T19:31:33.866Z',
    '0.0.86': '2023-05-30T23:26:55.520Z',
    '0.0.87': '2023-05-31T15:23:33.608Z',
    '0.0.88': '2023-06-01T02:10:23.366Z',
    '0.0.89': '2023-06-02T16:10:24.873Z',
    '0.0.90': '2023-06-03T01:29:12.535Z',
    '0.0.91': '2023-06-04T23:00:33.336Z',
    '0.0.92': '2023-06-07T20:40:58.171Z',
    '0.0.93': '2023-06-13T17:32:25.870Z',
    '0.0.94': '2023-06-13T21:41:36.359Z',
    '0.0.95': '2023-06-14T14:25:53.017Z',
    '0.0.96': '2023-06-19T18:24:31.016Z',
    '0.0.97': '2023-06-26T20:08:09.043Z',
    '0.0.98': '2023-06-28T05:15:53.569Z',
    '0.0.99': '2023-06-29T10:00:34.210Z',
    '0.0.100': '2023-06-29T16:19:24.235Z',
    '0.0.101': '2023-06-30T19:51:23.760Z',
    '0.0.102': '2023-07-01T19:12:19.594Z',
    '0.0.103': '2023-07-05T23:21:04.630Z',
    '0.0.104': '2023-07-07T01:35:39.991Z',
    '0.0.105': '2023-07-09T00:55:47.724Z',
    '0.0.106': '2023-07-10T17:32:39.936Z',
    '0.0.107': '2023-07-12T06:09:52.155Z',
    '0.0.108': '2023-07-13T02:24:55.332Z',
    '0.0.109': '2023-07-14T01:37:31.791Z',
    '0.0.110': '2023-07-15T17:39:11.281Z',
    '0.0.111': '2023-07-18T04:22:39.858Z',
    '0.0.112': '2023-07-18T18:22:02.588Z',
    '0.0.113': '2023-07-19T23:56:22.261Z',
    '0.0.114': '2023-07-21T03:00:26.247Z',
    '0.0.115': '2023-07-24T01:01:00.307Z',
    '0.0.116': '2023-07-24T05:19:14.838Z',
    '0.0.117': '2023-07-25T00:26:59.388Z',
    '0.0.118': '2023-07-26T16:09:04.672Z',
    '0.0.119': '2023-07-28T22:08:02.687Z',
    '0.0.120': '2023-07-30T17:08:46.417Z',
    '0.0.121': '2023-08-01T21:15:07.740Z',
    '0.0.122': '2023-08-03T03:25:11.530Z',
    '0.0.123': '2023-08-05T06:09:18.474Z',
    '0.0.124': '2023-08-07T05:38:39.271Z',
    '0.0.125': '2023-08-09T03:48:44.885Z',
    '0.0.126': '2023-08-11T01:19:19.011Z',
    '0.0.127': '2023-08-12T01:03:28.743Z',
    '0.0.128': '2023-08-15T06:55:07.574Z',
    '0.0.129': '2023-08-16T02:39:45.923Z',
    '0.0.130': '2023-08-18T01:17:54.954Z',
    '0.0.131': '2023-08-19T00:48:09.017Z',
    '0.0.132': '2023-08-21T23:24:17.628Z',
    '0.0.133': '2023-08-24T02:13:40.841Z',
    '0.0.134': '2023-08-25T04:45:19.565Z',
    '0.0.135': '2023-08-26T00:44:11.083Z',
    '0.0.136': '2023-08-29T01:36:44.900Z',
    '0.0.137': '2023-08-30T01:34:15.475Z',
    '0.0.138': '2023-08-31T02:22:36.630Z',
    '0.0.139': '2023-09-01T07:20:17.993Z',
    '0.0.140': '2023-09-02T00:37:02.261Z',
    '0.0.141': '2023-09-03T07:34:21.546Z',
    '0.0.142': '2023-09-04T20:15:53.914Z',
    '0.0.143': '2023-09-05T14:41:59.202Z',
    '0.0.144': '2023-09-06T01:21:44.338Z',
    '0.0.145': '2023-09-07T01:35:35.892Z',
    '0.0.146': '2023-09-08T15:27:22.355Z',
    '0.0.147': '2023-09-12T06:22:04.926Z',
    '0.0.148': '2023-09-13T03:03:39.760Z',
    '0.0.149': '2023-09-14T01:40:17.567Z',
    '0.0.150': '2023-09-15T06:28:14.560Z',
    '0.0.151': '2023-09-19T03:53:15.800Z',
    '0.0.152': '2023-09-20T00:08:57.506Z',
    '0.0.153': '2023-09-21T03:10:39.410Z',
    '0.0.154': '2023-09-26T01:47:45.016Z',
    '0.0.155': '2023-09-28T01:35:14.504Z',
    '0.0.156': '2023-09-29T05:55:44.312Z',
    '0.0.157': '2023-10-02T01:10:49.355Z',
    '0.0.158': '2023-10-03T16:33:07.960Z',
    '0.0.159': '2023-10-04T05:07:58.638Z',
    '0.0.160': '2023-10-04T22:07:49.157Z',
    '0.0.161': '2023-10-06T02:07:05.756Z',
    '0.0.162': '2023-10-07T01:37:20.312Z',
    '0.0.163': '2023-10-08T01:32:36.536Z',
    '0.0.164': '2023-10-10T01:43:32.276Z',
    '0.0.165': '2023-10-10T20:57:49.443Z',
    '0.0.166': '2023-10-12T01:40:20.109Z',
    '0.0.167': '2023-10-14T00:32:54.607Z',
    '0.0.168': '2023-10-18T02:53:34.953Z',
    '0.0.169': '2023-10-19T06:32:45.493Z',
    '0.0.170': '2023-10-20T22:38:06.659Z',
    '0.0.171': '2023-10-24T00:17:00.928Z',
    '0.0.172': '2023-10-24T20:19:09.813Z',
    '0.0.173': '2023-10-26T00:58:15.045Z',
    '0.0.174': '2023-10-26T23:11:53.499Z',
    '0.0.175': '2023-10-28T17:04:03.349Z',
    '0.0.176': '2023-10-31T00:57:13.953Z',
    '0.0.177': '2023-11-01T00:20:00.276Z',
    '0.0.178': '2023-11-01T22:33:03.571Z',
    '0.0.179': '2023-11-03T05:49:56.666Z',
    '0.0.180': '2023-11-03T22:15:10.842Z',
    '0.0.181': '2023-11-06T09:59:26.380Z',
    '0.0.182-rc.0': '2023-11-06T22:23:48.947Z',
    '0.0.182-rc.1': '2023-11-07T03:41:06.816Z',
    '0.0.182': '2023-11-08T04:04:31.241Z',
    '0.0.183': '2023-11-08T05:25:05.808Z',
    '0.0.184': '2023-11-08T23:56:28.690Z',
    '0.0.185': '2023-11-10T02:35:22.582Z',
    '0.0.186': '2023-11-11T02:24:26.776Z',
    '0.0.187': '2023-11-14T04:35:18.096Z',
    '0.0.188': '2023-11-15T05:34:58.759Z',
    '0.0.189': '2023-11-15T06:30:57.181Z',
    '0.0.190': '2023-11-16T15:23:59.223Z',
    '0.0.191': '2023-11-16T16:31:07.507Z',
    '0.0.192': '2023-11-17T02:06:54.439Z',
    '0.0.193': '2023-11-19T11:06:54.623Z',
    '0.0.194': '2023-11-20T02:15:31.205Z',
    '0.0.195': '2023-11-20T20:25:34.666Z',
    '0.0.196': '2023-11-22T02:19:47.812Z',
    '0.0.197-rc.0': '2023-11-22T22:16:48.971Z',
    '0.0.197-rc.1': '2023-11-23T05:27:13.906Z',
    '0.0.197': '2023-11-27T17:42:53.476Z',
    '0.0.198': '2023-11-28T02:22:55.183Z',
    '0.0.199': '2023-12-01T01:28:26.144Z',
    '0.0.200': '2023-12-02T04:43:25.313Z',
    '0.0.201': '2023-12-05T04:22:22.540Z',
    '0.0.202': '2023-12-06T01:34:55.388Z',
    '0.0.203': '2023-12-07T06:15:39.619Z',
    '0.0.204-rc.0': '2023-12-08T02:34:03.010Z',
    '0.0.204-rc.1': '2023-12-09T03:54:40.336Z',
    '0.0.204-rc.2': '2023-12-11T20:15:35.207Z',
    '0.0.204': '2023-12-11T22:28:49.455Z',
    '0.0.205': '2023-12-12T18:27:07.427Z',
    '0.0.206': '2023-12-13T04:51:42.993Z',
    '0.0.207': '2023-12-14T03:34:38.535Z',
    '0.0.208': '2023-12-15T10:05:40.181Z',
    '0.0.209-rc.0': '2023-12-17T03:47:20.439Z',
    '0.0.209': '2023-12-17T06:10:40.303Z',
    '0.0.210': '2023-12-20T02:53:42.769Z',
    '0.0.211': '2023-12-21T07:29:16.193Z',
    '0.0.212': '2023-12-23T01:22:18.040Z',
    '0.0.213': '2023-12-29T15:33:05.323Z',
    '0.0.214': '2024-01-03T03:24:13.994Z',
    '0.1.0-rc.0': '2024-01-05T22:33:51.804Z',
    '0.1.0-rc.1': '2024-01-06T03:41:30.131Z',
    '0.1.0': '2024-01-06T03:58:20.185Z',
    '0.1.1': '2024-01-08T00:25:32.620Z',
    '0.1.2': '2024-01-09T22:35:21.328Z',
    '0.1.3': '2024-01-15T17:18:03.822Z',
    '0.1.4': '2024-01-18T05:58:46.640Z',
    '0.1.5': '2024-01-21T17:57:55.335Z',
    '0.1.6': '2024-01-24T07:58:31.013Z',
    '0.1.7': '2024-01-25T07:27:13.252Z',
    '0.1.8': '2024-01-27T01:11:52.718Z',
    '0.1.9-rc.0': '2024-01-27T06:14:56.103Z',
    '0.1.9': '2024-01-27T06:25:12.844Z',
    '0.1.10': '2024-01-30T09:54:07.013Z',
    '0.1.11': '2024-01-31T03:31:39.843Z',
    '0.1.12': '2024-02-01T23:57:54.094Z',
    '0.1.13': '2024-02-05T03:24:29.383Z',
    '0.1.14': '2024-02-07T01:03:54.355Z',
    '0.1.15': '2024-02-07T19:22:37.134Z',
    '0.1.16-rc.0': '2024-02-07T23:34:28.951Z',
    '0.1.16': '2024-02-07T23:45:35.740Z',
    '0.1.17': '2024-02-08T23:22:04.844Z',
    '0.1.18': '2024-02-13T23:15:14.011Z',
    '0.1.19-rc.0': '2024-02-14T23:59:15.835Z',
    '0.1.19-rc.1': '2024-02-16T00:20:22.801Z',
    '0.1.19': '2024-02-16T04:48:07.787Z',
    '0.1.19-rc.2': '2024-02-16T18:47:07.688Z',
    '0.1.20': '2024-02-16T22:03:07.378Z',
    '0.1.21': '2024-02-21T22:48:04.422Z',
    '0.1.22': '2024-02-26T20:27:53.383Z',
    '0.1.23': '2024-02-27T04:07:47.477Z',
    '0.1.24': '2024-02-29T00:52:15.516Z',
    '0.1.25': '2024-03-01T18:49:55.617Z',
    '0.1.26': '2024-03-10T01:36:01.782Z',
    '0.1.27': '2024-03-13T01:01:08.908Z',
    '0.1.28': '2024-03-15T00:06:05.523Z',
    '0.1.29-rc.0': '2024-03-15T03:31:14.345Z',
    '0.1.29': '2024-03-25T04:19:39.067Z',
    '0.1.30': '2024-03-26T06:27:42.909Z',
    '0.1.31': '2024-04-04T08:23:54.517Z',
    '0.1.32': '2024-04-09T01:22:19.683Z',
    '0.1.33': '2024-04-11T09:30:55.275Z',
    '0.1.34': '2024-04-18T03:01:59.519Z',
    '0.1.35': '2024-04-22T23:30:56.916Z',
    '0.1.36': '2024-04-24T21:36:22.008Z',
    '0.2.0-rc.0': '2024-04-26T23:56:59.053Z',
    '0.2.0-rc.1': '2024-05-02T22:00:18.752Z',
    '0.1.37': '2024-05-10T21:40:01.263Z',
    '0.2.0': '2024-05-17T21:03:13.753Z',
    '0.2.1': '2024-05-22T17:32:07.344Z',
    '0.2.2': '2024-05-23T23:12:00.768Z',
    '0.2.3-rc.0': '2024-05-28T21:17:33.560Z',
    '0.2.3': '2024-05-29T01:15:36.521Z',
    '0.2.4': '2024-05-31T04:14:35.289Z',
    '0.2.5': '2024-06-04T22:19:23.685Z',
    '0.2.6': '2024-06-21T23:52:24.414Z',
    '0.2.7': '2024-06-25T19:24:56.599Z',
    '0.2.8': '2024-06-28T01:05:43.266Z',
    '0.2.9': '2024-07-10T01:19:00.661Z',
    '0.2.10': '2024-07-16T04:39:54.756Z',
    '0.2.11': '2024-07-24T23:01:59.481Z',
    '0.2.12': '2024-07-30T16:59:27.878Z',
    '0.2.13': '2024-08-06T23:34:44.938Z',
    '0.2.14': '2024-08-09T19:52:51.258Z',
    '0.2.15': '2024-08-10T15:14:36.266Z',
    '0.2.16': '2024-08-13T11:41:17.160Z',
    '0.2.17': '2024-08-23T01:13:12.015Z',
    '0.2.18': '2024-09-04T22:45:35.518Z',
    '0.3.0-rc.0': '2024-09-07T00:10:44.310Z',
    '0.2.19': '2024-09-11T23:34:20.084Z',
    '0.3.0': '2024-09-13T21:43:36.208Z',
    '0.3.1': '2024-09-15T05:37:11.723Z',
    '0.3.2-rc.0': '2024-09-15T05:53:56.512Z',
    '0.3.2': '2024-09-15T06:16:32.327Z',
    '0.2.20': '2024-09-15T06:29:13.500Z',
    '0.3.3': '2024-10-21T18:07:59.871Z',
    '0.3.4': '2024-10-25T03:33:59.476Z',
    '0.3.5': '2024-10-28T00:27:14.931Z'
  },
  bugs: {
    url: 'https://github.com/langchain-ai/langchainjs/issues'
  },
  author: {
    name: 'LangChain'
  },
  license: 'MIT',
  homepage: 'https://github.com/langchain-ai/langchainjs/tree/main/langchain/',
  keywords: [
    'llm',
    'ai',
    'gpt3',
    'chain',
    'prompt',
    'prompt engineering',
    'chatgpt',
    'machine learning',
    'ml',
    'openai',
    'embeddings',
    'vectorstores'
  ],
  repository: {
    type: 'git',
    url: 'git+ssh://git@github.com/langchain-ai/langchainjs.git'
  },
  description: 'Typescript bindings for langchain',
  maintainers: [
    {
      name: 'nfcampos',
      email: 'nuno@boringbits.io'
    },
    {
      name: 'jacoblee93',
      email: 'jacoblee93@gmail.com'
    },
    {
      name: 'andrewnguonly',
      email: 'andrewnguonly@gmail.com'
    },
    {
      name: 'davidduong',
      email: 'david@duong.cz'
    },
    {
      name: 'hwchase17',
      email: 'hw.chase.17@gmail.com'
    },
    {
      name: 'basproul',
      email: 'braceasproul@gmail.com'
    }
  ],
  readmeFilename: 'README.md',
  version: '0.3.5',
  type: 'module',
  engines: {
    node: '>=18'
  },
  main: './index.js',
  types: './index.d.ts',
  scripts: {
    build: 'yarn turbo:command build:internal --filter=langchain',
    'build:internal': 'yarn lc_build --create-entrypoints --pre --tree-shaking --gen-maps',
    'lint:eslint': 'NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/',
    'lint:dpdm': 'dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts',
    lint: 'yarn lint:eslint && yarn lint:dpdm',
    'lint:fix': 'yarn lint:eslint --fix && yarn lint:dpdm',
    precommit: 'lint-staged',
    clean: 'rm -rf .turbo dist/',
    prepack: 'yarn build',
    release: 'release-it --only-version --config .release-it.json',
    test: 'NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%',
    'test:watch': 'NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts',
    'test:integration': 'NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%',
    'test:single': 'NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000',
    format: 'prettier --config .prettierrc --write "src"',
    'format:check': 'prettier --config .prettierrc --check "src"'
  },
  devDependencies: {
    '@faker-js/faker': '^7.6.0',
    '@jest/globals': '^29.5.0',
    '@langchain/anthropic': '*',
    '@langchain/aws': '*',
    '@langchain/cohere': '*',
    '@langchain/core': 'workspace:*',
    '@langchain/google-genai': '*',
    '@langchain/google-vertexai': '*',
    '@langchain/groq': '*',
    '@langchain/mistralai': '*',
    '@langchain/ollama': '*',
    '@langchain/scripts': '>=0.1.0 <0.2.0',
    '@swc/core': '^1.3.90',
    '@swc/jest': '^0.2.29',
    '@tsconfig/recommended': '^1.0.2',
    '@types/handlebars': '^4.1.0',
    '@types/html-to-text': '^9',
    '@types/js-yaml': '^4',
    '@types/jsdom': '^21.1.1',
    '@types/uuid': '^9',
    '@types/ws': '^8',
    '@typescript-eslint/eslint-plugin': '^5.58.0',
    '@typescript-eslint/parser': '^5.58.0',
    axios: '^0.26.0',
    cheerio: '1.0.0-rc.12',
    dotenv: '^16.0.3',
    dpdm: '^3.12.0',
    eslint: '^8.33.0',
    'eslint-config-airbnb-base': '^15.0.0',
    'eslint-config-prettier': '^8.6.0',
    'eslint-plugin-import': '^2.27.5',
    'eslint-plugin-jest': '^27.6.0',
    'eslint-plugin-no-instanceof': '^1.0.1',
    'eslint-plugin-prettier': '^4.2.1',
    handlebars: '^4.7.8',
    jest: '^29.5.0',
    'jest-environment-node': '^29.6.4',
    openai: '^4.41.1',
    peggy: '^3.0.2',
    prettier: '^2.8.3',
    'release-it': '^17.6.0',
    rimraf: '^5.0.1',
    rollup: '^3.19.1',
    'ts-jest': '^29.1.0',
    typeorm: '^0.3.20',
    typescript: '~5.1.6',
    wikipedia: '^2.1.2'
  },
  peerDependencies: {
    '@langchain/anthropic': '*',
    '@langchain/aws': '*',
    '@langchain/cohere': '*',
    '@langchain/core': '>=0.2.21 <0.4.0',
    '@langchain/google-genai': '*',
    '@langchain/google-vertexai': '*',
    '@langchain/groq': '*',
    '@langchain/mistralai': '*',
    '@langchain/ollama': '*',
    axios: '*',
    cheerio: '*',
    handlebars: '^4.7.8',
    peggy: '^3.0.2',
    typeorm: '*'
  },
  peerDependenciesMeta: {
    '@langchain/anthropic': {
      optional: true
    },
    '@langchain/aws': {
      optional: true
    },
    '@langchain/cohere': {
      optional: true
    },
    '@langchain/google-genai': {
      optional: true
    },
    '@langchain/google-vertexai': {
      optional: true
    },
    '@langchain/groq': {
      optional: true
    },
    '@langchain/mistralai': {
      optional: true
    },
    '@langchain/ollama': {
      optional: true
    },
    axios: {
      optional: true
    },
    cheerio: {
      optional: true
    },
    handlebars: {
      optional: true
    },
    peggy: {
      optional: true
    },
    typeorm: {
      optional: true
    }
  },
  dependencies: {
    '@langchain/openai': '>=0.1.0 <0.4.0',
    '@langchain/textsplitters': '>=0.0.0 <0.2.0',
    'js-tiktoken': '^1.0.12',
    'js-yaml': '^4.1.0',
    jsonpointer: '^5.0.1',
    langsmith: '^0.2.0',
    'openapi-types': '^12.1.3',
    'p-retry': '4',
    uuid: '^10.0.0',
    yaml: '^2.2.1',
    zod: '^3.22.4',
    'zod-to-json-schema': '^3.22.3'
  },
  publishConfig: {
    access: 'public'
  },
  exports: {
    './load': {
      types: {
        import: './load.d.ts',
        require: './load.d.cts',
        default: './load.d.ts'
      },
      import: './load.js',
      require: './load.cjs'
    },
    './load/serializable': {
      types: {
        import: './load/serializable.d.ts',
        require: './load/serializable.d.cts',
        default: './load/serializable.d.ts'
      },
      import: './load/serializable.js',
      require: './load/serializable.cjs'
    },
    './agents': {
      types: {
        import: './agents.d.ts',
        require: './agents.d.cts',
        default: './agents.d.ts'
      },
      import: './agents.js',
      require: './agents.cjs'
    },
    './agents/load': {
      types: {
        import: './agents/load.d.ts',
        require: './agents/load.d.cts',
        default: './agents/load.d.ts'
      },
      import: './agents/load.js',
      require: './agents/load.cjs'
    },
    './agents/toolkits': {
      types: {
        import: './agents/toolkits.d.ts',
        require: './agents/toolkits.d.cts',
        default: './agents/toolkits.d.ts'
      },
      import: './agents/toolkits.js',
      require: './agents/toolkits.cjs'
    },
    './agents/toolkits/sql': {
      types: {
        import: './agents/toolkits/sql.d.ts',
        require: './agents/toolkits/sql.d.cts',
        default: './agents/toolkits/sql.d.ts'
      },
      import: './agents/toolkits/sql.js',
      require: './agents/toolkits/sql.cjs'
    },
    './agents/format_scratchpad': {
      types: {
        import: './agents/format_scratchpad.d.ts',
        require: './agents/format_scratchpad.d.cts',
        default: './agents/format_scratchpad.d.ts'
      },
      import: './agents/format_scratchpad.js',
      require: './agents/format_scratchpad.cjs'
    },
    './agents/format_scratchpad/openai_tools': {
      types: {
        import: './agents/format_scratchpad/openai_tools.d.ts',
        require: './agents/format_scratchpad/openai_tools.d.cts',
        default: './agents/format_scratchpad/openai_tools.d.ts'
      },
      import: './agents/format_scratchpad/openai_tools.js',
      require: './agents/format_scratchpad/openai_tools.cjs'
    },
    './agents/format_scratchpad/log': {
      types: {
        import: './agents/format_scratchpad/log.d.ts',
        require: './agents/format_scratchpad/log.d.cts',
        default: './agents/format_scratchpad/log.d.ts'
      },
      import: './agents/format_scratchpad/log.js',
      require: './agents/format_scratchpad/log.cjs'
    },
    './agents/format_scratchpad/xml': {
      types: {
        import: './agents/format_scratchpad/xml.d.ts',
        require: './agents/format_scratchpad/xml.d.cts',
        default: './agents/format_scratchpad/xml.d.ts'
      },
      import: './agents/format_scratchpad/xml.js',
      require: './agents/format_scratchpad/xml.cjs'
    },
    './agents/format_scratchpad/log_to_message': {
      types: {
        import: './agents/format_scratchpad/log_to_message.d.ts',
        require: './agents/format_scratchpad/log_to_message.d.cts',
        default: './agents/format_scratchpad/log_to_message.d.ts'
      },
      import: './agents/format_scratchpad/log_to_message.js',
      require: './agents/format_scratchpad/log_to_message.cjs'
    },
    './agents/react/output_parser': {
      types: {
        import: './agents/react/output_parser.d.ts',
        require: './agents/react/output_parser.d.cts',
        default: './agents/react/output_parser.d.ts'
      },
      import: './agents/react/output_parser.js',
      require: './agents/react/output_parser.cjs'
    },
    './agents/xml/output_parser': {
      types: {
        import: './agents/xml/output_parser.d.ts',
        require: './agents/xml/output_parser.d.cts',
        default: './agents/xml/output_parser.d.ts'
      },
      import: './agents/xml/output_parser.js',
      require: './agents/xml/output_parser.cjs'
    },
    './agents/openai/output_parser': {
      types: {
        import: './agents/openai/output_parser.d.ts',
        require: './agents/openai/output_parser.d.cts',
        default: './agents/openai/output_parser.d.ts'
      },
      import: './agents/openai/output_parser.js',
      require: './agents/openai/output_parser.cjs'
    },
    './tools': {
      types: {
        import: './tools.d.ts',
        require: './tools.d.cts',
        default: './tools.d.ts'
      },
      import: './tools.js',
      require: './tools.cjs'
    },
    './tools/chain': {
      types: {
        import: './tools/chain.d.ts',
        require: './tools/chain.d.cts',
        default: './tools/chain.d.ts'
      },
      import: './tools/chain.js',
      require: './tools/chain.cjs'
    },
    './tools/render': {
      types: {
        import: './tools/render.d.ts',
        require: './tools/render.d.cts',
        default: './tools/render.d.ts'
      },
      import: './tools/render.js',
      require: './tools/render.cjs'
    },
    './tools/retriever': {
      types: {
        import: './tools/retriever.d.ts',
        require: './tools/retriever.d.cts',
        default: './tools/retriever.d.ts'
      },
      import: './tools/retriever.js',
      require: './tools/retriever.cjs'
    },
    './tools/sql': {
      types: {
        import: './tools/sql.d.ts',
        require: './tools/sql.d.cts',
        default: './tools/sql.d.ts'
      },
      import: './tools/sql.js',
      require: './tools/sql.cjs'
    },
    './tools/webbrowser': {
      types: {
        import: './tools/webbrowser.d.ts',
        require: './tools/webbrowser.d.cts',
        default: './tools/webbrowser.d.ts'
      },
      import: './tools/webbrowser.js',
      require: './tools/webbrowser.cjs'
    },
    './chains': {
      types: {
        import: './chains.d.ts',
        require: './chains.d.cts',
        default: './chains.d.ts'
      },
      import: './chains.js',
      require: './chains.cjs'
    },
    './chains/combine_documents': {
      types: {
        import: './chains/combine_documents.d.ts',
        require: './chains/combine_documents.d.cts',
        default: './chains/combine_documents.d.ts'
      },
      import: './chains/combine_documents.js',
      require: './chains/combine_documents.cjs'
    },
    './chains/combine_documents/reduce': {
      types: {
        import: './chains/combine_documents/reduce.d.ts',
        require: './chains/combine_documents/reduce.d.cts',
        default: './chains/combine_documents/reduce.d.ts'
      },
      import: './chains/combine_documents/reduce.js',
      require: './chains/combine_documents/reduce.cjs'
    },
    './chains/history_aware_retriever': {
      types: {
        import: './chains/history_aware_retriever.d.ts',
        require: './chains/history_aware_retriever.d.cts',
        default: './chains/history_aware_retriever.d.ts'
      },
      import: './chains/history_aware_retriever.js',
      require: './chains/history_aware_retriever.cjs'
    },
    './chains/load': {
      types: {
        import: './chains/load.d.ts',
        require: './chains/load.d.cts',
        default: './chains/load.d.ts'
      },
      import: './chains/load.js',
      require: './chains/load.cjs'
    },
    './chains/openai_functions': {
      types: {
        import: './chains/openai_functions.d.ts',
        require: './chains/openai_functions.d.cts',
        default: './chains/openai_functions.d.ts'
      },
      import: './chains/openai_functions.js',
      require: './chains/openai_functions.cjs'
    },
    './chains/query_constructor': {
      types: {
        import: './chains/query_constructor.d.ts',
        require: './chains/query_constructor.d.cts',
        default: './chains/query_constructor.d.ts'
      },
      import: './chains/query_constructor.js',
      require: './chains/query_constructor.cjs'
    },
    './chains/query_constructor/ir': {
      types: {
        import: './chains/query_constructor/ir.d.ts',
        require: './chains/query_constructor/ir.d.cts',
        default: './chains/query_constructor/ir.d.ts'
      },
      import: './chains/query_constructor/ir.js',
      require: './chains/query_constructor/ir.cjs'
    },
    './chains/retrieval': {
      types: {
        import: './chains/retrieval.d.ts',
        require: './chains/retrieval.d.cts',
        default: './chains/retrieval.d.ts'
      },
      import: './chains/retrieval.js',
      require: './chains/retrieval.cjs'
    },
    './chains/sql_db': {
      types: {
        import: './chains/sql_db.d.ts',
        require: './chains/sql_db.d.cts',
        default: './chains/sql_db.d.ts'
      },
      import: './chains/sql_db.js',
      require: './chains/sql_db.cjs'
    },
    './chains/graph_qa/cypher': {
      types: {
        import: './chains/graph_qa/cypher.d.ts',
        require: './chains/graph_qa/cypher.d.cts',
        default: './chains/graph_qa/cypher.d.ts'
      },
      import: './chains/graph_qa/cypher.js',
      require: './chains/graph_qa/cypher.cjs'
    },
    './chat_models/universal': {
      types: {
        import: './chat_models/universal.d.ts',
        require: './chat_models/universal.d.cts',
        default: './chat_models/universal.d.ts'
      },
      import: './chat_models/universal.js',
      require: './chat_models/universal.cjs'
    },
    './embeddings/cache_backed': {
      types: {
        import: './embeddings/cache_backed.d.ts',
        require: './embeddings/cache_backed.d.cts',
        default: './embeddings/cache_backed.d.ts'
      },
      import: './embeddings/cache_backed.js',
      require: './embeddings/cache_backed.cjs'
    },
    './embeddings/fake': {
      types: {
        import: './embeddings/fake.d.ts',
        require: './embeddings/fake.d.cts',
        default: './embeddings/fake.d.ts'
      },
      import: './embeddings/fake.js',
      require: './embeddings/fake.cjs'
    },
    './vectorstores/memory': {
      types: {
        import: './vectorstores/memory.d.ts',
        require: './vectorstores/memory.d.cts',
        default: './vectorstores/memory.d.ts'
      },
      import: './vectorstores/memory.js',
      require: './vectorstores/memory.cjs'
    },
    './text_splitter': {
      types: {
        import: './text_splitter.d.ts',
        require: './text_splitter.d.cts',
        default: './text_splitter.d.ts'
      },
      import: './text_splitter.js',
      require: './text_splitter.cjs'
    },
    './memory': {
      types: {
        import: './memory.d.ts',
        require: './memory.d.cts',
        default: './memory.d.ts'
      },
      import: './memory.js',
      require: './memory.cjs'
    },
    './memory/chat_memory': {
      types: {
        import: './memory/chat_memory.d.ts',
        require: './memory/chat_memory.d.cts',
        default: './memory/chat_memory.d.ts'
      },
      import: './memory/chat_memory.js',
      require: './memory/chat_memory.cjs'
    },
    './document': {
      types: {
        import: './document.d.ts',
        require: './document.d.cts',
        default: './document.d.ts'
      },
      import: './document.js',
      require: './document.cjs'
    },
    './document_loaders/base': {
      types: {
        import: './document_loaders/base.d.ts',
        require: './document_loaders/base.d.cts',
        default: './document_loaders/base.d.ts'
      },
      import: './document_loaders/base.js',
      require: './document_loaders/base.cjs'
    },
    './document_loaders/fs/buffer': {
      types: {
        import: './document_loaders/fs/buffer.d.ts',
        require: './document_loaders/fs/buffer.d.cts',
        default: './document_loaders/fs/buffer.d.ts'
      },
      import: './document_loaders/fs/buffer.js',
      require: './document_loaders/fs/buffer.cjs'
    },
    './document_loaders/fs/directory': {
      types: {
        import: './document_loaders/fs/directory.d.ts',
        require: './document_loaders/fs/directory.d.cts',
        default: './document_loaders/fs/directory.d.ts'
      },
      import: './document_loaders/fs/directory.js',
      require: './document_loaders/fs/directory.cjs'
    },
    './document_loaders/fs/json': {
      types: {
        import: './document_loaders/fs/json.d.ts',
        require: './document_loaders/fs/json.d.cts',
        default: './document_loaders/fs/json.d.ts'
      },
      import: './document_loaders/fs/json.js',
      require: './document_loaders/fs/json.cjs'
    },
    './document_loaders/fs/multi_file': {
      types: {
        import: './document_loaders/fs/multi_file.d.ts',
        require: './document_loaders/fs/multi_file.d.cts',
        default: './document_loaders/fs/multi_file.d.ts'
      },
      import: './document_loaders/fs/multi_file.js',
      require: './document_loaders/fs/multi_file.cjs'
    },
    './document_loaders/fs/text': {
      types: {
        import: './document_loaders/fs/text.d.ts',
        require: './document_loaders/fs/text.d.cts',
        default: './document_loaders/fs/text.d.ts'
      },
      import: './document_loaders/fs/text.js',
      require: './document_loaders/fs/text.cjs'
    },
    './document_transformers/openai_functions': {
      types: {
        import: './document_transformers/openai_functions.d.ts',
        require: './document_transformers/openai_functions.d.cts',
        default: './document_transformers/openai_functions.d.ts'
      },
      import: './document_transformers/openai_functions.js',
      require: './document_transformers/openai_functions.cjs'
    },
    './sql_db': {
      types: {
        import: './sql_db.d.ts',
        require: './sql_db.d.cts',
        default: './sql_db.d.ts'
      },
      import: './sql_db.js',
      require: './sql_db.cjs'
    },
    './callbacks': {
      types: {
        import: './callbacks.d.ts',
        require: './callbacks.d.cts',
        default: './callbacks.d.ts'
      },
      import: './callbacks.js',
      require: './callbacks.cjs'
    },
    './output_parsers': {
      types: {
        import: './output_parsers.d.ts',
        require: './output_parsers.d.cts',
        default: './output_parsers.d.ts'
      },
      import: './output_parsers.js',
      require: './output_parsers.cjs'
    },
    './output_parsers/expression': {
      types: {
        import: './output_parsers/expression.d.ts',
        require: './output_parsers/expression.d.cts',
        default: './output_parsers/expression.d.ts'
      },
      import: './output_parsers/expression.js',
      require: './output_parsers/expression.cjs'
    },
    './retrievers/contextual_compression': {
      types: {
        import: './retrievers/contextual_compression.d.ts',
        require: './retrievers/contextual_compression.d.cts',
        default: './retrievers/contextual_compression.d.ts'
      },
      import: './retrievers/contextual_compression.js',
      require: './retrievers/contextual_compression.cjs'
    },
    './retrievers/document_compressors': {
      types: {
        import: './retrievers/document_compressors.d.ts',
        require: './retrievers/document_compressors.d.cts',
        default: './retrievers/document_compressors.d.ts'
      },
      import: './retrievers/document_compressors.js',
      require: './retrievers/document_compressors.cjs'
    },
    './retrievers/ensemble': {
      types: {
        import: './retrievers/ensemble.d.ts',
        require: './retrievers/ensemble.d.cts',
        default: './retrievers/ensemble.d.ts'
      },
      import: './retrievers/ensemble.js',
      require: './retrievers/ensemble.cjs'
    },
    './retrievers/multi_query': {
      types: {
        import: './retrievers/multi_query.d.ts',
        require: './retrievers/multi_query.d.cts',
        default: './retrievers/multi_query.d.ts'
      },
      import: './retrievers/multi_query.js',
      require: './retrievers/multi_query.cjs'
    },
    './retrievers/multi_vector': {
      types: {
        import: './retrievers/multi_vector.d.ts',
        require: './retrievers/multi_vector.d.cts',
        default: './retrievers/multi_vector.d.ts'
      },
      import: './retrievers/multi_vector.js',
      require: './retrievers/multi_vector.cjs'
    },
    './retrievers/parent_document': {
      types: {
        import: './retrievers/parent_document.d.ts',
        require: './retrievers/parent_document.d.cts',
        default: './retrievers/parent_document.d.ts'
      },
      import: './retrievers/parent_document.js',
      require: './retrievers/parent_document.cjs'
    },
    './retrievers/time_weighted': {
      types: {
        import: './retrievers/time_weighted.d.ts',
        require: './retrievers/time_weighted.d.cts',
        default: './retrievers/time_weighted.d.ts'
      },
      import: './retrievers/time_weighted.js',
      require: './retrievers/time_weighted.cjs'
    },
    './retrievers/document_compressors/chain_extract': {
      types: {
        import: './retrievers/document_compressors/chain_extract.d.ts',
        require: './retrievers/document_compressors/chain_extract.d.cts',
        default: './retrievers/document_compressors/chain_extract.d.ts'
      },
      import: './retrievers/document_compressors/chain_extract.js',
      require: './retrievers/document_compressors/chain_extract.cjs'
    },
    './retrievers/document_compressors/embeddings_filter': {
      types: {
        import: './retrievers/document_compressors/embeddings_filter.d.ts',
        require: './retrievers/document_compressors/embeddings_filter.d.cts',
        default: './retrievers/document_compressors/embeddings_filter.d.ts'
      },
      import: './retrievers/document_compressors/embeddings_filter.js',
      require: './retrievers/document_compressors/embeddings_filter.cjs'
    },
    './retrievers/hyde': {
      types: {
        import: './retrievers/hyde.d.ts',
        require: './retrievers/hyde.d.cts',
        default: './retrievers/hyde.d.ts'
      },
      import: './retrievers/hyde.js',
      require: './retrievers/hyde.cjs'
    },
    './retrievers/score_threshold': {
      types: {
        import: './retrievers/score_threshold.d.ts',
        require: './retrievers/score_threshold.d.cts',
        default: './retrievers/score_threshold.d.ts'
      },
      import: './retrievers/score_threshold.js',
      require: './retrievers/score_threshold.cjs'
    },
    './retrievers/self_query': {
      types: {
        import: './retrievers/self_query.d.ts',
        require: './retrievers/self_query.d.cts',
        default: './retrievers/self_query.d.ts'
      },
      import: './retrievers/self_query.js',
      require: './retrievers/self_query.cjs'
    },
    './retrievers/self_query/functional': {
      types: {
        import: './retrievers/self_query/functional.d.ts',
        require: './retrievers/self_query/functional.d.cts',
        default: './retrievers/self_query/functional.d.ts'
      },
      import: './retrievers/self_query/functional.js',
      require: './retrievers/self_query/functional.cjs'
    },
    './retrievers/matryoshka_retriever': {
      types: {
        import: './retrievers/matryoshka_retriever.d.ts',
        require: './retrievers/matryoshka_retriever.d.cts',
        default: './retrievers/matryoshka_retriever.d.ts'
      },
      import: './retrievers/matryoshka_retriever.js',
      require: './retrievers/matryoshka_retriever.cjs'
    },
    './cache/file_system': {
      types: {
        import: './cache/file_system.d.ts',
        require: './cache/file_system.d.cts',
        default: './cache/file_system.d.ts'
      },
      import: './cache/file_system.js',
      require: './cache/file_system.cjs'
    },
    './stores/doc/base': {
      types: {
        import: './stores/doc/base.d.ts',
        require: './stores/doc/base.d.cts',
        default: './stores/doc/base.d.ts'
      },
      import: './stores/doc/base.js',
      require: './stores/doc/base.cjs'
    },
    './stores/doc/in_memory': {
      types: {
        import: './stores/doc/in_memory.d.ts',
        require: './stores/doc/in_memory.d.cts',
        default: './stores/doc/in_memory.d.ts'
      },
      import: './stores/doc/in_memory.js',
      require: './stores/doc/in_memory.cjs'
    },
    './stores/file/in_memory': {
      types: {
        import: './stores/file/in_memory.d.ts',
        require: './stores/file/in_memory.d.cts',
        default: './stores/file/in_memory.d.ts'
      },
      import: './stores/file/in_memory.js',
      require: './stores/file/in_memory.cjs'
    },
    './stores/file/node': {
      types: {
        import: './stores/file/node.d.ts',
        require: './stores/file/node.d.cts',
        default: './stores/file/node.d.ts'
      },
      import: './stores/file/node.js',
      require: './stores/file/node.cjs'
    },
    './stores/message/in_memory': {
      types: {
        import: './stores/message/in_memory.d.ts',
        require: './stores/message/in_memory.d.cts',
        default: './stores/message/in_memory.d.ts'
      },
      import: './stores/message/in_memory.js',
      require: './stores/message/in_memory.cjs'
    },
    './storage/encoder_backed': {
      types: {
        import: './storage/encoder_backed.d.ts',
        require: './storage/encoder_backed.d.cts',
        default: './storage/encoder_backed.d.ts'
      },
      import: './storage/encoder_backed.js',
      require: './storage/encoder_backed.cjs'
    },
    './storage/in_memory': {
      types: {
        import: './storage/in_memory.d.ts',
        require: './storage/in_memory.d.cts',
        default: './storage/in_memory.d.ts'
      },
      import: './storage/in_memory.js',
      require: './storage/in_memory.cjs'
    },
    './storage/file_system': {
      types: {
        import: './storage/file_system.d.ts',
        require: './storage/file_system.d.cts',
        default: './storage/file_system.d.ts'
      },
      import: './storage/file_system.js',
      require: './storage/file_system.cjs'
    },
    './hub': {
      types: {
        import: './hub.d.ts',
        require: './hub.d.cts',
        default: './hub.d.ts'
      },
      import: './hub.js',
      require: './hub.cjs'
    },
    './util/document': {
      types: {
        import: './util/document.d.ts',
        require: './util/document.d.cts',
        default: './util/document.d.ts'
      },
      import: './util/document.js',
      require: './util/document.cjs'
    },
    './util/math': {
      types: {
        import: './util/math.d.ts',
        require: './util/math.d.cts',
        default: './util/math.d.ts'
      },
      import: './util/math.js',
      require: './util/math.cjs'
    },
    './util/time': {
      types: {
        import: './util/time.d.ts',
        require: './util/time.d.cts',
        default: './util/time.d.ts'
      },
      import: './util/time.js',
      require: './util/time.cjs'
    },
    './experimental/autogpt': {
      types: {
        import: './experimental/autogpt.d.ts',
        require: './experimental/autogpt.d.cts',
        default: './experimental/autogpt.d.ts'
      },
      import: './experimental/autogpt.js',
      require: './experimental/autogpt.cjs'
    },
    './experimental/openai_assistant': {
      types: {
        import: './experimental/openai_assistant.d.ts',
        require: './experimental/openai_assistant.d.cts',
        default: './experimental/openai_assistant.d.ts'
      },
      import: './experimental/openai_assistant.js',
      require: './experimental/openai_assistant.cjs'
    },
    './experimental/openai_files': {
      types: {
        import: './experimental/openai_files.d.ts',
        require: './experimental/openai_files.d.cts',
        default: './experimental/openai_files.d.ts'
      },
      import: './experimental/openai_files.js',
      require: './experimental/openai_files.cjs'
    },
    './experimental/babyagi': {
      types: {
        import: './experimental/babyagi.d.ts',
        require: './experimental/babyagi.d.cts',
        default: './experimental/babyagi.d.ts'
      },
      import: './experimental/babyagi.js',
      require: './experimental/babyagi.cjs'
    },
    './experimental/generative_agents': {
      types: {
        import: './experimental/generative_agents.d.ts',
        require: './experimental/generative_agents.d.cts',
        default: './experimental/generative_agents.d.ts'
      },
      import: './experimental/generative_agents.js',
      require: './experimental/generative_agents.cjs'
    },
    './experimental/plan_and_execute': {
      types: {
        import: './experimental/plan_and_execute.d.ts',
        require: './experimental/plan_and_execute.d.cts',
        default: './experimental/plan_and_execute.d.ts'
      },
      import: './experimental/plan_and_execute.js',
      require: './experimental/plan_and_execute.cjs'
    },
    './experimental/chains/violation_of_expectations': {
      types: {
        import: './experimental/chains/violation_of_expectations.d.ts',
        require: './experimental/chains/violation_of_expectations.d.cts',
        default: './experimental/chains/violation_of_expectations.d.ts'
      },
      import: './experimental/chains/violation_of_expectations.js',
      require: './experimental/chains/violation_of_expectations.cjs'
    },
    './experimental/masking': {
      types: {
        import: './experimental/masking.d.ts',
        require: './experimental/masking.d.cts',
        default: './experimental/masking.d.ts'
      },
      import: './experimental/masking.js',
      require: './experimental/masking.cjs'
    },
    './experimental/prompts/custom_format': {
      types: {
        import: './experimental/prompts/custom_format.d.ts',
        require: './experimental/prompts/custom_format.d.cts',
        default: './experimental/prompts/custom_format.d.ts'
      },
      import: './experimental/prompts/custom_format.js',
      require: './experimental/prompts/custom_format.cjs'
    },
    './experimental/prompts/handlebars': {
      types: {
        import: './experimental/prompts/handlebars.d.ts',
        require: './experimental/prompts/handlebars.d.cts',
        default: './experimental/prompts/handlebars.d.ts'
      },
      import: './experimental/prompts/handlebars.js',
      require: './experimental/prompts/handlebars.cjs'
    },
    './evaluation': {
      types: {
        import: './evaluation.d.ts',
        require: './evaluation.d.cts',
        default: './evaluation.d.ts'
      },
      import: './evaluation.js',
      require: './evaluation.cjs'
    },
    './smith': {
      types: {
        import: './smith.d.ts',
        require: './smith.d.cts',
        default: './smith.d.ts'
      },
      import: './smith.js',
      require: './smith.cjs'
    },
    './runnables/remote': {
      types: {
        import: './runnables/remote.d.ts',
        require: './runnables/remote.d.cts',
        default: './runnables/remote.d.ts'
      },
      import: './runnables/remote.js',
      require: './runnables/remote.cjs'
    },
    './indexes': {
      types: {
        import: './indexes.d.ts',
        require: './indexes.d.cts',
        default: './indexes.d.ts'
      },
      import: './indexes.js',
      require: './indexes.cjs'
    },
    './schema/query_constructor': {
      types: {
        import: './schema/query_constructor.d.ts',
        require: './schema/query_constructor.d.cts',
        default: './schema/query_constructor.d.ts'
      },
      import: './schema/query_constructor.js',
      require: './schema/query_constructor.cjs'
    },
    './schema/prompt_template': {
      types: {
        import: './schema/prompt_template.d.ts',
        require: './schema/prompt_template.d.cts',
        default: './schema/prompt_template.d.ts'
      },
      import: './schema/prompt_template.js',
      require: './schema/prompt_template.cjs'
    },
    './package.json': './package.json'
  },
  gitHead: 'b5b19204cb54fe2c98d2e425630d22805c4724e9',
  dist: {
    integrity: 'sha512-Gq0xC45Sq6nszS8kQG9suCrmBsuXH0INMmiF7D2TwPb6mtG35Jiq4grCk9ykpwPsarTHdty3SzUbII/FqiYSSw==',
    shasum: '87b282454bc215b12b920d4dd5e35ed58030bad1',
    tarball: 'https://registry.npmjs.org/langchain/-/langchain-0.3.5.tgz',
    fileCount: 1342,
    unpackedSize: 4738742,
    signatures: [
      {
        keyid: 'SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA',
        sig: 'MEUCIQCdCHCs4IVRLn/HSV09sDQ2XMQG+VgdWhWdeJcTwktIdQIgan9fGVGyjbsUUQCiqTeTD3AYZq65Q2iAgn0lO+9uGzA='
      }
    ]
  },
  directories: {}
}

Platform: macOS Node: v20.15.0 Yarn: 1.22.22

dosubot[bot] commented 5 days ago

Hey @drewmacneil! I'm here to help you with any bugs, questions, or contributions. Let's tackle this together!

The issue you're encountering seems to be related to how the LangSmith logging system is classifying the logger chain as a sibling node rather than an independent root when executed within a callback. This behavior might be due to the way AsyncLocalStorage is managing the execution context and not clearing it properly when callbacks are invoked.

In LangChain.js, AsyncLocalStorage is used to manage context variables that are scoped to the execution context of runnables. This allows for context isolation and inheritance, which is useful in asynchronous environments [1]. However, if the context is not cleared or reset when entering a new execution context, such as a callback, it might lead to unexpected behavior in how nodes are logged or classified.

To address this, you might need to ensure that the context is explicitly cleared or reset when entering the callback execution. This can be done by managing the AsyncLocalStorage context manually or by ensuring that the callback execution is treated as a new root context. This would help in correctly classifying the logger chain as an independent root in the logging system.

If this approach does not resolve the issue, further investigation into how the LangSmith system determines the hierarchy of nodes and chains might be necessary, as this information is not fully detailed in the available context.

To continue talking to Dosu, mention @dosu.