build_extra() — langchain Function Reference
Architecture documentation for the build_extra() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 24ba8419_764b_df40_b799_0417a42c074a["build_extra()"] d5ca3c3a_3c29_0cb2_a156_35c92a31f5fd["ChatGroq"] 24ba8419_764b_df40_b799_0417a42c074a -->|defined in| d5ca3c3a_3c29_0cb2_a156_35c92a31f5fd style 24ba8419_764b_df40_b799_0417a42c074a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/groq/langchain_groq/chat_models.py lines 460–486
def build_extra(cls, values: dict[str, Any]) -> Any:
"""Build extra kwargs from additional params that were passed in."""
all_required_field_names = get_pydantic_field_names(cls)
extra = values.get("model_kwargs", {})
for field_name in list(values):
if field_name in extra:
msg = f"Found {field_name} supplied twice."
raise ValueError(msg)
if field_name not in all_required_field_names:
warnings.warn(
f"""WARNING! {field_name} is not default parameter.
{field_name} was transferred to model_kwargs.
Please confirm that {field_name} is what you intended.""",
stacklevel=2,
)
extra[field_name] = values.pop(field_name)
invalid_model_kwargs = all_required_field_names.intersection(extra.keys())
if invalid_model_kwargs:
msg = (
f"Parameters {invalid_model_kwargs} should be specified explicitly. "
f"Instead they were passed in as part of `model_kwargs` parameter."
)
raise ValueError(msg)
values["model_kwargs"] = extra
return values
Domain
Subdomains
Source
Frequently Asked Questions
What does build_extra() do?
build_extra() is a function in the langchain codebase, defined in libs/partners/groq/langchain_groq/chat_models.py.
Where is build_extra() defined?
build_extra() is defined in libs/partners/groq/langchain_groq/chat_models.py at line 460.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free