@langchain/langgraph
Version:
49 lines (48 loc) • 2.58 kB
text/typescript
import { LangGraphRunnableConfig } from "../runnable_types.cjs";
import { BaseStore } from "@langchain/langgraph-checkpoint";
import { RunnableConfig } from "@langchain/core/runnables";
//#region src/pregel/utils/config.d.ts
/**
* A helper utility function that returns the {@link BaseStore} that was set when the graph was initialized
*
* @returns a reference to the {@link BaseStore} that was set when the graph was initialized
*/
declare function getStore(config?: LangGraphRunnableConfig): BaseStore | undefined;
/**
* A helper utility function that returns the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined.
*
* @returns a reference to the {@link LangGraphRunnableConfig#writer} if "custom" stream mode is enabled, otherwise undefined
*/
declare function getWriter(config?: LangGraphRunnableConfig): ((chunk: unknown) => void) | undefined;
/**
* A helper utility function that returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized.
*
* Note: This only works when running in an environment that supports node:async_hooks and AsyncLocalStorage. If you're running this in a
* web environment, access the LangGraphRunnableConfig from the node function directly.
*
* @returns the {@link LangGraphRunnableConfig} that was set when the graph was initialized
*/
declare function getConfig(): LangGraphRunnableConfig;
/**
* A helper utility function that returns the input for the currently executing
* task.
*
* Note: When called without arguments, this relies on `node:async_hooks` /
* `AsyncLocalStorage`, which is available in many JavaScript environments
* (Node.js, Deno, Cloudflare Workers) but not in web browsers. In environments
* without `AsyncLocalStorage` support, pass the `config` that your node/tool
* function receives directly, e.g. `getCurrentTaskInput(config)`.
*
* Tip: Inside a tool run by a `ToolNode`, prefer reading graph state from
* `runtime.state` on the second tool argument (typed as `ToolRuntime` from
* `@langchain/core/tools`). It works in every runtime, including web browsers.
*
* @param config - Optional {@link LangGraphRunnableConfig} to read the task
* input from. Provide this when running in an environment without
* `AsyncLocalStorage` support (e.g. web browsers).
* @returns the input for the currently executing task
*/
declare function getCurrentTaskInput<T = unknown>(config?: LangGraphRunnableConfig): T;
//#endregion
export { getConfig, getCurrentTaskInput, getStore, getWriter };
//# sourceMappingURL=config.d.cts.map