Home / Function/ invoke() — langchain Function Reference

invoke() — langchain Function Reference

Architecture documentation for the invoke() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  38563cc2_888b_7f30_20e2_b266ab658ba3["invoke()"]
  8089660b_1932_a057_67f2_81c26c346902["BaseGenerationOutputParser"]
  38563cc2_888b_7f30_20e2_b266ab658ba3 -->|defined in| 8089660b_1932_a057_67f2_81c26c346902
  d0466f82_a0f5_f9bb_a408_1ceff85e7997["invoke()"]
  d0466f82_a0f5_f9bb_a408_1ceff85e7997 -->|calls| 38563cc2_888b_7f30_20e2_b266ab658ba3
  d0466f82_a0f5_f9bb_a408_1ceff85e7997["invoke()"]
  38563cc2_888b_7f30_20e2_b266ab658ba3 -->|calls| d0466f82_a0f5_f9bb_a408_1ceff85e7997
  ed977dbe_388f_1e3d_b9dc_6b6244713930["parse_result()"]
  38563cc2_888b_7f30_20e2_b266ab658ba3 -->|calls| ed977dbe_388f_1e3d_b9dc_6b6244713930
  style 38563cc2_888b_7f30_20e2_b266ab658ba3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/output_parsers/base.py lines 90–110

    def invoke(
        self,
        input: str | BaseMessage,
        config: RunnableConfig | None = None,
        **kwargs: Any,
    ) -> T:
        if isinstance(input, BaseMessage):
            return self._call_with_config(
                lambda inner_input: self.parse_result(
                    [ChatGeneration(message=inner_input)]
                ),
                input,
                config,
                run_type="parser",
            )
        return self._call_with_config(
            lambda inner_input: self.parse_result([Generation(text=inner_input)]),
            input,
            config,
            run_type="parser",
        )

Domain

Subdomains

Called By

Frequently Asked Questions

What does invoke() do?
invoke() is a function in the langchain codebase, defined in libs/core/langchain_core/output_parsers/base.py.
Where is invoke() defined?
invoke() is defined in libs/core/langchain_core/output_parsers/base.py at line 90.
What does invoke() call?
invoke() calls 2 function(s): invoke, parse_result.
What calls invoke()?
invoke() is called by 1 function(s): invoke.

Analyze Your Own Codebase

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

Try Supermodel Free