Improve ChatVertexAI usability for custom endpoints (base_url, api_transport) #31891
julius-dev-google
announced in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked
Feature request
This proposal aims to improve the developer experience when configuring ChatVertexAI with custom endpoints. Specifically, it suggests making the base_url parameter more robust and providing clear, actionable feedback for unsupported api_transport configurations in async contexts. These changes would make integrating ChatVertexAI with common infrastructure like API proxies (e.g., Apigee, Envoy) more intuitive and less error-prone.
Motivation
Configuring ChatVertexAI for use with a custom API proxy can be challenging due to two specific usability issues that can lead to silent failures and require deep debugging into the library's source code.
The base_url parameter's behavior is counter-intuitive.
The parameter is named base_url, which implies it accepts a full URL string (e.g., https://my-proxy.example.com). However, the implementation expects only a hostname. Providing a full URL results in a DNS lookup failure on the entire string, including the https:// schema. This mismatch between the parameter's name and its expected input format is a common source of configuration errors that are difficult to diagnose.
The api_transport="rest" setting is silently ignored in async contexts.
When a developer configures the client for REST and uses an async method (ainvoke, astream), the library internally reverts to using grpc_asyncio without any warning or error. This "silent failure" is particularly problematic, as it can lead developers to needlessly debug their proxy and network infrastructure, when the actual issue is that the client is ignoring its own configuration.
These issues create a significant barrier for developers trying to implement common production patterns like circuit breaking, custom authentication, or request logging via a proxy.
Proposal (If applicable)
No response
Beta Was this translation helpful? Give feedback.
All reactions