feat(docloaders): Enhance browser_base_fetch function flexibility

- Update browser_base_fetch to accept single URL or list of URLs
- Add text_content parameter for choosing between text-only and HTML output
- Improve type hinting and function documentation
- Ensure compatibility with latest Browserbase SDK interface
This commit is contained in:
Tuhin Mallick 2024-09-08 01:41:39 +02:00 committed by GitHub
parent a5401394cc
commit 57fd01f9a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,7 @@ browserbase integration module
"""
from typing import List
def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[str]:
def browser_base_fetch(api_key: str, project_id: str, link: List[str], text_content: bool = True) -> List[str]:
"""
BrowserBase Fetch
@ -50,6 +50,6 @@ def browser_base_fetch(api_key: str, project_id: str, link: List[str]) -> List[s
result = []
for l in link:
result.append(browserbase.load(l, text_content=True))
result.append(browserbase.load(l, text_content=text_content))
return result