@promptbook/vercel
Version:
Promptbook: Turn your company's scattered knowledge into AI ready books
63 lines (62 loc) • 2.69 kB
TypeScript
import type { ExecutionTools } from '../../../execution/ExecutionTools';
import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions';
import type { string_dirname, string_pipeline_root_url } from '../../../types/typeAliases';
import type { PipelineCollection } from '../PipelineCollection';
/**
* Options for `createPipelineCollectionFromDirectory` function
*
* Note: `rootDirname` is not needed because it is the folder in which `.book` or `.book` file is located
* This is not same as `path` which is the first argument of `createPipelineCollectionFromDirectory` - 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;
/**
* This will be used as a root URL for all pipelines in the collection
*
* It has 2 purposes:
* 1) Every pipeline in the collection is checked if it is a child of `rootUrl`
* 2) If the pipeline does not have a URL, it is created from the `rootUrl` and path to the pipeline
*/
rootUrl?: string_pipeline_root_url;
/**
* 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 `PipelineCollection` from given directory
*
* Note: Works only in Node.js environment because it reads the file system
*
* @param rootPath - 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 createPipelineCollectionFromDirectory(rootPath: 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`
*/