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

ChatVertexAI has no property max_tokens. #596

Open
daniel-deychakiwsky opened this issue Nov 9, 2024 · 0 comments
Open

ChatVertexAI has no property max_tokens. #596

daniel-deychakiwsky opened this issue Nov 9, 2024 · 0 comments

Comments

@daniel-deychakiwsky
Copy link

ChatVertexAI inherits from BaseChatModel which accepts a standard property, max_tokens, from the documentation.

When initializing a ChatVertexAI instance with this standard property, it is not available on the instance and throws an error upon accessing. It is instead available under max_output_tokens.

It should be made available on the instance as the other chat model integrations (ChatOpenAI, ChatAnthropic, ...) all have this property available on the instance.

model = ChatVertexAI(
    model="gemini-1.5-pro-002",
    temperature=0.0,
    max_tokens=500,
    top_p=1.0,
)

print(model.max_output_tokens)  # 500
print(model.max_tokens).  # AttributeError: 'ChatVertexAI' object has no attribute 'max_tokens'

LangChain package versions:

langchain-core==0.3.15
langchain-google-vertexai==2.0.7

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

1 participant