Home / Function/ tap_output_iter() — langchain Function Reference

tap_output_iter() — langchain Function Reference

Architecture documentation for the tap_output_iter() function in log_stream.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a4facac0_e177_a5c6_18cb_41e1fabc5bc2["tap_output_iter()"]
  78fc514f_5439_00c6_7e00_021af9ce4e07["LogStreamCallbackHandler"]
  a4facac0_e177_a5c6_18cb_41e1fabc5bc2 -->|defined in| 78fc514f_5439_00c6_7e00_021af9ce4e07
  c5f1fbd2_23b6_75cb_1f29_b9e028c332a0["send()"]
  a4facac0_e177_a5c6_18cb_41e1fabc5bc2 -->|calls| c5f1fbd2_23b6_75cb_1f29_b9e028c332a0
  style a4facac0_e177_a5c6_18cb_41e1fabc5bc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/tracers/log_stream.py lines 358–387

    def tap_output_iter(self, run_id: UUID, output: Iterator[T]) -> Iterator[T]:
        """Tap an output async iterator to stream its values to the log.

        Args:
            run_id: The ID of the run.
            output: The output iterator.

        Yields:
            The output value.
        """
        for chunk in output:
            # root run is handled in .astream_log()
            # if we can't find the run silently ignore
            # eg. because this run wasn't included in the log
            if (
                run_id != self.root_id
                and (key := self._key_map_by_run_id.get(run_id))
                and (
                    not self.send(
                        {
                            "op": "add",
                            "path": f"/logs/{key}/streamed_output/-",
                            "value": chunk,
                        }
                    )
                )
            ):
                break

            yield chunk

Domain

Subdomains

Calls

Frequently Asked Questions

What does tap_output_iter() do?
tap_output_iter() is a function in the langchain codebase, defined in libs/core/langchain_core/tracers/log_stream.py.
Where is tap_output_iter() defined?
tap_output_iter() is defined in libs/core/langchain_core/tracers/log_stream.py at line 358.
What does tap_output_iter() call?
tap_output_iter() calls 1 function(s): send.

Analyze Your Own Codebase

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

Try Supermodel Free