getting the following error "pydantic.error_wrappers.ValidationError: 1 validation error for SerpAPIWrapper"

385 views Asked by At

Im getting the following error in vscode but when i run the code in google collab it works fine. looking for some insight into the problem. the keys I replaced for safety reasons but otherwise the code is what I run.

from langchain.utilities import SerpAPIWrapper
import openai
import os
from langchain.llms import OpenAI
from langchain.chat_models import ChatOpenAI
from langchain.agents import load_tools, initialize_agent, AgentType
from dotenv import load_dotenv

os.environ["SERPAPI_API_KEY"] = "my key"
os.environ['OPENAI_API_KEY'] = "my key"

llm = OpenAI(temperature=0)

tools = load_tools(["serpapi"], llm=llm)
agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True)

agent.run("According to MarketWatch, what is the price of S&P 500 Future Dec 2024?")

the error I'm getting in vscode

this is the results of google collab and what im looking for in vscode results in google collab

0

There are 0 answers