Home / Function/ test_few_shot_prompt_template_with_selector_async() — langchain Function Reference

test_few_shot_prompt_template_with_selector_async() — langchain Function Reference

Architecture documentation for the test_few_shot_prompt_template_with_selector_async() function in test_few_shot.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  39db14b1_c050_d12b_adf6_4e239766e236["test_few_shot_prompt_template_with_selector_async()"]
  e4e12a36_798e_ddc0_ab57_e44de269c7e7["test_few_shot.py"]
  39db14b1_c050_d12b_adf6_4e239766e236 -->|defined in| e4e12a36_798e_ddc0_ab57_e44de269c7e7
  style 39db14b1_c050_d12b_adf6_4e239766e236 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_few_shot.py lines 492–507

async def test_few_shot_prompt_template_with_selector_async() -> None:
    """Tests for few shot chat message template with an example selector."""
    examples = [
        {"question": "foo", "answer": "bar"},
        {"question": "baz", "answer": "foo"},
    ]
    example_selector = AsyncAsIsSelector(examples)

    few_shot_prompt = FewShotPromptTemplate(
        input_variables=["foo"],
        suffix="This is a {foo} test.",
        example_prompt=EXAMPLE_PROMPT,
        example_selector=example_selector,
    )
    messages = await few_shot_prompt.aformat(foo="bar")
    assert messages == "foo: bar\n\nbaz: foo\n\nThis is a bar test."

Domain

Subdomains

Frequently Asked Questions

What does test_few_shot_prompt_template_with_selector_async() do?
test_few_shot_prompt_template_with_selector_async() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_few_shot.py.
Where is test_few_shot_prompt_template_with_selector_async() defined?
test_few_shot_prompt_template_with_selector_async() is defined in libs/core/tests/unit_tests/prompts/test_few_shot.py at line 492.

Analyze Your Own Codebase

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

Try Supermodel Free