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

ChatGoogleGenerativeAI invoke docs are missing additional keyword params #423

Open
gramliu opened this issue Aug 5, 2024 · 1 comment
Open

Comments

@gramliu
Copy link
Contributor

gramliu commented Aug 5, 2024

Docs

The docs for ChatGoogleGenerativeAI are missing additional keyword params. Looking at the source code, there are additional kwargs for tools, functions, safety_settings, tool_config, and generation_config.

However, the docs only mention a separate config parameter.

image

API Inconsistency

This made it confusing for me to figure out how to actually specify the temperature for a specific invoke call (not at model instantiation). Code snippet that actually works but isn't documented:

from langchain_google_genai import ChatGoogleGenerativeAI
from dotenv import load_dotenv

load_dotenv()

gemini_pro = ChatGoogleGenerativeAI(model="gemini-1.5-flash", temperature=0, max_tokens=1000)
gemini_pro.invoke("What's your favorite color'?", generation_config={ "temperature": 0.1 })

Additionally, I think it makes sense for temperature to at the very least be parsed out from the main kwargs, without the need to specify the generation_config parameter. The following code snippet works out of the box for other models:

claude = ChatAnthropic(model="claude-3-opus-20240229", temperature=0, max_tokens=1000)
claude.invoke("What's your favorite color'?", temperature=0.1)

so it would make sense that it should also be supported for Google models

@lkuligin
Copy link
Collaborator

thanks for spotting this!
would you be open to send a PR with a fix for a docstring, please?

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