Home / Function/ _get_standardized_inputs() — langchain Function Reference

_get_standardized_inputs() — langchain Function Reference

Architecture documentation for the _get_standardized_inputs() function in log_stream.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  999c00c5_f6b7_32ae_2290_ef3266811aab["_get_standardized_inputs()"]
  bd3b753a_7a64_0c77_8d7a_afcce4658003["log_stream.py"]
  999c00c5_f6b7_32ae_2290_ef3266811aab -->|defined in| bd3b753a_7a64_0c77_8d7a_afcce4658003
  79906bae_a315_8c6a_0f74_2bca8c58615c["_on_run_create()"]
  79906bae_a315_8c6a_0f74_2bca8c58615c -->|calls| 999c00c5_f6b7_32ae_2290_ef3266811aab
  dd086141_42ce_3053_f911_051099488c1c["_on_run_update()"]
  dd086141_42ce_3053_f911_051099488c1c -->|calls| 999c00c5_f6b7_32ae_2290_ef3266811aab
  style 999c00c5_f6b7_32ae_2290_ef3266811aab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/log_stream.py lines 564–602

def _get_standardized_inputs(
    run: Run, schema_format: Literal["original", "streaming_events"]
) -> Any:
    """Extract standardized inputs from a `Run`.

    Standardizes the inputs based on the type of the runnable used.

    Args:
        run: `Run` object
        schema_format: The schema format to use.

    Returns:
        Valid inputs are only dict. By conventions, inputs always represented invocation
            using named arguments. `None` means that the input is not yet known!
    """
    if schema_format == "original":
        msg = (
            "Do not assign inputs with original schema drop the key for now."
            "When inputs are added to astream_log they should be added with "
            "standardized schema for streaming events."
        )
        raise NotImplementedError(msg)

    inputs = load(run.inputs, allowed_objects="all")

    if run.run_type in {"retriever", "llm", "chat_model"}:
        return inputs

    # new style chains
    # These nest an additional 'input' key inside the 'inputs' to make sure
    # the input is always a dict. We need to unpack and use the inner value.
    inputs = inputs["input"]
    # We should try to fix this in Runnables and callbacks/tracers
    # Runnables should be using a None type here not a placeholder
    # dict.
    if inputs == {"input": ""}:  # Workaround for Runnables not using None
        # The input is not known, so we don't assign data['input']
        return None
    return inputs

Domain

Subdomains

Frequently Asked Questions

What does _get_standardized_inputs() do?
_get_standardized_inputs() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/log_stream.py.
Where is _get_standardized_inputs() defined?
_get_standardized_inputs() is defined in libs/core/langchain_core/tracers/log_stream.py at line 564.
What calls _get_standardized_inputs()?
_get_standardized_inputs() is called by 2 function(s): _on_run_create, _on_run_update.

Analyze Your Own Codebase

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

Try Supermodel Free