From c59a5bae484d5516a013e8122393558d4d9b3328 Mon Sep 17 00:00:00 2001 From: Jeremy Naccache <63456504+jeremynac@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:00:29 +0200 Subject: [PATCH] Fix intermediate steps example in docs : replaced json.dumps with Langchain's dumps() (#10593) The intermediate steps example in docs has an example on how to retrieve and display the intermediate steps. But the intermediate steps object is of type AgentAction which cannot be passed to json.dumps (it raises an error). I replaced it with Langchain's dumps function (from langchain.load.dump import dumps) which is the preferred way to do so. --- docs/extras/modules/agents/how_to/intermediate_steps.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/extras/modules/agents/how_to/intermediate_steps.ipynb b/docs/extras/modules/agents/how_to/intermediate_steps.ipynb index b26ba42750c..3670c715bba 100644 --- a/docs/extras/modules/agents/how_to/intermediate_steps.ipynb +++ b/docs/extras/modules/agents/how_to/intermediate_steps.ipynb @@ -166,9 +166,9 @@ } ], "source": [ - "import json\n", + "from langchain.load.dump import dumps\n", "\n", - "print(json.dumps(response[\"intermediate_steps\"], indent=2))" + "print(dumps(response[\"intermediate_steps\"], pretty=True))" ] }, {