Home / Function/ _populate_extras() — langchain Function Reference

_populate_extras() — langchain Function Reference

Architecture documentation for the _populate_extras() function in bedrock_converse.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f24958c1_ebd2_ad94_ed33_1739783b6196["_populate_extras()"]
  4f830f44_a777_e9e4_dc82_3b3b61033802["bedrock_converse.py"]
  f24958c1_ebd2_ad94_ed33_1739783b6196 -->|defined in| 4f830f44_a777_e9e4_dc82_3b3b61033802
  e7f9e8d0_57e0_3961_f961_c1f03ff20520["_convert_to_v1_from_converse_input()"]
  e7f9e8d0_57e0_3961_f961_c1f03ff20520 -->|calls| f24958c1_ebd2_ad94_ed33_1739783b6196
  style f24958c1_ebd2_ad94_ed33_1739783b6196 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/messages/block_translators/bedrock_converse.py lines 15–30

def _populate_extras(
    standard_block: types.ContentBlock, block: dict[str, Any], known_fields: set[str]
) -> types.ContentBlock:
    """Mutate a block, populating extras."""
    if standard_block.get("type") == "non_standard":
        return standard_block

    for key, value in block.items():
        if key not in known_fields:
            if "extras" not in standard_block:
                # Below type-ignores are because mypy thinks a non-standard block can
                # get here, although we exclude them above.
                standard_block["extras"] = {}  # type: ignore[typeddict-unknown-key]
            standard_block["extras"][key] = value  # type: ignore[typeddict-item]

    return standard_block

Domain

Subdomains

Frequently Asked Questions

What does _populate_extras() do?
_populate_extras() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/block_translators/bedrock_converse.py.
Where is _populate_extras() defined?
_populate_extras() is defined in libs/core/langchain_core/messages/block_translators/bedrock_converse.py at line 15.
What calls _populate_extras()?
_populate_extras() is called by 1 function(s): _convert_to_v1_from_converse_input.

Analyze Your Own Codebase

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

Try Supermodel Free