Home / Function/ partial() — langchain Function Reference

partial() — langchain Function Reference

Architecture documentation for the partial() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fe55ed71_8ce3_99ef_6885_6136dbeb7550["partial()"]
  dddce6a3_2420_c71d_01fe_f214c3eb2503["BasePromptTemplate"]
  fe55ed71_8ce3_99ef_6885_6136dbeb7550 -->|defined in| dddce6a3_2420_c71d_01fe_f214c3eb2503
  style fe55ed71_8ce3_99ef_6885_6136dbeb7550 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/base.py lines 279–293

    def partial(self, **kwargs: str | Callable[[], str]) -> BasePromptTemplate:
        """Return a partial of the prompt template.

        Args:
            **kwargs: Partial variables to set.

        Returns:
            A partial of the prompt template.
        """
        prompt_dict = self.__dict__.copy()
        prompt_dict["input_variables"] = list(
            set(self.input_variables).difference(kwargs)
        )
        prompt_dict["partial_variables"] = {**self.partial_variables, **kwargs}
        return type(self)(**prompt_dict)

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free