blob: 814a4f0da67d6e7fdd95449cdcdb1e96c9c35e53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import sys
import os
def load_api_key():
config_file_path = os.path.join(os.path.expanduser("~"), ".config/openai.token")
api_key = os.getenv("OPENAI_API_KEY")
try:
with open(config_file_path, 'r') as file:
api_key = file.read()
except Exception:
pass
return api_key.strip()
def make_options():
options = {**vim.eval("options")}
options['request_timeout'] = float(options['request_timeout'])
options['temperature'] = float(options['temperature'])
options['max_tokens'] = int(options['max_tokens'])
return options
|