langchain
langchain copied to clipboard
Is it possible to use gpt-3.5-turbo or gpt-4 as the LLM model for agents?
Provided I have given a system prompt, I wanted to use gpt-4 as the llm for my agents. I read around, but it only seems like gpt-3 davinci and nothing beyond it is an option.
Can gpt-3.5-turbo or gpt-4 be included as a llm option for agents?
I think so:
from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model='gpt-3.5-turbo',temperature=0)
tools = load_tools(['human'], llm=llm)
agent = initialize_agent(tools, llm, agent="chat-zero-shot-react-description", verbose=True)
agent.run("Can you ask the human what to do?")
This is how I've done it as well
Trying to do this but getting na error:
openai
has noChatCompletion
attribute
Any thoughts?
Is there any way to do this without having the agent prompt me asking for a user input?
I tried this approach. But, with this approach I am not able to use the tools, due to parsing error:
OutputParserException: Could not parse LLM output: `I need to use the NewsTool to find news articles about the sale of XYZ stocks.`
Same issue from my end
Hi, @mathematicsofpaul! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, the issue was about using GPT-3.5-turbo or GPT-4 as the language model for agents, instead of just GPT-3 davinci. One user suggested a code snippet to use GPT-3.5-turbo as the model, and another user confirmed that they have used the same approach successfully. The reported issues related to the ChatCompletion
attribute error and parsing error when using the tools have been resolved.
Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your contribution to the LangChain repository!