From fd20f8d694816b0fafbd93b45b3130ac94dbdc32 Mon Sep 17 00:00:00 2001 From: David Westgate Date: Thu, 25 Apr 2024 10:52:31 -0700 Subject: [PATCH] add google jobs --- hw2/app.py | 8 +++++--- hw2/tools.py | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hw2/app.py b/hw2/app.py index ed8139c..3d3198b 100644 --- a/hw2/app.py +++ b/hw2/app.py @@ -3,15 +3,17 @@ from langchain.agents import AgentExecutor, create_react_agent, load_tools from langchain.tools import tool from langchain_openai import ChatOpenAI from langchain_community.utilities.dalle_image_generator import DallEAPIWrapper +from langchain_community.tools.google_jobs import GoogleJobsQueryRun +from langchain_community.utilities.google_jobs import GoogleJobsAPIWrapper from dotenv import load_dotenv from tools import lookup_ip, lookup_name from langsmith import Client """ -This is the main runner of the custom agent. Agent tools are defined seperatly and imported from tools.py +This is the main runner of the custom agent. Custom agent tools are defined seperatly and imported from tools.py -So far, wholly adapted from https://github.com/wu4f/cs410g-src/blob/main/04_Agents/07_tools_custom_agent.py +Adapted from https://github.com/wu4f/cs410g-src/blob/main/04_Agents/07_tools_custom_agent.py """ @@ -22,7 +24,7 @@ load_dotenv() #client = Client() llm = ChatOpenAI(model_name="gpt-4-turbo", temperature=0) -tools = load_tools(["serpapi", "terminal", "dalle-image-generator"], allow_dangerous_tools=True) +tools = load_tools(["serpapi", "terminal", "dalle-image-generator", "google-jobs"], allow_dangerous_tools=True, llm=llm) tools.extend([lookup_name, lookup_ip]) base_prompt = hub.pull("langchain-ai/react-agent-template") diff --git a/hw2/tools.py b/hw2/tools.py index e4c710b..78507a7 100644 --- a/hw2/tools.py +++ b/hw2/tools.py @@ -2,7 +2,6 @@ from langchain_core.pydantic_v1 import BaseModel, Field, root_validator from langchain.tools import tool import dns.resolver, dns.reversename import validators -import validators """ Tools to be run by my custom agent.