Home / Function/ test_create() — langchain Function Reference

test_create() — langchain Function Reference

Architecture documentation for the test_create() function in test_history_aware_retriever.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a849a02f_397c_1c5f_442a_71d9c0fc8c34["test_create()"]
  bb518455_1c8b_fbdc_f38a_7fca2dd72f47["test_history_aware_retriever.py"]
  a849a02f_397c_1c5f_442a_71d9c0fc8c34 -->|defined in| bb518455_1c8b_fbdc_f38a_7fca2dd72f47
  style a849a02f_397c_1c5f_442a_71d9c0fc8c34 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_history_aware_retriever.py lines 9–29

def test_create() -> None:
    answer = "I know the answer!"
    llm = FakeListLLM(responses=[answer])
    retriever = FakeParrotRetriever()
    question_gen_prompt = PromptTemplate.from_template("hi! {input} {chat_history}")
    chain = create_history_aware_retriever(llm, retriever, question_gen_prompt)
    expected_output = [Document(page_content="What is the answer?")]
    output = chain.invoke({"input": "What is the answer?", "chat_history": []})
    assert output == expected_output

    output = chain.invoke({"input": "What is the answer?"})
    assert output == expected_output

    expected_output = [Document(page_content="I know the answer!")]
    output = chain.invoke(
        {
            "input": "What is the answer?",
            "chat_history": ["hi", "hi"],
        },
    )
    assert output == expected_output

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free