Initial Draft
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
183 |
g_creds = service_account.Credentials.from_service_account_info(lv_api_key)
|
184 |
lv_model = ChatVertexAI(
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
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 |
|