Home / File/ test_base.py — langchain Source File

test_base.py — langchain Source File

Architecture documentation for test_base.py, a python file in the langchain codebase. 2 imports, 0 dependents.

File python CoreAbstractions RunnableInterface 2 imports 2 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  b94b19df_d5d5_f33b_4a42_6f2a77c78cd1["test_base.py"]
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  b94b19df_d5d5_f33b_4a42_6f2a77c78cd1 --> 91721f45_4909_e489_8c1f_084f8bd87145
  a4804e3f_4fa3_c9fc_7121_e057c2daa7e3["langchain_core.example_selectors"]
  b94b19df_d5d5_f33b_4a42_6f2a77c78cd1 --> a4804e3f_4fa3_c9fc_7121_e057c2daa7e3
  style b94b19df_d5d5_f33b_4a42_6f2a77c78cd1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing_extensions import override

from langchain_core.example_selectors import BaseExampleSelector


class DummyExampleSelector(BaseExampleSelector):
    def __init__(self) -> None:
        self.example: dict[str, str] | None = None

    def add_example(self, example: dict[str, str]) -> None:
        self.example = example

    @override
    def select_examples(self, input_variables: dict[str, str]) -> list[dict[str, str]]:
        return [input_variables]


async def test_aadd_example() -> None:
    selector = DummyExampleSelector()
    await selector.aadd_example({"foo": "bar"})
    assert selector.example == {"foo": "bar"}


async def test_aselect_examples() -> None:
    selector = DummyExampleSelector()
    examples = await selector.aselect_examples({"foo": "bar"})
    assert examples == [{"foo": "bar"}]

Subdomains

Dependencies

  • langchain_core.example_selectors
  • typing_extensions

Frequently Asked Questions

What does test_base.py do?
test_base.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_base.py?
test_base.py defines 2 function(s): test_aadd_example, test_aselect_examples.
What does test_base.py depend on?
test_base.py imports 2 module(s): langchain_core.example_selectors, typing_extensions.
Where is test_base.py in the architecture?
test_base.py is located at libs/core/tests/unit_tests/example_selectors/test_base.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/core/tests/unit_tests/example_selectors).

Analyze Your Own Codebase

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

Try Supermodel Free