Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

block_reason: OTHER , in RAG chain

 

I tried to build a RAG for question answering, and I followed some references and set safety_settings to BLOCK_NONE:
https://python.langchain.com/docs/how_to/qa_chat_history_how_to/
https://github.com/langchain-ai/langchain/issues/15095

I found that gemini_1.5  always returns block_reason: OTHER, when I used RAG_chain. When I ask LLM directly, Gemini will reply properly. Code like this:

question_answer_chain = create_stuff_documents_chain(llm, prompt)
rag_chain = create_retrieval_chain(retriever, question_answer_chain)

docs = [
Document(page_content="""something here"""),
]

llm.invoke(question6)
# return proper answer

question_answer_chain.invoke({"input": question6,'chat_history':[],"context": docs}) #return block_reason: OTHER

rag_chain.invoke({"input": question6,'chat_history':[],"context": docs})
# return block_reason: OTHER

0 0 56
0 REPLIES 0