langchainjs icon indicating copy to clipboard operation
langchainjs copied to clipboard

ChatOpenAI() isn't a BaseLLM and therefore cannot use in ConversationalRetrievalQAChain

Open clbarrell opened this issue 1 year ago • 5 comments

I'm trying to use the ConversationalRetrievalQAChain with GPT3.5 because it's cheaper than GPT3.

But when I try to use new ChatOpenAI() as the model for ConversationalRetrievalQAChain it gives an error because it doesn't have the properties of name and _generateUncached that are present in BaseLLM.

Is there anything I can do to resolve this for now?

const chatModel = new ChatOpenAI();

const chain = ConversationalRetrievalQAChain.fromLLM(
  chatModel, // << TYPE ERROR
  vectorStore.asRetriever(),
  { returnSourceDocuments: true }
);

clbarrell avatar Apr 06 '23 00:04 clbarrell