diff --git a/langchain/chains/api/base.py b/langchain/chains/api/base.py index e5af03a009..7e199fe42f 100644 --- a/langchain/chains/api/base.py +++ b/langchain/chains/api/base.py @@ -78,6 +78,7 @@ class APIChain(Chain): callbacks=_run_manager.get_child(), ) _run_manager.on_text(api_url, color="green", end="\n", verbose=self.verbose) + api_url = api_url.strip() api_response = self.requests_wrapper.get(api_url) _run_manager.on_text( api_response, color="yellow", end="\n", verbose=self.verbose @@ -106,6 +107,7 @@ class APIChain(Chain): await _run_manager.on_text( api_url, color="green", end="\n", verbose=self.verbose ) + api_url = api_url.strip() api_response = await self.requests_wrapper.aget(api_url) await _run_manager.on_text( api_response, color="yellow", end="\n", verbose=self.verbose