File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
pydantic_ai_slim/pydantic_ai/providers Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,9 @@ def __init__(
103103 # NOTE: We are keeping GEMINI_API_KEY for backwards compatibility.
104104 api_key = api_key or os .getenv ('GOOGLE_API_KEY' ) or os .getenv ('GEMINI_API_KEY' )
105105
106+ vertex_ai_args_used = bool (location or project or credentials )
106107 if vertexai is None :
107- vertexai = bool ( location or project or credentials )
108+ vertexai = vertex_ai_args_used
108109
109110 http_client = http_client or cached_async_http_client (
110111 provider = 'google-vertex' if vertexai else 'google-gla'
@@ -124,6 +125,9 @@ def __init__(
124125 )
125126 self ._client = Client (vertexai = False , api_key = api_key , http_options = http_options )
126127 else :
128+ if vertex_ai_args_used :
129+ api_key = None
130+
127131 if api_key is None :
128132 project = project or os .getenv ('GOOGLE_CLOUD_PROJECT' )
129133 # From https://github.com/pydantic/pydantic-ai/pull/2031/files#r2169682149:
You can’t perform that action at this time.
0 commit comments