[Python] Trying to get my agent_executor for a sql agent in langchain to accept Prompts and...

Discussão em 'Python' iniciado por Stack, Junho 17, 2025.

  1. Stack

    Stack Membro Participativo

    The langchain, agent_executor, SQLDatabaseToolkit all working but I want to prompt it and keep chat history for follow up questions. For example place a prompt somewhere to push to use table x when asked about storage.

    It looks like this at the moment :

    toolkit = SQLDatabaseToolkit(db=db, llm=llm)
    memory = ConversationBufferMemory(memory_key="chat_history")

    agent_executor = create_sql_agent(
    llm=llm,
    toolkit=toolkit,
    verbose=True,
    memory=memory
    )

    agent_executor.run("How many products bought in Chicago")


    Can i do that with this agent, toolkit or I need another method.?

    At the moment running the above, I can't prompt it and it does not keep follow on conversation.

    Like say you ask first question, how many products bought from Chicago, then follow up with a question - what were these.

    Continue reading...

Compartilhe esta Página