[Python] Expected type 'BaseChatModel', got 'ChatGoogleGenerativeAI' instead In Agent AI

Discussão em 'Python' iniciado por Stack, Agosto 20, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to create a AI Automation Agent for my QA project .

    I have Python 3.1x installed, PyCharm as IDE. I have imported browser-use, pydantic, lang chain, google-generative-ai libraries from the settings of PyCharm.

    Next, I have created a task and specified agent as below.

    from browser_use.agent.service import Agent
    from langchain_google_genai import ChatGoogleGenerativeAI

    async def SiteValidation():
    task = (
    'I am a UI automation UI tester validating this task'
    'Open the website https://www.google.com'
    )
    llm=ChatGoogleGenerativeAI(model='',api_key='')
    Agent(task,llm)


    But the llm parameter [i.e Agent(task,llm)] throws an error. It says as below.

    Expected type 'BaseChatModel', got 'ChatGoogleGenerativeAI' instead


    I have tried downgrading the version as well. Nothing worked.

    Continue reading...

Compartilhe esta Página