When creating a chat_completion endpoint using the amazonbedrock or googlevertexai services, it is possible to specify a task_settings field containing some settings that are applicable to chat_completion. For Amazon Bedrock, the relevant settings are max_new_tokens, temperature, top_p and top_k. For Google Vertex, the relevant setting is max_tokens.
When task settings are specified at endpoint creation time, they should be used for all requests using that endpoint unless explicitly overridden in the request. However, when an AmazonBedrockChatCompletionRequestEntity is created in AmazonBedrockChatCompletionEntityFactory, the values used for max_new_tokens, temperature and top_p are taken only from the request, with the task settings associated with the model being ignored, and the top_k setting being omitted entirely, since it can't be specified in a request (see the code here).
Similarly, for a GoogleVertexAiUnifiedChatCompletionRequestEntity (used when the provider service settings is omitted or set to google), the task settings are ignored, meaning that the max_tokens task setting is not used (see the code here).
To fix this bug, the values configured in the task settings should be used if the corresponding values in the request are null.
For Amazon Bedrock chat completions, this bug is present in 9.4 and onward (introduced in #139411, which added chat_completion for Amazon Bedrock).
For Google Vertex, this bug is present in 9.2 and onward (introduced in #134080, which added the max_tokens task setting).
When creating a
chat_completionendpoint using theamazonbedrockorgooglevertexaiservices, it is possible to specify atask_settingsfield containing some settings that are applicable tochat_completion. For Amazon Bedrock, the relevant settings aremax_new_tokens,temperature,top_pandtop_k. For Google Vertex, the relevant setting ismax_tokens.When task settings are specified at endpoint creation time, they should be used for all requests using that endpoint unless explicitly overridden in the request. However, when an
AmazonBedrockChatCompletionRequestEntityis created inAmazonBedrockChatCompletionEntityFactory, the values used formax_new_tokens,temperatureandtop_pare taken only from the request, with the task settings associated with the model being ignored, and thetop_ksetting being omitted entirely, since it can't be specified in a request (see the code here).Similarly, for a
GoogleVertexAiUnifiedChatCompletionRequestEntity(used when theproviderservice settings is omitted or set togoogle), the task settings are ignored, meaning that themax_tokenstask setting is not used (see the code here).To fix this bug, the values configured in the task settings should be used if the corresponding values in the request are null.
For Amazon Bedrock chat completions, this bug is present in 9.4 and onward (introduced in #139411, which added
chat_completionfor Amazon Bedrock).For Google Vertex, this bug is present in 9.2 and onward (introduced in #134080, which added the
max_tokenstask setting).