|
|
|
@@ -48,7 +48,7 @@ def set_api_key(): |
|
|
|
req["api_key"], llm.llm_name, base_url=req.get("base_url"))
|
|
|
|
try:
|
|
|
|
arr, tc = mdl.encode(["Test if the api key is available"])
|
|
|
|
if len(arr[0]) == 0 or tc == 0:
|
|
|
|
if len(arr[0]) == 0:
|
|
|
|
raise Exception("Fail")
|
|
|
|
embd_passed = True
|
|
|
|
except Exception as e:
|
|
|
|
@@ -59,7 +59,7 @@ def set_api_key(): |
|
|
|
try:
|
|
|
|
m, tc = mdl.chat(None, [{"role": "user", "content": "Hello! How are you doing!"}],
|
|
|
|
{"temperature": 0.9,'max_tokens':50})
|
|
|
|
if not tc:
|
|
|
|
if m.find("**ERROR**") >=0:
|
|
|
|
raise Exception(m)
|
|
|
|
except Exception as e:
|
|
|
|
msg += f"\nFail to access model({llm.llm_name}) using this api key." + str(
|