Coder Social home page Coder Social logo

KeyError: '' : output_key not found [in _get_input_output return inputs[prompt_input_key], outputs[output_key]] about langchain HOT 1 OPEN

Tisha-linkenite avatar Tisha-linkenite commented on July 30, 2024 1
KeyError: '' : output_key not found [in _get_input_output return inputs[prompt_input_key], outputs[output_key]]

from langchain.

Comments (1)

keenborder786 avatar keenborder786 commented on July 30, 2024

You are not using the correct input_key that goes along with the memory_key. Please see below:

question_generator_template = PromptTemplate(
        input_variables=[ # your input variables are not correct.
    "chat_history",
    "question", 
],
    template= (  
    """
    Combine the chat history and follow up question into a standalone question.
    Chat History: {chat_history}
    Follow up question: {question}
""")
)

question_generator_chain = LLMChain(
    llm=llm,
    prompt=question_generator_template,
)

# Create retrieval chain
retrieval_chain = ConversationalRetrievalChain(
    combine_docs_chain=document_chain,
    question_generator=question_generator_chain,
    retriever=retriever,
    memory=ConversationBufferMemory(memory_key="chat_history", input_key="question") # should use question as input key
)

from langchain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.