autolabel
autolabel copied to clipboard
[Bug] [Dependency]: Import LabelingAgent is failing due to langchain and pydantic dependency issue with refuel-autolabel
Hi, I tried importing LabelingAgent using below code : from autolabel import LabelingAgent getting pydantic error, please check full issue in attached file Basically, issue is with langchain, it needs pydantic version >= 2, but this is not supported by refuel-autolable 0.0.15, when I tried to upgrade langchain (which supports pydantic>=2.0), again refuel-autolable 0.0.15 doesn't support langchain >=0.0.210
Using Python 3.9.18 OS: windows 11
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
langchain 0.0.226 requires pydantic<2,>=1, but you have pydantic 2.0 which is incompatible.
langchainplus-sdk 0.0.20 requires pydantic<2,>=1, but you have pydantic 2.0 which is incompatible.
refuel-autolabel 0.0.15 requires langchain==0.0.210, but you have langchain 0.0.226 which is incompatible.
`---------------------------------------------------------------------------
PydanticUserError Traceback (most recent call last)
Cell In[8], line 3
1 import json
----> 3 from autolabel import LabelingAgent
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\autolabel\__init__.py:3
1 from importlib import metadata
----> 3 from .labeler import LabelingAgent
4 from .utils import get_data
5 from .dataset import AutolabelDataset
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\autolabel\labeler.py:13
10 from rich.console import Console
11 from rich.prompt import Confirm
---> 13 from autolabel.cache import SQLAlchemyGenerationCache, SQLAlchemyTransformCache
14 from autolabel.confidence import ConfidenceCalculator
15 from autolabel.configs import AutolabelConfig
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\autolabel\cache\__init__.py:2
1 from .base import BaseCache
----> 2 from .sqlalchemy_generation_cache import SQLAlchemyGenerationCache
3 from .sqlalchemy_transform_cache import SQLAlchemyTransformCache
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\autolabel\cache\sqlalchemy_generation_cache.py:3
1 from sqlalchemy.orm import sessionmaker
2 from typing import Optional
----> 3 from autolabel.schema import GenerationCacheEntry
4 from autolabel.database import create_db_engine
5 from autolabel.data_models import Base
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\autolabel\schema.py:6
3 from typing import Any, Dict, List, Optional, Union
5 import pandas as pd
----> 6 from langchain.schema import Generation
7 from pydantic import BaseModel
9 from autolabel.configs import AutolabelConfig
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\__init__.py:6
3 from importlib import metadata
4 from typing import Optional
----> 6 from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
7 from langchain.cache import BaseCache
8 from langchain.chains import (
9 ConversationChain,
10 LLMBashChain,
(...)
18 VectorDBQAWithSourcesChain,
19 )
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\agents\__init__.py:2
1 """Interface for agents."""
----> 2 from langchain.agents.agent import (
3 Agent,
4 AgentExecutor,
5 AgentOutputParser,
6 BaseMultiActionAgent,
7 BaseSingleActionAgent,
8 LLMSingleActionAgent,
9 )
10 from langchain.agents.agent_toolkits import (
11 create_csv_agent,
12 create_json_agent,
(...)
21 create_vectorstore_router_agent,
22 )
23 from langchain.agents.agent_types import AgentType
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\agents\agent.py:16
13 from pydantic import BaseModel, root_validator
15 from langchain.agents.agent_types import AgentType
---> 16 from langchain.agents.tools import InvalidTool
17 from langchain.base_language import BaseLanguageModel
18 from langchain.callbacks.base import BaseCallbackManager
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\agents\tools.py:4
1 """Interface for tools."""
2 from typing import Optional
----> 4 from langchain.callbacks.manager import (
5 AsyncCallbackManagerForToolRun,
6 CallbackManagerForToolRun,
7 )
8 from langchain.tools.base import BaseTool, Tool, tool
11 class InvalidTool(BaseTool):
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\callbacks\__init__.py:3
1 """Callback handlers that allow listening to events in LangChain."""
----> 3 from langchain.callbacks.aim_callback import AimCallbackHandler
4 from langchain.callbacks.argilla_callback import ArgillaCallbackHandler
5 from langchain.callbacks.arize_callback import ArizeCallbackHandler
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\callbacks\aim_callback.py:4
1 from copy import deepcopy
2 from typing import Any, Dict, List, Optional, Union
----> 4 from langchain.callbacks.base import BaseCallbackHandler
5 from langchain.schema import AgentAction, AgentFinish, LLMResult
8 def import_aim() -> Any:
File c:\users\hp\appdata\local\programs\python\python39\lib\site-packages\langchain\callbacks\base.py:7
4 from typing import Any, Dict, List, Optional, Union
... (54 lines left)
Hey @diljeet1994, with the new version, we have upgraded the langchain version and you should now be able to build autolabel. Let me know if you are still having issues!
Hi @rajasbansal , Thanks for the update, but please update the langchain to a newer version that support pydantic>2.0 so that the rest of the production level code doesn't breaks, with your current update, langchain version is 0.0226 which supports pydantic < 2. Please make this change cause it may give issue to lot of folks trying latest pydantic version for their apps.