My LangChain app stopped working after upgrading to v0 2 What changed in agent execution

0 votes
May 11 in Generative AI by gaurav
• 24,180 points
42 views

1 answer to this question.

0 votes

The v0.2 upgrade broke a lot of people's agents. Here's what actually changed:

The biggest thing — AgentExecutor isn't the default anymore
from langchain.agents import initialize_agent, AgentType

agent = initialize_agent(

    tools=tools,

    llm=llm,

    agent=AgentType.OPENAI_FUNCTIONS,

    verbose=True

)

agent.run("What's the weather in Delhi?")

In the new version ,initialize_agent  this function is deprecated. The new way uses LCEL
 

from langchain import hub

from langchain.agents import create_openai_functions_agent, AgentExecutor

prompt = hub.pull("hwchase17/openai-functions-agent")

agent = create_openai_functions_agent(llm, tools, prompt)

agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

agent_executor.invoke({"input": "What's the weather in Delhi?"})

answered May 12 by anonymous
• 740 points

Related Questions In Generative AI

0 votes
1 answer

What methods do you use to handle out-of-vocabulary words or tokens during text generation in GPT models?

The three efficient techniques are as follows: 1.Subword Tokenization(Byte ...READ MORE

answered Nov 8, 2024 in Generative AI by ashu yadav
935 views
0 votes
1 answer
0 votes
0 answers

What techniques do you use to implement attention-based weighting in image captioning models?

Can you name four techniques used to ...READ MORE

Nov 11, 2024 in Generative AI by Ashutosh
• 33,370 points

edited Nov 12, 2024 by Ashutosh 845 views
0 votes
0 answers
0 votes
1 answer

My script stopped working after OpenAI switched to the new Responses API. How do I migrate from ChatCompletion?

The responses API is quite different from ...READ MORE

answered May 12 in Generative AI by anonymous
• 740 points
45 views
0 votes
1 answer

My Pinecone vector search stopped returning results after index upgrade due to schema mismatch?

Schema mismatches after a Pinecone index upgrade ...READ MORE

answered May 12 in Generative AI by anonymous
• 740 points
69 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP