format() — langchain Function Reference
Architecture documentation for the format() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7b4c9028_73c1_6e8c_5317_60688210c25a["format()"] dddce6a3_2420_c71d_01fe_f214c3eb2503["BasePromptTemplate"] 7b4c9028_73c1_6e8c_5317_60688210c25a -->|defined in| dddce6a3_2420_c71d_01fe_f214c3eb2503 0295e9e8_9e6c_edee_9cdd_3bb377028854["aformat()"] 0295e9e8_9e6c_edee_9cdd_3bb377028854 -->|calls| 7b4c9028_73c1_6e8c_5317_60688210c25a 38ecad37_d22e_eadb_cf12_ac64aaa1fe0c["format_document()"] 38ecad37_d22e_eadb_cf12_ac64aaa1fe0c -->|calls| 7b4c9028_73c1_6e8c_5317_60688210c25a style 7b4c9028_73c1_6e8c_5317_60688210c25a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/base.py lines 303–316
def format(self, **kwargs: Any) -> FormatOutputType:
"""Format the prompt with the inputs.
Args:
**kwargs: Any arguments to be passed to the prompt template.
Returns:
A formatted string.
Example:
```python
prompt.format(variable1="foo")
```
"""
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does format() do?
format() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/base.py.
Where is format() defined?
format() is defined in libs/core/langchain_core/prompts/base.py at line 303.
What calls format()?
format() is called by 2 function(s): aformat, format_document.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free