Home / Function/ _create_parent() — langchain Function Reference

_create_parent() — langchain Function Reference

Architecture documentation for the _create_parent() function in test_tracing_interops.py from the langchain codebase.

Function python LangChainCore Runnables calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  3719e2cc_93ad_455c_1a0f_e9a777837449["_create_parent()"]
  bf7edb6a_efe2_778a_5204_a2813723040a["TestRunnableSequenceParallelTraceNesting"]
  3719e2cc_93ad_455c_1a0f_e9a777837449 -->|defined in| bf7edb6a_efe2_778a_5204_a2813723040a
  94606c53_844b_2d78_abaf_9a0055c3e789["test_sync()"]
  94606c53_844b_2d78_abaf_9a0055c3e789 -->|calls| 3719e2cc_93ad_455c_1a0f_e9a777837449
  353e1ca2_8a6c_ba21_9c45_8252973047c0["test_async()"]
  353e1ca2_8a6c_ba21_9c45_8252973047c0 -->|calls| 3719e2cc_93ad_455c_1a0f_e9a777837449
  9628f893_1701_c3db_b87d_89de6bbf00e1["ainvoke()"]
  3719e2cc_93ad_455c_1a0f_e9a777837449 -->|calls| 9628f893_1701_c3db_b87d_89de6bbf00e1
  style 3719e2cc_93ad_455c_1a0f_e9a777837449 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/runnables/test_tracing_interops.py lines 268–301

    def _create_parent(
        other_thing: Callable[
            [int], Generator[int, None, None] | AsyncGenerator[int, None]
        ],
    ) -> RunnableLambda:
        @RunnableLambda
        def my_child_function(a: int) -> int:
            return a + 2

        parallel = RunnableParallel(
            chain_result=my_child_function.with_config(tags=["atag"]),
            other_thing=other_thing,
        )

        def before(x: int) -> int:
            return x

        def after(x: dict[str, Any]) -> int:
            return int(x["chain_result"])

        sequence = before | parallel | after
        if isasyncgenfunction(other_thing):

            @RunnableLambda
            async def parent(a: int) -> int:
                return await sequence.ainvoke(a)

        else:

            @RunnableLambda
            def parent(a: int) -> int:
                return sequence.invoke(a)

        return parent

Domain

Subdomains

Calls

Frequently Asked Questions

What does _create_parent() do?
_create_parent() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/runnables/test_tracing_interops.py.
Where is _create_parent() defined?
_create_parent() is defined in libs/core/tests/unit_tests/runnables/test_tracing_interops.py at line 268.
What does _create_parent() call?
_create_parent() calls 1 function(s): ainvoke.
What calls _create_parent()?
_create_parent() is called by 2 function(s): test_async, test_sync.

Analyze Your Own Codebase

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

Try Supermodel Free