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

Wrong type argument: ellama-session, nil #85

Open mberrueta opened 4 months ago

mberrueta commented 4 months ago

Hello! im using emacs 29 on linux GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2024-02-27 (With doom if Mathers)

Im running Ollama with docker (im able to call by curl without any problem)

HTTP POST http://localhost:11434/api/generate Headers:[((Content-Type . application/json))] Body:[{
  "model": "zephyr",
  "stream": false,
  "prompt": "Why is the sky blue?"
}]

I didn't set any config. So if I run

It seems that there are wrong init things?

 head ellama.el
;;; ellama.el --- Tool for interacting with LLMs -*- lexical-binding: t -*-

;; Copyright (C) 2023  Free Software Foundation, Inc.

;; Author: Sergey Kostyaev <sskostyaev@gmail.com>
;; URL: http://github.com/s-kostyaev/ellama
;; Keywords: help local tools
;; Package-Requires: ((emacs "28.1") (llm "0.6.0") (spinner "1.7.4") (dash "2.19.1"))
;; Version: 0.8.10
;; SPDX-License-Identifier: GPL-3.0-or-later
mberrueta commented 4 months ago

btw, removed the package install from doom, and installed manually

so version

;;; ellama.el --- Tool for interacting with LLMs -*- lexical-binding: t -*-

;; Copyright (C) 2023  Free Software Foundation, Inc.

;; Author: Sergey Kostyaev <sskostyaev@gmail.com>
;; URL: http://github.com/s-kostyaev/ellama
;; Keywords: help local tools
;; Package-Requires: ((emacs "28.1") (llm "0.6.0") (spinner "1.7.4") (dash "2.19.1"))
;; Version: 0.8.10
;; SPDX-License-Identifier: GPL-3.0-or-later
;; Created: 8th Oct 2023

and run:

but after restart emacs im not able to call llama any more. (still appear as installed, but the command is not available)

mberrueta commented 4 months ago
  ellama                         20240225.1803  installed             Tool for interacting with LLMs
  dash                           20240103.1301  dependency            A modern list library for Emacs
  llm                            0.9.1          dependency            Interface to pluggable llm backends
  spinner                        1.7.4          dependency            Add spinners and progress-bars to the mode-line for ongoing operations
s-kostyaev commented 4 months ago

Hi @mberrueta

Try to M-x toggle-debug-on-error and reproduce an error. And paste debugger output here.

mberrueta commented 3 months ago

not sure why I dint get GH notifications, sorry man

is a emacs on the terminal btw, headless linux

  signal(wrong-type-argument (ellama-session nil))
  (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session)))
  (progn (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 1))
  (ellama-get-session-buffer (progn (or (progn (and (memq (type-of session) cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 1)))
  (let* ((providers (append (list '("default model" . ellama-provider) (if (and ellama-ollama-binary (file-exists-p ellama-ollama-binary)) '("ollama model" ellama-get-ollama-local-model))) ellama-providers)) (variants (mapcar #'car providers)) (provider (if current-prefix-arg (eval (alist-get (completing-read "Select model: " variants) providers nil nil #'string=)) (or (plist-get args :provider) ellama-provider))) (session (if (or create-session current-prefix-arg (and (not ellama--current-session) (not ellama--current-session-id))) (ellama-new-session provider prompt) (or ellama--current-session (save-current-buffer (set-buffer (ellama-get-session-buffer ellama--current-session-id)) ellama--current-session)))) (buffer (ellama-get-session-buffer (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... session))) (aref session 1)))) (file-name (progn (or (progn (and (memq ... cl-struct-ellama-session-tags) t)) (signal 'wrong-type-argument (list 'ellama-session session))) (aref session 3))) (translation-buffer (if ellama-chat-translation-enabled (progn (if file-name (progn (find-file-noselect ...)) (get-buffer-create (progn ... ...))))))) (if ellama-chat-translation-enabled (ellama--translate-interaction prompt translation-buffer buffer session) (display-buffer buffer) (save-current-buffer (set-buffer buffer) (save-excursion (goto-char (point-max)) (insert (ellama-get-nick-prefix-for-mode) " " ellama-user-nick ":\n" (ellama--format-context session) prompt "\n\n" (ellama-get-nick-prefix-for-mode) " " ellama-assistant-nick ":\n") (ellama-stream prompt :session session :on-done #'ellama-chat-done :filter (if (derived-mode-p 'org-mode) (progn #'ellama--translate-markdown-to-org-filter)))))))
  ellama-chat("why the sky is blue")
  funcall-interactively(ellama-chat "why the sky is blue")
  command-execute(ellama-chat record)
  execute-extended-command(nil "ellama-chat" nil)
  funcall-interactively(execute-extended-command nil "ellama-chat" nil)
  command-execute(execute-extended-command)
s-kostyaev commented 5 days ago

@mberrueta Unfortunately I have no idea what's the reason of this issue. Can you still reproduce it?