Spaces:
Runtime error
Runtime error
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"]) | |
# Get the prompt to use - you can modify this! | |
prompt = hub.pull("hwchase17/openai-tools-agent") | |
# print(prompt.messages) -- to see the prompt | |
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"} | |
) |