summaryrefslogtreecommitdiff
path: root/py/complete.py
blob: c37cbd006ea30903d32c23aed8c21f6dbd6ccef9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import openai

# import utils
plugin_root = vim.eval("s:plugin_root")
vim.command(f"py3file {plugin_root}/py/utils.py")

prompt = vim.eval("prompt")

openai.api_key = load_api_key()

response = openai.Completion.create(
    model="text-davinci-003",
    prompt=prompt,
    max_tokens=1000,
    temperature=0.1
)

output = response['choices'][0]['text']