Friday, May 24, 2024

How to set verbose in Langchain

Here is how you can set globally. 

from langchain.globals import set_verbose, set_debug

set_debug(True)
set_verbose(True)
  

You can also scope verbosity down to a single object, in which case only the inputs and outputs to that object are printed (along with any additional callbacks calls made specifically by that object).

# Passing verbose=True to initialize_agent will pass that along to the AgentExecutor (which is a Chain).
agent = initialize_agent(
    tools, 
    llm, 
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True,
)

agent.run("who invented electricity")
  

Hope this helps!!

No comments:

Post a Comment