|
from langchain import hub |
|
from langchain.agents import AgentExecutor, create_openai_tools_agent, load_tools |
|
|
|
from langchain_openai import ChatOpenAI |
|
|
|
from dotenv import load_dotenv |
|
|
|
load_dotenv() |
|
|
|
model = ChatOpenAI(temperature=0, streaming=True) |
|
|
|
tools = load_tools(["serpapi"]) |
|
|
|
|
|
prompt = hub.pull("hwchase17/openai-tools-agent") |
|
|
|
agent = create_openai_tools_agent( |
|
model.with_config({"tags": ["agent_llm"]}), tools, prompt |
|
) |
|
agent_executor = AgentExecutor(agent=agent, tools=tools).with_config( |
|
{"run_name": "Agent"} |
|
) |