mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
updated browserbase integration
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
- Get an API key from [browserbase.com](https://browserbase.com) and set it in environment variables (`BROWSERBASE_KEY`).
|
- Get an API key from [browserbase.com](https://browserbase.com) and set it in environment variables (`BROWSERBASE_API_KEY`).
|
||||||
- Install the [Browserbase SDK](http://github.com/browserbase/python-sdk) along with `crewai[tools]` package:
|
- Install the [Browserbase SDK](http://github.com/browserbase/python-sdk) along with `crewai[tools]` package:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -25,5 +25,5 @@ tool = BrowserbaseLoadTool()
|
|||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
- `api_key`: Optional. Specifies Browserbase API key. Defaults is the `BROWSERBASE_KEY` environment variable.
|
- `api_key`: Optional. Specifies Browserbase API key. Defaults is the `BROWSERBASE_API_KEY` environment variable.
|
||||||
- `text_content`: Optional. Load pages as readable text. Default is `False`.
|
- `text_content`: Optional. Load pages as readable text. Default is `False`.
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
from crewai_tools import BaseTool
|
from crewai_tools import BaseTool
|
||||||
from typing import Union
|
from typing import Union, Optional
|
||||||
|
|
||||||
class BrowserbaseLoadTool(BaseTool):
|
class BrowserbaseLoadTool(BaseTool):
|
||||||
name: str = "Browserbase web load tool"
|
name: str = "Browserbase web load tool"
|
||||||
description: str = "Load webpages in a headless browser using Browserbase and return the contents"
|
description: str = "Load webpages in a headless browser using Browserbase and return the contents"
|
||||||
|
|
||||||
def __init__(self, api_key: str = os.environ["BROWSERBASE_KEY"], text_content: bool = False):
|
def __init__(self, api_key: Optional[str] = None, text_content: bool = False):
|
||||||
try:
|
try:
|
||||||
from browserbase import Browserbase
|
from browserbase import Browserbase
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
Reference in New Issue
Block a user