UNPKG

@promptbook/remote-server

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

67 lines (66 loc) 2.81 kB
import type { ExecutionTools } from '../../../execution/ExecutionTools'; import type { PrepareAndScrapeOptions } from '../../../prepare/PrepareAndScrapeOptions'; import type { string_dirname } from '../../../types/string_filename'; import type { string_pipeline_root_url } from '../../../types/string_pipeline_root_url'; 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; }; /** * Tools used by `createPipelineCollectionFromDirectory`. * * @private internal function of `createPipelineCollectionFromDirectory` */ type CreatePipelineCollectionFromDirectoryTools = Pick<ExecutionTools, 'llm' | 'fs' | 'scrapers'>; /** * 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?: CreatePipelineCollectionFromDirectoryTools, options?: CreatePipelineCollectionFromDirectoryOptions): Promise<PipelineCollection>; export {};