Home / Function/ _populate_extras() — langchain Function Reference

_populate_extras() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  93add5be_b499_e5c1_485e_3c2cf6bd0ceb["_populate_extras()"]
  0e434ace_bc91_58ed_0c26_ebc25d9a766a["groq.py"]
  93add5be_b499_e5c1_485e_3c2cf6bd0ceb -->|defined in| 0e434ace_bc91_58ed_0c26_ebc25d9a766a
  9d4d24e2_43fa_881e_628f_8a0a55cde2e6["_convert_to_v1_from_groq()"]
  9d4d24e2_43fa_881e_628f_8a0a55cde2e6 -->|calls| 93add5be_b499_e5c1_485e_3c2cf6bd0ceb
  style 93add5be_b499_e5c1_485e_3c2cf6bd0ceb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/messages/block_translators/groq.py lines 12–27

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/groq.py.
Where is _populate_extras() defined?
_populate_extras() is defined in libs/core/langchain_core/messages/block_translators/groq.py at line 12.
What calls _populate_extras()?
_populate_extras() is called by 1 function(s): _convert_to_v1_from_groq.

Analyze Your Own Codebase

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

Try Supermodel Free