langchain-ai / langchainjs

🦜🔗 Build context-aware reasoning applications 🦜🔗
https://js.langchain.com/docs/
MIT License
12.7k stars 2.19k forks source link

Error: Missing value for input input #2220

Closed ali-habibzadeh closed 1 year ago

ali-habibzadeh commented 1 year ago

I am trying to use the ConversationChain class with OpenAI Model like this:

const llm = new OpenAI({ modelName: "gpt-4" });
const chain = new ConversationChain({ llm, memory: new BufferMemory() });
const concatenatedPageContent = queryResponse.matches.map(match => (<any>match?.metadata)?.pageContent).join(" ");
const result = await chain.call({
  input_documents: [new Document({ pageContent: concatenatedPageContent })],
  question: question,
});
return result.text;

But I get this error:

const interpolateFString = (template, values) => (0, exports.parseFString)(template).reduce((res, node) => {
                                                                                     ^
source-map-support.js:722
Error: Missing value for input input
jacoblee93 commented 1 year ago

You are not using the correct input values for that chain - those are for the QA stuff chain:

https://js.langchain.com/docs/modules/chains/document/stuff

I've got an open PR for typing inputs like this more carefully to reduce confusion here - expect it soon!