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

model init ValueError #13438

Closed
14 tasks
vvanglro opened this issue Nov 16, 2023 · 3 comments
Closed
14 tasks

model init ValueError #13438

vvanglro opened this issue Nov 16, 2023 · 3 comments
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature Ɑ: models Related to LLMs or chat model modules

Comments

@vvanglro
Copy link

System Info

langchain version: 0.0.336
mac
python3.8

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

import langchain
from langchain.chat_models.minimax import MiniMaxChat
print(langchain.__version__)
chat = MiniMaxChat(minimax_api_host="test_host", minimax_api_key="test_api_key", minimax_group_id="test_group_id")
assert chat._client
assert chat._client.host == "test_host"
assert chat._client.group_id == "test_group_id"
assert chat._client.api_key == "test_api_key"

output:

0.0.336
Traceback (most recent call last):
  File "/Users/hulk/code/py/workhome/test_pydantic/test_langchain.py", line 4, in <module>
    chat = MiniMaxChat(minimax_api_host="test_host", minimax_api_key="test_api_key", minimax_group_id="test_group_id")
  File "/Users/hulk/miniforge3/envs/py38/lib/python3.8/site-packages/langchain/llms/minimax.py", line 121, in __init__
    self._client = _MinimaxEndpointClient(
  File "pydantic/main.py", line 357, in pydantic.main.BaseModel.__setattr__
ValueError: "MiniMaxChat" object has no field "_client"

Expected behavior

Instantiation Success

Copy link

dosubot bot commented Nov 16, 2023

🤖

Hello @vvanglro! I'm a bot here to assist you while we wait for a human maintainer. My job is to help you solve bugs, answer questions, and guide you through the process of becoming a contributor. I'm currently reviewing your issue. I'll provide you with a full response very soon.

@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 Nov 16, 2023
Copy link

dosubot bot commented Nov 16, 2023

🤖

Based on the error message you're receiving, it seems like the "_client" attribute is not defined in the "MiniMaxChat" class. This attribute is used in the "_generate" method to make POST requests to the MiniMax API.

To resolve this issue, you need to define the "_client" attribute in the "MiniMaxChat" class. This could be done in the "init" method of the class, where you would initialize the "_client" attribute with an instance of the class responsible for making the POST requests.

Here's an example of how you might modify the "init" method to include the "_client" attribute:

def __init__(self, minimax_api_host, minimax_api_key, minimax_group_id):
    self._client = _MinimaxEndpointClient(
        host=minimax_api_host,
        api_key=minimax_api_key,
        group_id=minimax_group_id
    )

In this example, "_MinimaxEndpointClient" would be the class responsible for making the POST requests to the MiniMax API. You would need to replace "_MinimaxEndpointClient" with the actual class name used in your codebase.

Please note that this is a general solution and might need to be adjusted based on the specifics of your codebase. If you continue to experience issues, please provide more details about the "_MinimaxEndpointClient" class and how it's used in your codebase.

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.

Copy link

dosubot bot commented Feb 15, 2024

Hi, @vvanglro,

I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you encountered a ValueError when trying to instantiate a MiniMaxChat object from the langchain package, and Dosubot provided a detailed response suggesting that the "_client" attribute needs to be defined in the "MiniMaxChat" class, along with an example of how to modify the "init" method to include the "_client" attribute. It seems that the issue has been resolved with the provided solution.

Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 15, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Feb 21, 2024
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

Successfully merging a pull request may close this issue.

1 participant