Find answers from the community

Updated 4 months ago

Hi I ve been building agent chains using

At a glance
Hi, I've been building agent chains using Langchain and have noticed that for some reason, the agent_chains aren't always initializing correctly. Sometimes they work and other times they don't... Why is this and what is the most bullet proof way to get a callable agent_chain working?
M
L
2 comments
Here is my code so far for context:
Plain Text
    SimpleCSVReader = download_loader("SimpleCSVReader")
    loader = SimpleCSVReader()
    csv = loader.load_data(file=path)
    index = GPTSimpleVectorIndex(csv)
    tools = [
            Tool(
                name="GPT Index",
                func=lambda q: str(index.query(q)),
                description="The input to this tool should be a complete english sentence.",
                return_direct=True,
            ),
        ]
    memory = ConversationBufferMemory(memory_key="chat_history")
    llm = OpenAI(temperature=0) # type: ignore
    agent_chain = initialize_agent(
            tools,
            llm,
            agent="conversational-react-description",
            memory=memory,
        )
    #AI.agent_chain = create_ai(index)
    print(agent_chain.run(input="What is the name of this csv?"))
I'm curious what you mean by "initializing correctly" ? What is the error you run into?
Add a reply
Sign up and join the conversation on Discord