Home / Function/ _aget_examples() — langchain Function Reference

_aget_examples() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  451110ca_cd2a_6b46_2728_65bad5d8be19["_aget_examples()"]
  d2f3c5fa_0eaf_bafd_40aa_1d4884ff518c["_FewShotPromptTemplateMixin"]
  451110ca_cd2a_6b46_2728_65bad5d8be19 -->|defined in| d2f3c5fa_0eaf_bafd_40aa_1d4884ff518c
  a1af40b0_77e5_5515_2418_602984733e1b["aformat()"]
  a1af40b0_77e5_5515_2418_602984733e1b -->|calls| 451110ca_cd2a_6b46_2728_65bad5d8be19
  37a6e3a8_1d5e_5529_9b47_401d58b50428["aformat_messages()"]
  37a6e3a8_1d5e_5529_9b47_401d58b50428 -->|calls| 451110ca_cd2a_6b46_2728_65bad5d8be19
  style 451110ca_cd2a_6b46_2728_65bad5d8be19 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/prompts/few_shot.py lines 100–117

    async def _aget_examples(self, **kwargs: Any) -> list[dict]:
        """Async get the examples to use for formatting the prompt.

        Args:
            **kwargs: Keyword arguments to be passed to the example selector.

        Returns:
            List of examples.

        Raises:
            ValueError: If neither `examples` nor `example_selector` are provided.
        """
        if self.examples is not None:
            return self.examples
        if self.example_selector is not None:
            return await self.example_selector.aselect_examples(kwargs)
        msg = "One of 'examples' and 'example_selector' should be provided"
        raise ValueError(msg)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free