How to stop Llama from generating follow-up questions and excessive conversation with langchain
why does Llama generate random questions and answer them by itself, it's so annoying and overcomplicates stuff. I'm using ChatPromptTemplate class and my prompt template code looks something like this:
system_prompt = (
"Use the given context to answer the question. "
"If you don't know the answer, say you don't know. "
"Use three sentence maximum and keep the answer concise. "
"Context: {context}"
)
prompt = ChatPromptTemplate.from_messages(
[
("system", system_prompt),
("human", "{input}"),
]
)
def get_response_llm_pinecone(llm, vectorstore, query):
# Create the question-answer chain
question_answer_chain = create_stuff_documents_chain(llm, prompt)
# Create the retrieval chain
chain = create_retrieval_chain(vectorstore.as_retriever(), question_answer_chain)
# Invoke the retrieval chain with the query
response = chain.invoke({"input": query})
print(response["input"])
print(response["answer"])
forgot to mention i'm using the langchain framework
I have the same problem. Did you find the solution? Thanks
are you using the base model or chat? base model usually behaves like this
I made use of the Meta-Llama-3-8B-Instruct model instead of the base model, and it worked! Thank you.