Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in image.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f083de38_569a_92f5_40cc_79d6ef0decd2["__init__()"]
  6a465cb4_c33a_e368_ad81_def98b4d2da2["ImagePromptTemplate"]
  f083de38_569a_92f5_40cc_79d6ef0decd2 -->|defined in| 6a465cb4_c33a_e368_ad81_def98b4d2da2
  style f083de38_569a_92f5_40cc_79d6ef0decd2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/image.py lines 28–46

    def __init__(self, **kwargs: Any) -> None:
        """Create an image prompt template.

        Raises:
            ValueError: If the input variables contain `'url'`, `'path'`, or
                `'detail'`.
        """
        if "input_variables" not in kwargs:
            kwargs["input_variables"] = []

        overlap = set(kwargs["input_variables"]) & {"url", "path", "detail"}
        if overlap:
            msg = (
                "input_variables for the image template cannot contain"
                " any of 'url', 'path', or 'detail'."
                f" Found: {overlap}"
            )
            raise ValueError(msg)
        super().__init__(**kwargs)

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/image.py.
Where is __init__() defined?
__init__() is defined in libs/core/langchain_core/prompts/image.py at line 28.

Analyze Your Own Codebase

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

Try Supermodel Free