UNPKG

x-crawl

Version:

x-crawl is a flexible Node.js AI-assisted crawler library.

57 lines (44 loc) 1.32 kB
/// <reference types="node" /> import { Config, Ollama } from 'ollama' export interface CreateCrawlOllamaConfig { model: string clientOptions?: Partial<Config> } export interface CrawlOllamaRunChatOption { context: string HTMLContent: string userContent: string responseFormatType: 'text' | 'json_object' } export interface CrawlOllamaParseElementsContentOptions { message: string } export interface CrawlOllamaGetElementSelectorsContentOptions { message: string pathMode: 'default' | 'strict' } export interface CrawlOllamaParseElementsResult< T extends Record<string, string> > { elements: T[] type: 'single' | 'multiple' | 'none' } export interface CrawlOllamaGetElementSelectorsResult { selectors: string type: 'single' | 'multiple' | 'none' } export interface CrawlOllamaApp { parseElements<T extends Record<string, string>>( HTML: string, content: string | CrawlOllamaParseElementsContentOptions ): Promise<CrawlOllamaParseElementsResult<T>> getElementSelectors( HTML: string, content: string | CrawlOllamaGetElementSelectorsContentOptions ): Promise<CrawlOllamaGetElementSelectorsResult> help(content: string): Promise<string> custom(): Ollama } export declare function createCrawlOllama( config: CreateCrawlOllamaConfig ): CrawlOllamaApp