_construct_scratchpad() — langchain Function Reference
Architecture documentation for the _construct_scratchpad() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2afe5c6a_955b_c3e0_01d8_639bb3398225["_construct_scratchpad()"] b3f40ce7_80ee_f7bd_df0e_7eb84f6efab7["ChatAgent"] 2afe5c6a_955b_c3e0_01d8_639bb3398225 -->|defined in| b3f40ce7_80ee_f7bd_df0e_7eb84f6efab7 style 2afe5c6a_955b_c3e0_01d8_639bb3398225 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/chat/base.py lines 52–66
def _construct_scratchpad(
self,
intermediate_steps: list[tuple[AgentAction, str]],
) -> str:
agent_scratchpad = super()._construct_scratchpad(intermediate_steps)
if not isinstance(agent_scratchpad, str):
msg = "agent_scratchpad should be of type string."
raise ValueError(msg) # noqa: TRY004
if agent_scratchpad:
return (
f"This was your previous work "
f"(but I haven't seen any of it! I only see what "
f"you return as final answer):\n{agent_scratchpad}"
)
return agent_scratchpad
Domain
Subdomains
Source
Frequently Asked Questions
What does _construct_scratchpad() do?
_construct_scratchpad() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/chat/base.py.
Where is _construct_scratchpad() defined?
_construct_scratchpad() is defined in libs/langchain/langchain_classic/agents/chat/base.py at line 52.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free