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

[Bug] Fixed the Bedrock model name error #953

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

lingyielia
Copy link
Contributor

@lingyielia lingyielia commented Jan 15, 2025

Description

_get_model_name raises "Model name could not be retrieved" when used with AWS Bedrock, because ChatBedrock class doesn't have corresponding property for model name retrieval.

The proposed fix is to drop _get_model_name entirely to prevent similar mismatch from models we haven't used. Also, _get_model_name is not a necessary step. If there is a need to know the model name, we can explicitly call the property.

e.g.,

from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(
        model="claude-3-5-sonnet-latest",
        api_key = os.environ.get("ANTHROPIC_API_KEY"),
        base_url= os.environ.get("ANTHROPIC_API_BASE")
    )
llm.model

will render 'claude-3-5-sonnet-latest'

Before this bug is fixed, users could use ChatBedrockConverse instead of ChatBedrock.
https://python.langchain.com/v0.2/docs/integrations/chat/bedrock/#bedrock-converse-api

Screenshot

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

@github-actions github-actions bot added the Vizro-AI 🤖 Issue/PR that addresses Vizro-AI package label Jan 15, 2025
Copy link
Contributor

@stichbury stichbury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🏆

@lingyielia lingyielia merged commit b9c7fa3 into main Jan 15, 2025
38 checks passed
@lingyielia lingyielia deleted the bug/bedrock_model_name_error branch January 15, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Vizro-AI 🤖 Issue/PR that addresses Vizro-AI package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants