rahgadda commited on
Commit
655ec99
·
verified ·
1 Parent(s): 8255f95

Initial Draft

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -179,14 +179,18 @@ def fn_create_chatllm(ui_llm_provider, ui_api_key, ui_model_details):
179
  )
180
  elif(ui_llm_provider == 'Google VertexAI'):
181
  lv_api_key = json.loads(ui_api_key)
182
- os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = lv_api_key['private_key_id']
 
 
 
 
183
  g_creds = service_account.Credentials.from_service_account_info(lv_api_key)
184
  lv_model = ChatVertexAI(
185
- project=lv_api_key.get("project_id"),
186
- temperature=1.0,
187
- model=ui_model_details,
188
- credentials=g_creds
189
- )
190
 
191
  print("Returning new model")
192
 
 
179
  )
180
  elif(ui_llm_provider == 'Google VertexAI'):
181
  lv_api_key = json.loads(ui_api_key)
182
+
183
+ with open('key.json', 'w') as f:
184
+ json.dump(lv_api_key, f)
185
+ os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'key.json'
186
+
187
  g_creds = service_account.Credentials.from_service_account_info(lv_api_key)
188
  lv_model = ChatVertexAI(
189
+ project=lv_api_key.get("project_id"),
190
+ temperature=1.0,
191
+ model=ui_model_details,
192
+ credentials=g_creds
193
+ )
194
 
195
  print("Returning new model")
196