UNPKG

@promptbook/remote-server

Version:

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

45 lines (44 loc) 1.99 kB
import type { KnowledgePiecePreparedJson } from '../../pipeline/PipelineJson/KnowledgePieceJson'; import type { string_markdown } from '../../types/string_markdown'; import type { Converter } from '../_common/Converter'; import type { Scraper, ScraperSourceHandler } from '../_common/Scraper'; import type { ExecutionTools } from '../../execution/ExecutionTools'; import type { PrepareAndScrapeOptions } from '../../prepare/PrepareAndScrapeOptions'; import type { ScraperAndConverterMetadata } from '../_common/register/ScraperAndConverterMetadata'; import type { ScraperIntermediateSource } from '../_common/ScraperIntermediateSource'; /** * Scraper for websites * * @see `documentationUrl` for more details * * @public exported from `@promptbook/website-crawler` */ export declare class WebsiteScraper implements Converter, Scraper { private readonly tools; private readonly options; /** * Metadata of the scraper which includes title, mime types, etc. */ get metadata(): ScraperAndConverterMetadata; /** * Markdown scraper is used internally */ private readonly markdownScraper; /** * Showdown converter is used internally */ private readonly showdownConverter; constructor(tools: Pick<ExecutionTools, 'fs' | 'llm'>, options: PrepareAndScrapeOptions); /** * Convert the website to `.md` file and returns intermediate source * * Note: `$` is used to indicate that this function is not a pure function - it leaves files on the disk and you are responsible for cleaning them by calling `destroy` method of returned object */ $convert(source: ScraperSourceHandler): Promise<ScraperIntermediateSource & { markdown: string_markdown; }>; /** * Scrapes the website and returns the knowledge pieces or `null` if it can't scrape it */ scrape(source: ScraperSourceHandler): Promise<ReadonlyArray<Omit<KnowledgePiecePreparedJson, 'sources' | 'preparationIds'>> | null>; }