karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.03k stars 111 forks source link

Error with the local LLM scripts in init file #307

Closed Ypot closed 1 month ago

Ypot commented 1 month ago

Hi

I have added some scripts to my init file, to use local LLM. Something extrange is happening: I receive an error because of them, when I start emacs (if I comment them, I receive no error). But, if after emacs is running I eval them, one after the other, I receive no error. And init file at complete doesn't send any error.

The error message: ■ Warning (initialization): An error occurred while loading ‘c:/Users/user/AppData/Roaming/.emacs.d/init.el’:

Symbol's value as variable is void: gptel--known-backends

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the ‘--debug-init’ option to view a complete error backtrace.

The scripts: (gptel-make-ollama "Ollama" ;Any name of your choosing :host "localhost:11434" ;Where it's running :stream t ;Stream responses :models '("llama3" "mistral" "phi3"))

(gptel-make-gpt4all "GPT4All" ;Name of your choosing :protocol "http" :host "localhost:4891" ;Where it's running :models '("Meta-Llama-3-8B-Instruct.Q4_0.gguf"))

karthink commented 1 month ago

How are you calling these? Are they inside a use-package form? If so please provide the full form.

Ypot commented 1 month ago

Hi.

I mark them and I eval the region. What you see is what I eval.

karthink commented 1 month ago

I mark them and I eval the region. What you see is what I eval.

I mean, how is it placed in your init file, relative to the rest of your gptel configuration?

Ypot commented 1 month ago

First I added it just below chatgpt API key. Then, I tried moving it to the last part of the init file, with the same error.

karthink commented 1 month ago

Should be fixed now, please test.

Ypot commented 1 month ago

Fixed! Thanks