Skip to content

Commit 5e5e5fb

Browse files
yinghsienwucopybara-github
authored andcommitted
doc: Add types.ResourceScope.COLLECTION to README for reverse proxy with custom base url use case
Fixes #2089 PiperOrigin-RevId: 880932287
1 parent e0ea224 commit 5e5e5fb

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,26 @@ server) and bypass some authentication checks for project, location, or API key.
286286
You may pass the custom base url like this:
287287

288288
```python
289-
base_url = 'https://test-api-gateway-proxy.com'
290289
client = Client(
291-
vertexai=True, # Currently only vertexai=True is supported
292-
http_options={
293-
'base_url': base_url,
294-
'headers': {'Authorization': 'Bearer test_token'},
295-
},
290+
vertexai=True,
291+
http_options=types.HttpOptionsDict(
292+
base_url='https://test-api-gateway-proxy.com',
293+
base_url_resource_scope=types.ResourceScope.COLLECTION,
294+
),
295+
)
296+
297+
response = client.models.generate_content(
298+
model='gemini-3-pro-preview', contents='Why is the sky blue?'
296299
)
297300
```
298301

302+
If `base_url_resource_scope=types.ResourceScope.COLLECTION`, the resource name
303+
will not include api version, project, or location.
304+
305+
Expected request url will be:
306+
https://test-api-gateway-proxy.com/publishers/google/models/gemini-3-pro-preview
307+
308+
299309
## Types
300310

301311
Parameter types can be specified as either dictionaries(`TypedDict`) or

0 commit comments

Comments
 (0)