Skip to content

Conversation

@thomas-corcoran
Copy link
Contributor

PR Description

Adds frequency_penalty and presence_penalty to base model.

Fixes issues where initializing ChatVertexAI with a frequency_penalty argument would log:
Unexpected argument 'frequency_penalty' provided to ChatVertexAI.

Type

🐛 Bug Fix

…tests

* Updated _VertexAICommon class to include frequency_penalty and presence_penalty attributes.
* Modified test cases to incorporate new parameters in model initialization and generation configuration.
…texAICommon class

* Updated docstrings for frequency_penalty and presence_penalty attributes to provide clearer explanations of their effects on token generation.
@thomas-corcoran thomas-corcoran marked this pull request as ready for review April 24, 2025 17:52
"Underlying model name."
temperature: Optional[float] = None
"Sampling temperature, it controls the degree of randomness in token selection."
frequency_penalty: Optional[float] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

you need to extend _allow_model_args too, otherwise args sent to the invoke would be ignored

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I added them to the gemma models -- that's the only place I see allowed_model_args used.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont' think Gemma supports these params.

I'm sorry I wasn't clear, that's the place that should be modified:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry. I'm clearly missing something. frequency_penalty and presence_penalty are already there, no?

thomas-corcoran and others added 2 commits April 28, 2025 09:35
* Included frequency_penalty and presence_penalty in the GemmaVertexAIModelGarden and GemmaChatVertexAIModelGarden classes to enhance model configuration options.
"Underlying model name."
temperature: Optional[float] = None
"Sampling temperature, it controls the degree of randomness in token selection."
frequency_penalty: Optional[float] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont' think Gemma supports these params.

I'm sorry I wasn't clear, that's the place that should be modified:

thomas-corcoran and others added 2 commits April 29, 2025 16:21
… classes

* Eliminated frequency_penalty and presence_penalty from the GemmaVertexAIModelGarden and GemmaChatVertexAIModelGarden classes to streamline model configuration options.
@lkuligin lkuligin merged commit e47f25f into langchain-ai:main Apr 30, 2025
15 checks passed
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

Successfully merging this pull request may close these issues.

2 participants