import type { DynamicModule, ForwardReference, ModuleMetadata, Provider, Type, } from '@nestjs/common'; export interface RunnableConfigLike { tags?: string[]; metadata?: Record; configurable?: Record; [key: string]: unknown; } export interface RunnableStreamOptionsLike { [key: string]: unknown; } export type RunnableEdge = readonly [from: string, to: string]; export type RunnableKind = | 'runnable' | 'graph' | 'chain' | 'tool' | 'model' | 'retriever'; export interface LangChainModuleOptions { global?: boolean; defaultConfig?: RunnableConfigLike; } export interface LangChainModuleAsyncOptions extends Pick< ModuleMetadata, 'imports' > { global?: boolean; inject?: Array>; useFactory: ( ...args: unknown[] ) => Promise | LangChainModuleOptions; extraProviders?: Provider[]; } export interface RunnableLike { invoke( input: TInput, config?: RunnableConfigLike, ): Promise | TOutput; stream?( input: TInput, config?: RunnableConfigLike, ): AsyncIterable | Promise>; streamEvents?( input: TInput, config?: RunnableConfigLike, options?: RunnableStreamOptionsLike, ): AsyncIterable | Promise>; } export interface RegisteredRunnable { name: string; kind: RunnableKind; runnable: RunnableLike; nodes: readonly string[]; edges: readonly RunnableEdge[]; tags: readonly string[]; metadata: Record; } export type RegisteredGraph = RegisteredRunnable; export type NestImport = | Type | DynamicModule | Promise | ForwardReference;