Home / Function/ format() — langchain Function Reference

format() — langchain Function Reference

Architecture documentation for the format() function in dict.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bb0b608c_59c9_0fe2_d2b0_9aac161c0550["format()"]
  99b61388_a110_30d7_e5b6_3ec6b66bc790["DictPromptTemplate"]
  bb0b608c_59c9_0fe2_d2b0_9aac161c0550 -->|defined in| 99b61388_a110_30d7_e5b6_3ec6b66bc790
  d48a69cd_ae11_f9bf_fb23_97098938b638["aformat()"]
  d48a69cd_ae11_f9bf_fb23_97098938b638 -->|calls| bb0b608c_59c9_0fe2_d2b0_9aac161c0550
  7c0e2e03_4dc8_1af5_a25e_fb968989eb1b["invoke()"]
  7c0e2e03_4dc8_1af5_a25e_fb968989eb1b -->|calls| bb0b608c_59c9_0fe2_d2b0_9aac161c0550
  f890c3fc_f11b_01fb_8c12_833f8396b4a5["_insert_input_variables()"]
  bb0b608c_59c9_0fe2_d2b0_9aac161c0550 -->|calls| f890c3fc_f11b_01fb_8c12_833f8396b4a5
  style bb0b608c_59c9_0fe2_d2b0_9aac161c0550 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/dict.py lines 34–40

    def format(self, **kwargs: Any) -> dict[str, Any]:
        """Format the prompt with the inputs.

        Returns:
            A formatted dict.
        """
        return _insert_input_variables(self.template, kwargs, self.template_format)

Subdomains

Called By

Frequently Asked Questions

What does format() do?
format() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/dict.py.
Where is format() defined?
format() is defined in libs/core/langchain_core/prompts/dict.py at line 34.
What does format() call?
format() calls 1 function(s): _insert_input_variables.
What calls format()?
format() is called by 2 function(s): aformat, invoke.

Analyze Your Own Codebase

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

Try Supermodel Free