alejandro-ao / langchain-ask-pdf

An AI-app that allows you to upload a PDF and ask questions about it. It uses OpenAI's LLMs to generate a response.
592 stars 309 forks source link

What color is the sky? - How to add custom templates to ConversationalRetrievalChain? #17

Open almahdibakkali96 opened 1 year ago

almahdibakkali96 commented 1 year ago

This is actually important to add. If you ask about unrelated topic, like "What color is the sky", it will still answer related to the video...

I tried combine_docs_chain_kwargs={"prompt": prompt} with no success. Also, I can't make the code work with LLMChain, like:

` chat_prompt = ChatPromptTemplate.from_messages( [system_message_prompt, human_message_prompt] )

chain = LLMChain(llm=chat, prompt=chat_prompt)`