@langchain/core
Advanced tools
Comparing version 0.3.10-rc.0 to 0.3.10
/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */ | ||
import { AsyncLocalStorage } from "node:async_hooks"; | ||
import { RunTree } from "langsmith"; | ||
import { isRunTree } from "langsmith/run_trees"; | ||
import { _CONTEXT_VARIABLES_KEY, AsyncLocalStorageProviderSingleton, } from "./singletons/index.js"; | ||
@@ -60,7 +62,9 @@ AsyncLocalStorageProviderSingleton.initializeGlobalInstance(new AsyncLocalStorage()); | ||
contextVars[name] = value; | ||
let newValue = {}; | ||
if (isRunTree(runTree)) { | ||
newValue = new RunTree(runTree); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
AsyncLocalStorageProviderSingleton.getInstance().enterWith({ | ||
...runTree, | ||
[_CONTEXT_VARIABLES_KEY]: contextVars, | ||
}); | ||
newValue[_CONTEXT_VARIABLES_KEY] = contextVars; | ||
AsyncLocalStorageProviderSingleton.getInstance().enterWith(newValue); | ||
} | ||
@@ -67,0 +71,0 @@ /** |
export interface AsyncLocalStorageInterface { | ||
getStore: () => any | undefined; | ||
run: <T>(store: any, callback: () => T) => T; | ||
enterWith: (store: any) => void; | ||
} | ||
@@ -8,2 +9,3 @@ export declare class MockAsyncLocalStorage implements AsyncLocalStorageInterface { | ||
run<T>(_store: any, callback: () => T): T; | ||
enterWith(_store: any): undefined; | ||
} | ||
@@ -10,0 +12,0 @@ export declare const _CONTEXT_VARIABLES_KEY: unique symbol; |
@@ -11,2 +11,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
} | ||
enterWith(_store) { | ||
return undefined; | ||
} | ||
} | ||
@@ -13,0 +16,0 @@ const mockAsyncLocalStorage = new MockAsyncLocalStorage(); |
{ | ||
"name": "@langchain/core", | ||
"version": "0.3.10-rc.0", | ||
"version": "0.3.10", | ||
"description": "Core LangChain.js abstractions and schemas", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"js-tiktoken": "^1.0.12", | ||
"langsmith": "^0.1.64", | ||
"langsmith": "^0.1.65", | ||
"mustache": "^4.2.0", | ||
@@ -43,0 +43,0 @@ "p-queue": "^6.6.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2214735
55481
Updatedlangsmith@^0.1.65