UNPKG

@promptbook/langtail

Version:

It's time for a paradigm shift. The future of software in plain English, French or Latin

55 lines (54 loc) 2.25 kB
import type { ExecutionTools } from '../../execution/ExecutionTools'; import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions'; import type { string_dirname } from '../../types/typeAliases'; import type { PipelineCollection } from '../PipelineCollection'; /** * Options for `createCollectionFromDirectory` function * * Note: `rootDirname` is not needed because it is the folder in which `.book.md` file is located * This is not same as `path` which is the first argument of `createCollectionFromDirectory` - it can be a subfolder */ type CreatePipelineCollectionFromDirectoryOptions = Omit<PrepareAndScrapeOptions, 'rootDirname'> & { /** * If true, the directory is searched recursively for pipelines * * @default true */ isRecursive?: boolean; /** * If true, the collection creation outputs information about each file it reads * * @default false */ isVerbose?: boolean; /** * If true, directory will be scanned only when needed not during the construction * * @default false */ isLazyLoaded?: boolean; /** * If true, whole collection creation crashes on error in any pipeline * If true and isLazyLoaded is true, the error is thrown on first access to the pipeline * * @default true */ isCrashedOnError?: boolean; }; /** * Constructs Pipeline from given directory * * Note: Works only in Node.js environment because it reads the file system * * @param path - path to the directory with pipelines * @param tools - Execution tools to be used for pipeline preparation if needed - If not provided, `$provideExecutionToolsForNode` will be used * @param options - Options for the collection creation * @returns PipelineCollection * @public exported from `@promptbook/node` */ export declare function createCollectionFromDirectory(path: string_dirname, tools?: Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>; export {}; /** * TODO: [🖇] What about symlinks? Maybe option isSymlinksFollowed * TODO: Maybe move from `@promptbook/node` to `@promptbook/core` as we removes direct dependency on `fs` */