Duplicated from doncamilom/_ChemCrow
167e68e
1
2
3
4
5
6
7
8
9
10
11
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