Home / Function/ on_text() — langchain Function Reference

on_text() — langchain Function Reference

Architecture documentation for the on_text() function in logging.py from the langchain codebase.

Function python Observability Tracers calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a["on_text()"]
  842d2d2b_a22f_fcd2_b679_3f83339b04f4["LoggingCallbackHandler"]
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a -->|defined in| 842d2d2b_a22f_fcd2_b679_3f83339b04f4
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a["on_text()"]
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a -->|calls| 1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a["on_text()"]
  1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a -->|calls| 1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a
  style 1c757aee_c43b_b4aa_1a41_1edd8d0d2f6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/callbacks/tracers/logging.py lines 41–56

    def on_text(
        self,
        text: str,
        *,
        run_id: UUID,
        parent_run_id: UUID | None = None,
        **kwargs: Any,
    ) -> None:
        try:
            crumbs_str = f"[{self.get_breadcrumbs(run=self._get_run(run_id=run_id))}] "
        except TracerException:
            crumbs_str = ""
        self.function_callback(
            f"{get_colored_text('[text]', color='blue')}"
            f" {get_bolded_text(f'{crumbs_str}New text:')}\n{text}",
        )

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does on_text() do?
on_text() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/callbacks/tracers/logging.py.
Where is on_text() defined?
on_text() is defined in libs/langchain/langchain_classic/callbacks/tracers/logging.py at line 41.
What does on_text() call?
on_text() calls 1 function(s): on_text.
What calls on_text()?
on_text() is called by 1 function(s): on_text.

Analyze Your Own Codebase

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

Try Supermodel Free