Home / Function/ add_example() — langchain Function Reference

add_example() — langchain Function Reference

Architecture documentation for the add_example() function in length_based.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  60d0098a_fe66_aae7_9d5b_79c421b2c80c["add_example()"]
  0eacfd0f_9944_7bad_618f_81f1c3dafb2a["LengthBasedExampleSelector"]
  60d0098a_fe66_aae7_9d5b_79c421b2c80c -->|defined in| 0eacfd0f_9944_7bad_618f_81f1c3dafb2a
  b24d41b3_2fff_0d6c_cbf6_bd3e3fe3c69b["aadd_example()"]
  b24d41b3_2fff_0d6c_cbf6_bd3e3fe3c69b -->|calls| 60d0098a_fe66_aae7_9d5b_79c421b2c80c
  style 60d0098a_fe66_aae7_9d5b_79c421b2c80c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/example_selectors/length_based.py lines 66–75

    def add_example(self, example: dict[str, str]) -> None:
        """Add new example to list.

        Args:
            example: A dictionary with keys as input variables
                and values as their values.
        """
        self.examples.append(example)
        string_example = self.example_prompt.format(**example)
        self.example_text_lengths.append(self.get_text_length(string_example))

Subdomains

Called By

Frequently Asked Questions

What does add_example() do?
add_example() is a function in the langchain codebase, defined in libs/core/langchain_core/example_selectors/length_based.py.
Where is add_example() defined?
add_example() is defined in libs/core/langchain_core/example_selectors/length_based.py at line 66.
What calls add_example()?
add_example() is called by 1 function(s): aadd_example.

Analyze Your Own Codebase

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

Try Supermodel Free