s-kostyaev / ellama

Ellama is a tool for interacting with large language models from Emacs.
GNU General Public License v3.0
348 stars 25 forks source link

[BUG?] ellama fails with inscrutable error #123

Closed NightMachinery closed 3 weeks ago

NightMachinery commented 4 weeks ago

I get this error when I try to use ellama on a new installation of emacs. I can't really figure anything from this stacktrace ...

Debugger entered--Lisp error: (wrong-type-argument (or eieio-object cl-structure-object oclosure) nil)
  signal(wrong-type-argument ((or eieio-object cl-structure-object oclosure) nil))
  slot-value(nil type)
  plz-media-type-name(nil)
  plz-media-type-symbol(nil)
  plz-media-type--find(((text/event-stream . #<plz-event-source:text/event-stream plz-event-source:text/event-stream-15555dba951e>) (application/json . #<plz-media-type:application/json plz-media-type:application/json-155560118e60>) (application/octet-stream . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118e80>) (application/xml . #<plz-media-type:application/xml plz-media-type:application/xml-155560118e94>) (text/html . #<plz-media-type:text/html plz-media-type:text/html-155560118e98>) (text/xml . #<plz-media-type:text/xml plz-media-type:text/xml-155560118eac>) (t . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118eb0>)) nil)
  plz-media-type-of-response(((text/event-stream . #<plz-event-source:text/event-stream plz-event-source:text/event-stream-15555dba951e>) (application/json . #<plz-media-type:application/json plz-media-type:application/json-155560118e60>) (application/octet-stream . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118e80>) (application/xml . #<plz-media-type:application/xml plz-media-type:application/xml-155560118e94>) (text/html . #<plz-media-type:text/html plz-media-type:text/html-155560118e98>) (text/xml . #<plz-media-type:text/xml plz-media-type:text/xml-155560118eac>) (t . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118eb0>)) #s(plz-response :version 1.1 :status 200 :headers ((proxy-agent . "gost/2.11.5")) :body ""))
  plz-media-type-process-filter(#<process plz-request-curl> ((text/event-stream . #<plz-event-source:text/event-stream plz-event-source:text/event-stream-15555dba951e>) (application/json . #<plz-media-type:application/json plz-media-type:application/json-155560118e60>) (application/octet-stream . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118e80>) (application/xml . #<plz-media-type:application/xml plz-media-type:application/xml-155560118e94>) (text/html . #<plz-media-type:text/html plz-media-type:text/html-155560118e98>) (text/xml . #<plz-media-type:text/xml plz-media-type:text/xml-155560118eac>) (t . #<plz-media-type:application/octet-stream plz-media-type:application/octet-stream-155560118eb0>)) "Proxy-Agent: gost/2.11.5\15\n\15\n")
  #f(compiled-function (process chunk) #<bytecode -0x1b9a9e39f22edad4>)(#<process plz-request-curl> "Proxy-Agent: gost/2.11.5\15\n\15\n")
s-kostyaev commented 4 weeks ago

I will check it out. Plz in stack trace looks interesting. Maybe @ahyatt knows what it means?

ahyatt commented 3 weeks ago

plz is how we now do requests, which uses curl and actually parses to spec, instead of the pretty hacky things we were doing before.

@NightMachinery, can you share how you set up your provider, and what operation you are doing?

@r0man, in case he might know what's going on just from the stack trace.

r0man commented 3 weeks ago

Looks like a mismatch of the content type returned in the response and the registered one. I need more information. Which provider? Are you using a proxy? Can you somehow provide the response of this request? Is there a hidden plz buffer that contains the response?

r0man commented 3 weeks ago

@NightMachinery I had a closer look at the stacktrace (I was on mobile yesterday). It seems you were using a proxy (gost/2.11.5).

Could you please try to:

If this still does not work it would be good to get the response. I think you can find it in a hidden buffer called plz-request-xxxx where the x's are some random number.

r0man commented 3 weeks ago

So, I just tried the gost proxy locally with Ollama/OpenAI, and it seems to work with the changes in the main branch of llm. @ahyatt Let's cut a 16.1 release with the proxy changes?

NightMachinery commented 3 weeks ago

Evaluating these two files indeed solved the issue!


More info:

Here is the registered provider ellama-provider:

#s(llm-openai-compatible nil nil nil "REDACTED" "llama3-70b-8192" "llama3-70b-8192" "https://api.groq.com/openai/v1")
r0man commented 3 weeks ago

Hi @NightMachinery, ok perfect. Thanks for reporting back. Let's wait for @ahyatt to cut a release, then this should be resolved. To switch to hidden/invisible buffers, see https://www.emacswiki.org/emacs/InvisibleBuffers . But we don't need this now.

s-kostyaev commented 3 weeks ago

Closing this as issue resolved in new release of llm. @ahyatt thank you for calling for @r0man @r0man thank you for fixing issue @NightMachinery Thank you for report