|
@@ -48,10 +48,11 @@ class VertexAiTextEmbeddingModel(_CommonVertexAi, TextEmbeddingModel):
|
|
:param input_type: input type
|
|
:param input_type: input type
|
|
:return: embeddings result
|
|
:return: embeddings result
|
|
"""
|
|
"""
|
|
- service_account_info = json.loads(base64.b64decode(credentials["vertex_service_account_key"]))
|
|
+ service_account_key = credentials.get("vertex_service_account_key", "")
|
|
project_id = credentials["vertex_project_id"]
|
|
project_id = credentials["vertex_project_id"]
|
|
location = credentials["vertex_location"]
|
|
location = credentials["vertex_location"]
|
|
- if service_account_info:
|
|
+ if service_account_key:
|
|
|
|
+ service_account_info = json.loads(base64.b64decode(service_account_key))
|
|
service_accountSA = service_account.Credentials.from_service_account_info(service_account_info)
|
|
service_accountSA = service_account.Credentials.from_service_account_info(service_account_info)
|
|
aiplatform.init(credentials=service_accountSA, project=project_id, location=location)
|
|
aiplatform.init(credentials=service_accountSA, project=project_id, location=location)
|
|
else:
|
|
else:
|
|
@@ -100,10 +101,11 @@ class VertexAiTextEmbeddingModel(_CommonVertexAi, TextEmbeddingModel):
|
|
:return:
|
|
:return:
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
- service_account_info = json.loads(base64.b64decode(credentials["vertex_service_account_key"]))
|
|
+ service_account_key = credentials.get("vertex_service_account_key", "")
|
|
project_id = credentials["vertex_project_id"]
|
|
project_id = credentials["vertex_project_id"]
|
|
location = credentials["vertex_location"]
|
|
location = credentials["vertex_location"]
|
|
- if service_account_info:
|
|
+ if service_account_key:
|
|
|
|
+ service_account_info = json.loads(base64.b64decode(service_account_key))
|
|
service_accountSA = service_account.Credentials.from_service_account_info(service_account_info)
|
|
service_accountSA = service_account.Credentials.from_service_account_info(service_account_info)
|
|
aiplatform.init(credentials=service_accountSA, project=project_id, location=location)
|
|
aiplatform.init(credentials=service_accountSA, project=project_id, location=location)
|
|
else:
|
|
else:
|