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
8 changes: 4 additions & 4 deletions python/agents/personalized-shopping/deployment/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import vertexai
from vertexai.preview.reasoning_engines import AdkApp
from vertexai import agent_engines
from dotenv import load_dotenv
import os

import vertexai
from dotenv import load_dotenv
from personalized_shopping.agent import root_agent
from vertexai import agent_engines
from vertexai.preview.reasoning_engines import AdkApp

load_dotenv()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
os.environ["GOOGLE_CLOUD_LOCATION"] = "global"
os.environ.setdefault("GOOGLE_GENAI_USE_VERTEXAI", "True")

import torch
import torch # noqa: E402

# Workaround to Resolve the PyTorch-Streamlit Incompatibility Issue
torch.classes.__path__ = []

# Initialize webshop environment (requires Java)
# If Java is not available (e.g., in CI), set webshop_env to None
try:
from .shared_libraries.init_env import init_env, webshop_env
from .shared_libraries.init_env import init_env, webshop_env # noqa: E402
except Exception:
webshop_env = None
init_env = None

from . import agent
from . import agent # noqa: F401, E402
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
from google.adk.agents import Agent
from google.adk.tools import FunctionTool

from .tools.search import search
from .tools.click import click

from .prompt import personalized_shopping_agent_instruction
from .tools.click import click
from .tools.search import search

root_agent = Agent(
model="gemini-2.5-flash",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

import json
import sys

from tqdm import tqdm

sys.path.insert(0, "../")

from web_agent_site.engine.engine import load_products
from web_agent_site.engine.engine import load_products # noqa: E402

all_products, *_ = load_products(filepath="../data/items_shuffle.json")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .envs.web_agent_text_env import WebAgentTextEnv
from .envs.web_agent_text_env import WebAgentTextEnv # noqa: F401
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this import be moved to the file where WebAgentTextEnv is actually used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Out of scope for the purpose of this PR though.

Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

""" """

from ast import literal_eval
from collections import defaultdict
from decimal import Decimal
import json
import os
import random
import re
from ast import literal_eval
from collections import defaultdict
from decimal import Decimal

from flask import render_template_string
from pyserini.search.lucene import LuceneSearcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

"""Functions for specifying goals and reward calculations."""

from collections import defaultdict
import itertools
import random
from rich import print
from collections import defaultdict

import spacy
from rich import print
from thefuzz import fuzz

from .normalize import normalize_color

nlp = spacy.load("en_core_web_sm")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from collections import defaultdict
import json
import random
import string
import time
from collections import defaultdict

import gym
import numpy as np
import torch
from bs4 import BeautifulSoup
from bs4.element import Comment
from flask import Flask
import gym
from gym.envs.registration import register
import numpy as np
import torch

from ..engine.engine import (
ACTION_TO_TEMPLATE,
BACK_TO_SEARCH,
Expand All @@ -45,7 +47,6 @@
random_idx,
)


app = Flask(__name__)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import bisect
import hashlib
import logging
from os.path import abspath, dirname, join
import random
from os.path import abspath, dirname, join

BASE_DIR = dirname(abspath(__file__))
DEBUG_PROD_SIZE = None # set to `None` to disable
Expand Down