Hugging Face
Models
Datasets
Spaces
Posts
Docs
Enterprise
Pricing
Log In
Sign Up
Spaces:
Duplicated from
doncamilom/_ChemCrow
doncamilom
/
ChemCrow
like
7
Runtime error
App
Files
Files
Community
2
ebba07f
ChemCrow
/
utils.py
doncamilom
rm print
ebba07f
4 months ago
raw
Copy download link
history
blame
Safe
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