Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ Replace `YOUR_GEMINI_API_KEY` with your actual key.
You need to explicitly use Vertex AI, then provide project and location to use the agent:

```bash
export USE_VERTEXAI=true
export VERTEXAI_PROJECT="YOUR_PROJECT_ID"
export VERTEXAI_LOCATION="YOUR_LOCATION"
export GOOGLE_GENAI_USE_VERTEXAI=true
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
export GOOGLE_CLOUD_LOCATION="YOUR_LOCATION"
```

Or to add this to your virtual environment:

```bash
echo 'export USE_VERTEXAI=true' >> .venv/bin/activate
echo 'export VERTEXAI_PROJECT="your-project-id"' >> .venv/bin/activate
echo 'export VERTEXAI_LOCATION="your-location"' >> .venv/bin/activate
echo 'export GOOGLE_GENAI_USE_VERTEXAI=true' >> .venv/bin/activate
echo 'export GOOGLE_CLOUD_PROJECT="your-project-id"' >> .venv/bin/activate
echo 'export GOOGLE_CLOUD_LOCATION="your-location"' >> .venv/bin/activate
# After editing, you'll need to deactivate and reactivate your virtual
# environment if it's already active:
deactivate
Expand Down Expand Up @@ -134,6 +134,9 @@ The `main.py` script is the command-line interface (CLI) for running the browser

| Variable | Description | Required |
|-|-|-|
| GEMINI_API_KEY | Your API key for the Gemini model. | Yes |
| BROWSERBASE_API_KEY | Your API key for Browserbase. | Yes (when using the browserbase environment) |
| BROWSERBASE_PROJECT_ID | Your Project ID for Browserbase. | Yes (when using the browserbase environment) |
| `GEMINI_API_KEY` | Your API key for the Gemini model. | Yes (if using Gemini Developer API) |
| `GOOGLE_CLOUD_PROJECT` | Your Google Cloud Project. | Yes (if using Vertex AI) |
| `GOOGLE_CLOUD_LOCATION` | Your Google Cloud Region. | Yes (if using Vertex AI) |
| `GOOGLE_GENAI_USE_VERTEXAI` | Set to `True` if using Vertex AI | Yes (if using Vertex AI) |
| `BROWSERBASE_API_KEY` | Your API key for Browserbase. | Yes (when using the browserbase environment) |
| `BROWSERBASE_PROJECT_ID` | Your Project ID for Browserbase. | Yes (when using the browserbase environment) |
7 changes: 4 additions & 3 deletions agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ def __init__(
self.final_reasoning = None
self._client = genai.Client(
api_key=os.environ.get("GEMINI_API_KEY"),
vertexai=os.environ.get("USE_VERTEXAI", "0").lower() in ["true", "1"],
project=os.environ.get("VERTEXAI_PROJECT"),
location=os.environ.get("VERTEXAI_LOCATION"),
vertexai=os.environ.get("GOOGLE_GENAI_USE_VERTEXAI", "0").lower()
in ["true", "1"],
project=os.environ.get("GOOGLE_CLOUD_PROJECT"),
location=os.environ.get("GOOGLE_CLOUD_LOCATION"),
)
self._contents: list[Content] = [
Content(
Expand Down