Home / Function/ test_fixed_message_response_when_docs_found() — langchain Function Reference

test_fixed_message_response_when_docs_found() — langchain Function Reference

Architecture documentation for the test_fixed_message_response_when_docs_found() function in test_conversation_retrieval.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5e84234c_7d3e_af1c_ce9f_8f909d0c2e74["test_fixed_message_response_when_docs_found()"]
  995a7073_bf4f_3e52_1d5f_85841e01cccc["test_conversation_retrieval.py"]
  5e84234c_7d3e_af1c_ce9f_8f909d0c2e74 -->|defined in| 995a7073_bf4f_3e52_1d5f_85841e01cccc
  style 5e84234c_7d3e_af1c_ce9f_8f909d0c2e74 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_conversation_retrieval.py lines 90–114

def test_fixed_message_response_when_docs_found() -> None:
    fixed_resp = "I don't know"
    answer = "I know the answer!"
    llm = FakeListLLM(responses=[answer])
    retriever = SequentialRetriever(
        sequential_responses=[[Document(page_content=answer)]],
    )
    memory = ConversationBufferMemory(
        k=1,
        output_key="answer",
        memory_key="chat_history",
        return_messages=True,
    )
    qa_chain = ConversationalRetrievalChain.from_llm(
        llm=llm,
        memory=memory,
        retriever=retriever,
        return_source_documents=True,
        rephrase_question=False,
        response_if_no_docs_found=fixed_resp,
        verbose=True,
    )
    got = qa_chain("What is the answer?")
    assert got["chat_history"][1].content == answer
    assert got["answer"] == answer

Domain

Subdomains

Frequently Asked Questions

What does test_fixed_message_response_when_docs_found() do?
test_fixed_message_response_when_docs_found() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_conversation_retrieval.py.
Where is test_fixed_message_response_when_docs_found() defined?
test_fixed_message_response_when_docs_found() is defined in libs/langchain/tests/unit_tests/chains/test_conversation_retrieval.py at line 90.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free