Skip to content

Commit 744862b

Browse files
authored
Merge pull request #204 from mxcoder/NOTASK-optional-google-key
NOTASK Make google key file optional, SDK will use credentials chain
2 parents 5f89da9 + 1829046 commit 744862b

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

factgenie/models.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -596,21 +596,18 @@ def __init__(self, config):
596596
def load_google_credentials(self):
597597
json_file_path = os.environ.get("VERTEXAI_JSON_FULL_PATH")
598598

599-
if not json_file_path:
600-
raise ValueError(
601-
"Please set VERTEXAI_JSON_FULL_PATH in your environment or in the config. For more details, see https://docs.litellm.ai/docs/providers/vertex"
602-
)
603-
604-
# check if file exists
605-
if not os.path.exists(json_file_path):
606-
raise ValueError(f"The file {json_file_path} was not found.")
607-
608-
# Load the JSON file
609-
with open(json_file_path, "r") as file:
610-
vertex_credentials = json.load(file)
611-
612-
# Convert to JSON string
613-
self.vertex_credentials_json = json.dumps(vertex_credentials)
599+
if json_file_path:
600+
if not os.path.exists(json_file_path):
601+
raise ValueError(
602+
"File not found in VERTEXAI_JSON_FULL_PATH. For more details, see https://docs.litellm.ai/docs/providers/vertex"
603+
)
604+
605+
# Load the JSON file
606+
with open(json_file_path, "r") as file:
607+
vertex_credentials = json.load(file)
608+
609+
# Convert to JSON string
610+
self.vertex_credentials_json = json.dumps(vertex_credentials)
614611

615612
def get_model_response(self, messages, model_service):
616613
response = litellm.completion(

0 commit comments

Comments
 (0)