_ChemCrow / utils.py
doncamilom's picture
rm print
ebba07f
raw
history blame contribute delete
257 Bytes
from langchain.llms import OpenAI
def oai_key_isvalid(api_key):
"""Check if a given OpenAI key is valid"""
try:
llm = OpenAI(openai_api_key = api_key)
out = llm("This is a test")
return True
except:
return False