Spaces:
Paused
Paused
Download utils.py from doncamilom/_ChemCrow: direct link, hf CLI and curl.
- Browser
- Download file 257 Bytes
-
https://huggingface.co/spaces/doncamilom/_ChemCrow/resolve/main/utils.py
- Command line
-
hf download hf://spaces/doncamilom/_ChemCrow/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/doncamilom/_ChemCrow/resolve/main/utils.py
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 | |