Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bases have instance lay-out conflict #10179

Closed
1 of 14 tasks
alpha-21 opened this issue Sep 4, 2023 · 7 comments
Closed
1 of 14 tasks

Multiple bases have instance lay-out conflict #10179

alpha-21 opened this issue Sep 4, 2023 · 7 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: models Related to LLMs or chat model modules

Comments

@alpha-21
Copy link

alpha-21 commented Sep 4, 2023

System Info

torch = "2.0.1"
transformers = "4.31.0"
langchain= "0.0.251"
kor= "0.13.0"
openai= "0.27.8"
pydantic= "1.10.8"
python_version = "3.9"

Who can help?

No response

Information

  • The official example notebooks/scripts
  • My own modified scripts

Related Components

  • LLMs/Chat Models
  • Embedding Models
  • Prompts / Prompt Templates / Prompt Selectors
  • Output Parsers
  • Document Loaders
  • Vector Stores / Retrievers
  • Memory
  • Agents / Agent Executors
  • Tools / Toolkits
  • Chains
  • Callbacks/Tracing
  • Async

Reproduction

from db.tools import DbTools
from langchain.chat_models import ChatOpenAI
from kor.nodes import Object, Text, Number
from kor import create_extraction_chain, Object, Text

llm = ChatOpenAI(
model_name="gpt-3.5-turbo",
temperature=0,
max_tokens=2000,
frequency_penalty=0,
presence_penalty=0,
openai_api_key = "" ,
top_p=1.0,
)

Expected behavior

Hello I encountered the following error when trying to import the langchain.schema module:
Traceback (most recent call last):
File "/home/alpha/platform/shared/libpython/computation/fine_instruction_GPT.py", line 2, in
from langchain.chat_models import ChatOpenAI
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/init.py", line 6, in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/agents/init.py", line 31, in
from langchain.agents.agent import (
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/agents/agent.py", line 15, in
from langchain.agents.agent_iterator import AgentExecutorIterator
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/agents/agent_iterator.py", line 21, in
from langchain.callbacks.manager import (
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/callbacks/init.py", line 10, in
from langchain.callbacks.aim_callback import AimCallbackHandler
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/callbacks/aim_callback.py", line 5, in
from langchain.schema import AgentAction, AgentFinish, LLMResult
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/schema/init.py", line 4, in
from langchain.schema.memory import BaseChatMessageHistory, BaseMemory
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/schema/memory.py", line 7, in
from langchain.schema.messages import AIMessage, BaseMessage, HumanMessage
File "/home/alpha/.local/share/virtualenvs/platform-_bj8LfuO/lib/python3.9/site-packages/langchain/schema/messages.py", line 147, in
class HumanMessageChunk(HumanMessage, BaseMessageChunk):
File "pydantic/main.py", line 367, in pydantic.main.ModelMetaclass.new
File "/usr/lib/python3.9/abc.py", line 85, in new
cls = super().new(mcls, name, bases, namespace, **kwargs)
TypeError: multiple bases have instance lay-out conflict

@alpha-21 alpha-21 changed the title ultiple bases have instance lay-out conflict Multiple bases have instance lay-out conflict Sep 4, 2023
@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Sep 4, 2023
@dosubot
Copy link

dosubot bot commented Sep 4, 2023

🤖

Hello,

Thank you for providing detailed information about the issue you're facing. It seems like you're encountering a conflict with multiple bases having an instance layout conflict. This error typically occurs when there's a conflict between the inheritance of classes in Python.

Based on the similar issues that have been solved in the LangChain repository, here are a few suggestions that might help:

  1. Update the import statement from from langchain.schema import BaseLanguageModel to from langchain.base_language import BaseLanguageModel. This was a solution provided in the issue Was Running Fine and now getting errors.

  2. Try installing specific versions of the packages as follows:

pip install llama-index==0.5.6
pip install langchain==0.0.148

This was another solution suggested in the same issue mentioned above.

  1. If the issue persists, try uninstalling gpt-index, langchain, and llama-index, and then reinstall them:
pip uninstall gpt-index
pip uninstall langchain
pip uninstall llama-index
pip install gpt-index
pip install langchain
pip install llama-index

This was also a solution provided in the same issue.

  1. If your script is named langsmith.py, consider renaming it to something like langsmith_test.py or any name that doesn't mask the langsmith module name. This was a solution provided in the issue LangChain 0.0.250 circular import bug, possibly LangSmith related.

  2. Try updating LangChain and llama-index to the latest versions and restarting the Kernel on Jupyter Notebook. This was a solution provided in the issue Cannot import name 'HumanMessage' from 'langchain.schema'.

Please try these solutions and let us know if any of them work for you. If the issue persists, please provide more details about the error and we'll be glad to assist you further.

Best,
Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@alpha-21
Copy link
Author

alpha-21 commented Sep 4, 2023

Thank but i have the same issues

@Veghit
Copy link

Veghit commented Sep 5, 2023

I have the same issue. Updating Pydantic to 1.10.12 solved it, but if conflicts with other requirements in my project.

@khanhphan1311
Copy link

I have the same issue. Updating Pydantic to 1.10.12 solved it, but if conflicts with other requirements in my project.

This works for me like magic. Many thanks.

@shuish0071
Copy link

I have the same issue. Updating Pydantic to 1.10.12 solved it, but if conflicts with other requirements in my project.

Thank you so muck, it works !

@HissaanAli
Copy link

I have the same issue. Updating Pydantic to 1.10.12 solved it, but if conflicts with other requirements in my project.

Same, worked for me as well.

@haiwang-joe
Copy link

I have the same issue. Updating Pydantic to 1.10.12 solved it, but if conflicts with other requirements in my project.

I works for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: models Related to LLMs or chat model modules
Projects
None yet
Development

No branches or pull requests

6 participants