feat: get llm ready text

This commit is contained in:
amhsirak
2025-11-17 19:51:34 +05:30
parent 0c9dc899c3
commit 560f5a3300

View File

@@ -0,0 +1,29 @@
import { getPageSource, GetPageSourceOptions } from './get_html';
import { getProcessedText, ProcessTextOptions } from './get_llm_input_text';
export interface UrlToLlmTextOptions extends GetPageSourceOptions, ProcessTextOptions {
// Combined options from both interfaces
}
export async function urlToLlmText(
url: string,
options: UrlToLlmTextOptions = {}
): Promise<string> {
try {
const pageSource = await getPageSource(url, options);
if (!pageSource) {
return '';
}
const llmText = await getProcessedText(pageSource, url, options);
return llmText;
} catch (error) {
console.error('Error while scraping url: ', error);
return '';
}
}
// Export individual functions as well
export { getPageSource, getProcessedText };