From f1e602996a397ce3f7751feea86a0e8dd1e96aee Mon Sep 17 00:00:00 2001 From: Myeongseop Kim <81076998+amicus-veritatis@users.noreply.github.com> Date: Wed, 23 Aug 2023 03:54:07 +0900 Subject: [PATCH] import tqdm.auto instead of tqdm tqdm for OpenAIEmbeddings (#9584) - Description: current code does not work very well on jupyter notebook, so I changed the code so that it imports `tqdm.auto` instead. - Issue: #9582 - Dependencies: N/A - Tag maintainer: @hwchase17, @baskaryan - Twitter handle: N/A Co-authored-by: Eugene Yurtsev --- libs/langchain/langchain/embeddings/openai.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/langchain/langchain/embeddings/openai.py b/libs/langchain/langchain/embeddings/openai.py index 9c78e2499e..976c879f95 100644 --- a/libs/langchain/langchain/embeddings/openai.py +++ b/libs/langchain/langchain/embeddings/openai.py @@ -352,9 +352,9 @@ class OpenAIEmbeddings(BaseModel, Embeddings): if self.show_progress_bar: try: - import tqdm + from tqdm.auto import tqdm - _iter = tqdm.tqdm(range(0, len(tokens), _chunk_size)) + _iter = tqdm(range(0, len(tokens), _chunk_size)) except ImportError: _iter = range(0, len(tokens), _chunk_size) else: