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

Raise Warning for Incorrect Keyword Arguments in VertexAI #556

Open
Itaymanes opened this issue Oct 15, 2024 · 1 comment
Open

Raise Warning for Incorrect Keyword Arguments in VertexAI #556

Itaymanes opened this issue Oct 15, 2024 · 1 comment

Comments

@Itaymanes
Copy link

When initializing a class such as VertexAI, the process completes "smoothly" even when incorrect keyword arguments are provided. For example, I encountered the following issue:

Copy code
from langchain_google_vertexai import VertexAI, HarmCategory, HarmBlockThreshold

gemini_safety_settings = {
    HarmCategory.HARM_CATEGORY_UNSPECIFIED: HarmBlockThreshold.BLOCK_NONE,
    HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE,
}
GEMINI = VertexAI(
    model="gemini-1.5-pro-002",
    temperature=0,
    safety_setting=gemini_safety_settings,
)

The code executes without any warnings, despite the fact that safety_setting is incorrect and should be written as safety_settings. This can be problematic, as it may lead to unexpected model behavior, which is difficult to diagnose.

I am raising this issue with VertexAI, but I am unsure if the same behavior occurs with other classes as well. If you agree with this problematic behavior, and you believe that it needs to be changed, I can open a PR with fixing this issue.

@lkuligin
Copy link
Collaborator

Yes, raising a warning never hurts. Please, feel free to send the PR.
The problem is, that we can never be sure 100% whether this kwargs is meant for ChatVertexAI / VertexAI or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants