Skip to content

Commit c71432b

Browse files
Updated tags for OpenAI credentials refresher. (GoogleCloudPlatform#12083)
## Description Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google. ## Checklist - [x] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#readme-file) - [x] **Tests** pass: `nox -s py-3.9` (see [Test Environment Setup](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [x] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/CODEOWNERS) with the codeowners for this sample - [ ] This sample adds a new **Product API**, and I updated the [Blunderbuss issue/PR auto-assigner](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/blunderbuss.yml) with the codeowners for this sample - [x] Please **merge** this PR for me once it is approved
1 parent 58a70b8 commit c71432b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

generative_ai/chat_completions/chat_completions_credentials_refresher.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
# Disable linting on `Any` type annotations (needed for OpenAI kwargs and attributes).
1616
# flake8: noqa ANN401
1717

18+
# [START generativeaionvertexai_credentials_refresher]
1819
from typing import Any
1920

2021
import google.auth
2122
import google.auth.transport.requests
2223
import openai
2324

24-
2525
class OpenAICredentialsRefresher:
2626
def __init__(self, **kwargs: Any) -> None:
2727
# Set a dummy key here
@@ -40,6 +40,7 @@ def __getattr__(self, name: str) -> Any:
4040

4141
self.client.api_key = self.creds.token
4242
return getattr(self.client, name)
43+
# [END generativeaionvertexai_credentials_refresher]
4344

4445

4546
def generate_text(project_id: str, location: str = "us-central1") -> object:

0 commit comments

Comments
 (0)