Browserbase Haystack Fetcher
Project description
Browserbase Haystack Fetcher
Browserbase is a serverless platform for running headless browsers, it offers advanced debugging, session recordings, stealth mode, integrated proxies and captcha solving.
Installation and setup
- Get an API key from browserbase.com and set it in environment variables (
BROWSERBASE_API_KEY
). - Install the required dependencies:
pip install browserbase-haystack
Usage
You can load webpages into Haystack using BrowserbaseFetcher
. Optionally, you can set text_content
parameter to convert the pages to text-only representation.
Standalone
from browserbase_haystack import BrowserbaseFetcher
browserbase_fetcher = BrowserbaseFetcher()
browserbase_fetcher.run(urls=["https://example.com"], text_content=False)
In a pipeline
from browserbase_haystack import BrowserbaseFetcher
from haystack import Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder
prompt_template = (
"Tell me the titles of the given pages. Pages: {{ documents }}"
)
prompt_builder = PromptBuilder(template=prompt_template)
llm = OpenAIGenerator()
pipe = Pipeline()
pipe.add_component("fetcher", self.browserbase_fetcher)
pipe.add_component("prompt_builder", prompt_builder)
pipe.add_component("llm", llm)
pipe.connect("fetcher.documents", "prompt_builder.documents")
pipe.connect("prompt_builder.prompt", "llm.prompt")
result = pipe.run(data={"fetcher": {"urls": ["https://example.com"]}})
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for browserbase_haystack-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ebc7264cb6fd2945db7cd6241fbe508c603f465c63de4a0e9a04abb62f3e586 |
|
MD5 | 78326f04dd695f92d72a77d96f2d6c7b |
|
BLAKE2b-256 | f3745447b306bcbe2b4a9f63121d1517886be9a29fb02d9a4f2ad0dfb0176967 |
Close
Hashes for browserbase_haystack-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 789ce5271410ac0592830363cdac1ba623315882e2301c7dc973a46cf24265c7 |
|
MD5 | 9808ff6cd6b59d86c1b632635800c38c |
|
BLAKE2b-256 | 9a7c2f7664bed1b3da6d53af89cf009417b148476c902a34b6a5e2d19a26c825 |