Home / Function/ test_create() — langchain Function Reference

test_create() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  56d28c61_da42_5990_b57c_c5a29ebeaadb["test_create()"]
  ea8f35ea_b504_3cb7_7c67_3f90b2f5a88f["test_retrieval.py"]
  56d28c61_da42_5990_b57c_c5a29ebeaadb -->|defined in| ea8f35ea_b504_3cb7_7c67_3f90b2f5a88f
  style 56d28c61_da42_5990_b57c_c5a29ebeaadb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_retrieval.py lines 11–25

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_retrieval_chain(retriever, question_gen_prompt | llm)

    expected_output = {
        "answer": "I know the answer!",
        "chat_history": "foo",
        "context": [Document(page_content="What is the answer?")],
        "input": "What is the answer?",
    }
    output = chain.invoke({"input": "What is the answer?", "chat_history": "foo"})
    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_retrieval.py.
Where is test_create() defined?
test_create() is defined in libs/langchain/tests/unit_tests/chains/test_retrieval.py at line 11.

Analyze Your Own Codebase

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

Try Supermodel Free