Home / Function/ aformat() — langchain Function Reference

aformat() — langchain Function Reference

Architecture documentation for the aformat() function in few_shot.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b7b7112d_a9d5_26c4_6a42_307d742439c3["aformat()"]
  6d3822e2_4874_c820_71b3_b49073208692["FewShotChatMessagePromptTemplate"]
  b7b7112d_a9d5_26c4_6a42_307d742439c3 -->|defined in| 6d3822e2_4874_c820_71b3_b49073208692
  4207ab55_5d72_bc19_3528_ec2a39cdbae7["aformat()"]
  4207ab55_5d72_bc19_3528_ec2a39cdbae7 -->|calls| b7b7112d_a9d5_26c4_6a42_307d742439c3
  78e3126b_cc62_5242_f3ac_7483d87d3eed["aformat_messages()"]
  b7b7112d_a9d5_26c4_6a42_307d742439c3 -->|calls| 78e3126b_cc62_5242_f3ac_7483d87d3eed
  4207ab55_5d72_bc19_3528_ec2a39cdbae7["aformat()"]
  b7b7112d_a9d5_26c4_6a42_307d742439c3 -->|calls| 4207ab55_5d72_bc19_3528_ec2a39cdbae7
  style b7b7112d_a9d5_26c4_6a42_307d742439c3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/few_shot.py lines 449–464

    async def aformat(self, **kwargs: Any) -> str:
        """Async format the prompt with inputs generating a string.

        Use this method to generate a string representation of a prompt consisting of
        chat messages.

        Useful for feeding into a string-based completion language model or debugging.

        Args:
            **kwargs: Keyword arguments to use for formatting.

        Returns:
            A string representation of the prompt
        """
        messages = await self.aformat_messages(**kwargs)
        return get_buffer_string(messages)

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free