Spaces:
Sleeping
Sleeping
Commit
·
d288560
1
Parent(s):
dae846b
bugfix: fix minor bugs
Browse files
utils/completion_reward.py
CHANGED
|
@@ -322,12 +322,17 @@ class GoogleAgent:
|
|
| 322 |
from vertexai.preview.generative_models import GenerativeModel
|
| 323 |
SERVICE_ACCOUNT_INFO = os.getenv("GBQ_TOKEN")
|
| 324 |
service_account_info_dict = json.loads(SERVICE_ACCOUNT_INFO)
|
|
|
|
|
|
|
|
|
|
| 325 |
logging.warning(f"Google service account info: {service_account_info_dict}")
|
| 326 |
logging.warning(f"{type(service_account_info_dict)}")
|
| 327 |
aiplatform.init(
|
| 328 |
project='junyiacademy',
|
| 329 |
service_account=service_account_info_dict,
|
|
|
|
| 330 |
)
|
|
|
|
| 331 |
gemini_pro_model = GenerativeModel("gemini-pro")
|
| 332 |
|
| 333 |
def get_story(self, user_log):
|
|
|
|
| 322 |
from vertexai.preview.generative_models import GenerativeModel
|
| 323 |
SERVICE_ACCOUNT_INFO = os.getenv("GBQ_TOKEN")
|
| 324 |
service_account_info_dict = json.loads(SERVICE_ACCOUNT_INFO)
|
| 325 |
+
SCOPES = ["https://www.googleapis.com/auth/cloud-platform"]
|
| 326 |
+
|
| 327 |
+
creds = Credentials.from_service_account_info(service_account_info_dict, scopes=SCOPES)
|
| 328 |
logging.warning(f"Google service account info: {service_account_info_dict}")
|
| 329 |
logging.warning(f"{type(service_account_info_dict)}")
|
| 330 |
aiplatform.init(
|
| 331 |
project='junyiacademy',
|
| 332 |
service_account=service_account_info_dict,
|
| 333 |
+
credentials=creds,
|
| 334 |
)
|
| 335 |
+
|
| 336 |
gemini_pro_model = GenerativeModel("gemini-pro")
|
| 337 |
|
| 338 |
def get_story(self, user_log):
|