RunLog Class — langchain Architecture
Architecture documentation for the RunLog class in log_stream.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 90eaa35f_ff53_6c94_a287_136fc5b6fdb8["RunLog"] 7aee39c0_a5c9_c6ea_388c_4792f8844146["RunLogPatch"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|extends| 7aee39c0_a5c9_c6ea_388c_4792f8844146 90eaa35f_ff53_6c94_a287_136fc5b6fdb8["RunLog"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|extends| 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 bd3b753a_7a64_0c77_8d7a_afcce4658003["log_stream.py"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|defined in| bd3b753a_7a64_0c77_8d7a_afcce4658003 d8f84480_cab2_8f11_7559_e10d5d85da02["__init__()"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|method| d8f84480_cab2_8f11_7559_e10d5d85da02 9d5469ce_45e7_c63b_fda9_7608171decb5["__add__()"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|method| 9d5469ce_45e7_c63b_fda9_7608171decb5 68814260_8f31_1cda_1ae4_ce47f2546b89["__repr__()"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|method| 68814260_8f31_1cda_1ae4_ce47f2546b89 1b7df743_a612_568a_0073_10c4cce6bf95["__eq__()"] 90eaa35f_ff53_6c94_a287_136fc5b6fdb8 -->|method| 1b7df743_a612_568a_0073_10c4cce6bf95
Relationship Graph
Source Code
libs/core/langchain_core/tracers/log_stream.py lines 168–226
class RunLog(RunLogPatch):
"""Run log."""
state: RunState
"""Current state of the log, obtained from applying all ops in sequence."""
def __init__(self, *ops: dict[str, Any], state: RunState) -> None:
"""Create a RunLog.
Args:
*ops: The operations to apply to the state.
state: The initial state of the run log.
"""
super().__init__(*ops)
self.state = state
def __add__(self, other: RunLogPatch | Any) -> RunLog:
"""Combine two `RunLog` objects.
Args:
other: The other `RunLog` or `RunLogPatch` to combine with.
Raises:
TypeError: If the other object is not a `RunLog` or `RunLogPatch`.
Returns:
A new `RunLog` representing the combination of the two.
"""
if type(other) is RunLogPatch:
ops = self.ops + other.ops
state = jsonpatch.apply_patch(self.state, other.ops)
return RunLog(*ops, state=state)
msg = f"unsupported operand type(s) for +: '{type(self)}' and '{type(other)}'"
raise TypeError(msg)
@override
def __repr__(self) -> str:
return f"RunLog({pformat(self.state)})"
@override
def __eq__(self, other: object) -> bool:
"""Check if two `RunLog`s are equal.
Args:
other: The other `RunLog` to compare to.
Returns:
`True` if the `RunLog`s are equal, `False` otherwise.
"""
# First compare that the state is the same
if not isinstance(other, RunLog):
return False
if self.state != other.state:
return False
# Then compare that the ops are the same
return super().__eq__(other)
__hash__ = None
Extends
Source
Frequently Asked Questions
What is the RunLog class?
RunLog is a class in the langchain codebase, defined in libs/core/langchain_core/tracers/log_stream.py.
Where is RunLog defined?
RunLog is defined in libs/core/langchain_core/tracers/log_stream.py at line 168.
What does RunLog extend?
RunLog extends RunLogPatch, RunLog.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free