langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Include ChatGPT Turbo model in the Chain (Summarization)

Open nsankar opened this issue 2 years ago • 4 comments

Please include ChatGPT Turbo's ChatOpenAI object to be passed as an LLM completion in the Summarizer chain. (from langchain.chat_models.openai import ChatOpenAI)

for the following usage summary_chain = load_summarize_chain(llm, chain_type="map_reduce") summarize_document_chain = AnalyzeDocumentChain(combine_docs_chain=summary_chain)

nsankar avatar Mar 17 '23 09:03 nsankar

im assuming you mean update the typing?

hwchase17 avatar Mar 20 '23 03:03 hwchase17

Currently, with: llm = OpenAI(model_name= "gpt-3.5-turbo" ,temperature=0)

It loads OpenAIChat and feeding OpenAIChat into summary_chain = load_summarize_chain(llm, chain_type="map_reduce", map_prompt=PROMPT, combine_prompt=PROMPT, verbose=True)

Will lead to the following error: ValueError: OpenAIChat currently only supports single prompt, got [Wha...

I don't know if it is the same issue nsankar referring to. But I think it would be a great improvement as text-davinci-003 is super expensive compared to gpt-3.5-turbo. In particular for map_reduce summarization as it makes a lot of API calls...

If it's not the same issue, I can open a new issue

TomDarmon avatar Mar 20 '23 12:03 TomDarmon

The issue is the same as I posted here: https://github.com/hwchase17/langchain/issues/1368#issuecomment-1461853402

Chat models don't work for summarization in langchain, but there is no good reason for this. It is very easy to make chat models act like normal models, would suggest just doing that.

FergusFettes avatar Mar 20 '23 13:03 FergusFettes

If you are desperate to get this working, you can cherrypick the commit I made here: https://github.com/hwchase17/langchain/pull/1826

Then you can use turbo and gpt4 for chains etc.

FergusFettes avatar Mar 20 '23 18:03 FergusFettes

Hi, @nsankar! I'm Dosu, and I'm here to help 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 is a request to include the ChatGPT Turbo model in the Summarizer chain for usage in summarizing documents. There have been discussions about updating the typing and making chat models act like normal models. A suggestion was made to cherrypick a commit to use turbo and gpt4 for chains.

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 the LangChain team 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 understanding and contributions to the LangChain project! Let us know if you have any further questions or concerns.

dosubot[bot] avatar Sep 21 '23 16:09 dosubot[bot]