Undefined variable: script_language
I'm trying to use neural using a local model that supports OpenAI compatible API. I get this error when I try :Neural hello or any other query/neural command:
Invalid provider:
Error detected while processing function neural#Prompt[15]..neural#Run[15]..neural#GetCommand[2]..<SNR>82_GetScriptExecutable:
line 1:
E121: Undefined variable: script_language
Error detected while processing function neural#Prompt[15]..neural#Run:
line 15:
E714: List required
Press ENTER or type command to continue
This is the vim version:
$ vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Apr 01 2025 20:12:31)
Included patches: 1-16, 647, 678, 697
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm +tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
+balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
+browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand +perl +title
+channel +ipv6 +persistent_undo +toolbar
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap +ruby +wildignore
+cursorbind +lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con_gui +mksession +smartindent +writebackup
+diff +modify_fname +sodium +X11
+digraphs +mouse +sound +xattr
+dnd +mouseshape +spell -xfontset
-ebcdic +mouse_dec +startuptime +xim
+emacs_tags +mouse_gpm +statusline -xpm
+eval -mouse_jsbterm -sun_workshop +xsmp_interact
+ex_extra +mouse_netterm +syntax +xterm_clipboard
+extra_search +mouse_sgr +tag_binary -xterm_save
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "/etc/vim/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "/etc/vim/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/webp -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -pthread -Wdate-time -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/vim-AkQQan/vim-9.1.0016=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/vim-AkQQan/vim-9.1.0016=/usr/src/vim-2:9.1.0016-1ubuntu7.8 -DSYS_VIMRC_FILE=\"/etc/vim/vimrc\" -DSYS_GVIMRC_FILE=\"/etc/vim/gvimrc\" -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-E -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -lcanberra -lsodium -lacl -lattr -lgpm -L/usr/lib -llua5.1 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.38/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.12/config-3.12-x86_64-linux-gnu -lpython3.12 -ldl -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-3.2 -lm -lpthread -L/usr/lib
I tried changing the GetScriptExecutable function to always return python3 :D but unfortunately that just causes more errors like:
Invalid provider:
Error detected while processing function neural#Prompt[15]..neural#Run[15]..neural#GetCommand:
line 3:
E121: Undefined variable: script
E116: Invalid arguments for function neural#Escape(l:provider.script)
Error detected while processing function neural#Prompt[15]..neural#Run:
line 15:
E714: List required
Not sure what I'm doing wrong. Probably a lot.
Oh also, my vimrc has this: (changed the ip for privacy)
let g:neural = {
\ 'providers': [
\ {
\ 'openai': {
\ 'url': 'http://x.x.x.x:8000/v1',
\ 'api_key': '',
\ },
\ },
\ ],
\}
I tried removing v1 but that didnt work either, then again, I'm not sure that it's even getting near to using the url yet
I wanted to try out Neural and ran into this issue as well. After some debugging I set the default here:
https://github.com/dense-analysis/neural/blob/41bc347ff0a4104fe8531d6daea51d0155542789/autoload/neural.vim#L240 to openai. Not sure where type is supposed to be set...
Then I ran into an issue with the wrong config being passed to Python via (JSON) which was {'openai: {'url'...} instead of just {'url': ...}.
There is definitely some confusion in configuring the providers from the get go. The docs state that only the first one is currently used? If that is the case, can it be something other than openai (answer = no).
It appears to be working now with my local patches.
Thanks for working on this plugin! :)
I'm not entirely sure if it is the intended way, but it worked for me with a config like this:
let g:neural = {
\ 'providers': [
\ {
\ 'type': 'openai',
\ 'url': 'http://x.x.x.x:11434',
\ 'model': 'qwen3-coder:30b',
\ },
\ ],
\}