diff options
| author | Martin Bielik <mx.bielik@gmail.com> | 2023-03-22 22:14:25 +0100 |
|---|---|---|
| committer | Martin Bielik <mx.bielik@gmail.com> | 2023-03-22 22:14:25 +0100 |
| commit | 08036fb76c437b705d916708d903c7c6c2eef0ba (patch) | |
| tree | f8d1c4f3f652c13c265d2f75e104f3b3907c4551 /py/chat.py | |
| parent | 9b707d99b106c6535e476f00095053b470428bcc (diff) | |
| download | vim-ai-08036fb76c437b705d916708d903c7c6c2eef0ba.tar.gz | |
completion configuration
Diffstat (limited to 'py/chat.py')
| -rw-r--r-- | py/chat.py | 15 |
1 files changed, 4 insertions, 11 deletions
@@ -4,11 +4,11 @@ import openai plugin_root = vim.eval("s:plugin_root") vim.command(f"py3file {plugin_root}/py/utils.py") -openai.api_key = load_api_key() - -options = vim.eval("options") +options = make_options() file_content = vim.eval('trim(join(getline(1, "$"), "\n"))') +openai.api_key = load_api_key() + lines = file_content.splitlines() messages = [] @@ -38,14 +38,7 @@ try: print('Answering...') vim.command("redraw") - response = openai.ChatCompletion.create( - messages=messages, - stream=True, - model=options['model'], - max_tokens=int(options['max_tokens']), - temperature=float(options['temperature']), - request_timeout=float(options['request_timeout']), - ) + response = openai.ChatCompletion.create(messages=messages, stream=True, **options) generating_text = False for resp in response: |