mirror of
https://github.com/Hopiu/llm.git
synced 2026-03-31 20:00:23 +00:00
Suppress some warnings
This commit is contained in:
parent
229a82dd0f
commit
fa99b6c340
1 changed files with 5 additions and 1 deletions
|
|
@ -5,6 +5,9 @@ import openai
|
|||
import os
|
||||
import sqlite_utils
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
warnings.simplefilter("ignore", ResourceWarning)
|
||||
|
||||
CODE_SYSTEM_PROMPT = """
|
||||
You are a code generating tool. Return just the code, with no explanation
|
||||
|
|
@ -90,7 +93,8 @@ def get_openai_api_key():
|
|||
path = os.path.expanduser("~/.openai-api-key.txt")
|
||||
# If the file exists, read it
|
||||
if os.path.exists(path):
|
||||
return open(path).read().strip()
|
||||
with open(path) as fp:
|
||||
return fp.read().strip()
|
||||
raise click.ClickException(
|
||||
"No OpenAI API key found. Set OPENAI_API_KEY environment variable or create ~/.openai-api-key.txt"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue