ahyatt / ekg

The emacs knowledge graph, app for notes and structured data.
GNU General Public License v3.0
230 stars 19 forks source link

[BUG] llm-prompt-fill: Wrong type argument: number-or-marker-p on ekg-llm-query-with-notes #159

Closed oatmealm closed 4 months ago

oatmealm commented 4 months ago

1stly, wow. ekg is exactly what I didn't know I needed :) really love the modularity and considered design, and integration with llm in this particular way seems very intentional and useful. Thank you for writing this package!


This seem to happen when calling ekg-llm-query-with-notes:

Embedding generation with this provider seem to work...

Generating 20 embeddings
Generated 4/4 (100% done)
Generated 10/20 (50% done)
Generated 20/20 (100% done)
Refreshed 17 tags
Refreshed 17 tags
Refreshed 17 tags

the notes are very short.

(after! ekg
  (setq ekg-capture-default-mode 'markdown-mode)
  (setq ekg-llm-provider
        (make-llm-ollama
         :host "10.0.0.56"
         :chat-model "gemma2:9b-instruct-q6_K"
         :embedding-model "jina/jina-embeddings-v2-base-es:latest"))
  (setq ekg-embedding-provider
        (make-llm-ollama
         :host "10.0.0.56"
         :chat-model "gemma2:9b-instruct-q6_K"
         :embedding-model "jina/jina-embeddings-v2-base-es:latest")))

Trace:

Debugger entered: nil
  edebug--display-1((error "Marker does not point anywhere") 0 error)
  edebug--display((error "Marker does not point anywhere") 0 error)
  edebug(error (error "Marker does not point anywhere"))
  edebug-signal(error ("Marker does not point anywhere"))
  edebug--display-1(nil 0 before)
  edebug--display(nil 0 before)
  edebug-debugger(0 before nil)
  edebug-before(0)
  (edebug-after (edebug-before 0) 37 (let ((buf (edebug-after (edebug-before 1) 7 (get-buffer-create (edebug-after (edebug-before 2) 6 (format "*ekg llm query '%s'*" ...)))))) (edebug-after (edebug-before 8) 33 (save-current-buffer (set-buffer (edebug-after 0 9 buf)) (edebug-after (edebug-before 10) 11 (erase-buffer)) (edebug-after (edebug-before 12) 32 (let ((prompt ...)) (edebug-after (edebug-before 22) 31 (condition-case nil ... ...)))))) (edebug-after (edebug-before 34) 36 (pop-to-buffer (edebug-after 0 35 buf)))))
  (closure ((query . "ekg-llm-query-with-notes")) nil (edebug-after (edebug-before 0) 37 (let ((buf (edebug-after (edebug-before 1) 7 (get-buffer-create (edebug-after ... 6 ...))))) (edebug-after (edebug-before 8) 33 (save-current-buffer (set-buffer (edebug-after 0 9 buf)) (edebug-after (edebug-before 10) 11 (erase-buffer)) (edebug-after (edebug-before 12) 32 (let (...) (edebug-after ... 31 ...))))) (edebug-after (edebug-before 34) 36 (pop-to-buffer (edebug-after 0 35 buf))))))()
  edebug-default-enter(ekg-llm-query-with-notes ("ekg-llm-query-with-notes") (closure ((query . "ekg-llm-query-with-notes")) nil (edebug-after (edebug-before 0) 37 (let ((buf (edebug-after (edebug-before 1) 7 (get-buffer-create ...)))) (edebug-after (edebug-before 8) 33 (save-current-buffer (set-buffer (edebug-after 0 9 buf)) (edebug-after (edebug-before 10) 11 (erase-buffer)) (edebug-after (edebug-before 12) 32 (let ... ...)))) (edebug-after (edebug-before 34) 36 (pop-to-buffer (edebug-after 0 35 buf)))))))
  edebug-default-enter(ekg-llm-query-with-notes ("ekg-llm-query-with-notes") (closure ((query . "ekg-llm-query-with-notes")) nil (edebug-after (edebug-before 0) 37 (let ((buf (edebug-after (edebug-before 1) 7 (get-buffer-create ...)))) (edebug-after (edebug-before 8) 33 (save-current-buffer (set-buffer (edebug-after 0 9 buf)) (edebug-after (edebug-before 10) 11 (erase-buffer)) (edebug-after (edebug-before 12) 32 (let ... ...)))) (edebug-after (edebug-before 34) 36 (pop-to-buffer (edebug-after 0 35 buf)))))))
  edebug-enter(ekg-llm-query-with-notes ("ekg-llm-query-with-notes") (closure ((query . "ekg-llm-query-with-notes")) nil (edebug-after (edebug-before 0) 37 (let ((buf (edebug-after (edebug-before 1) 7 (get-buffer-create ...)))) (edebug-after (edebug-before 8) 33 (save-current-buffer (set-buffer (edebug-after 0 9 buf)) (edebug-after (edebug-before 10) 11 (erase-buffer)) (edebug-after (edebug-before 12) 32 (let ... ...)))) (edebug-after (edebug-before 34) 36 (pop-to-buffer (edebug-after 0 35 buf)))))))
  ekg-llm-query-with-notes("ekg-llm-query-with-notes")
  funcall-interactively(ekg-llm-query-with-notes "ekg-llm-query-with-notes")
  command-execute(ekg-llm-query-with-notes record)
  execute-extended-command(nil "ekg-llm-query-with-notes" nil)
  funcall-interactively(execute-extended-command nil "ekg-llm-query-with-notes" nil)
  command-execute(execute-extended-command)
oatmealm commented 4 months ago

I tested it with an openai compatible provider and it seems to work. Embedding still done via ollama. So something about the above setup is not working with ollama.

ahyatt commented 4 months ago

Thanks for the report, I'll look into this soon.

ahyatt commented 4 months ago

I wasn't able to reproduce exactly your problem, but I did reproduce a problem, which is fixed with https://github.com/ahyatt/llm/pull/54. I haven't made this into an llm release yet, but can you verify (or not) the fix?

ahyatt commented 4 months ago

@oatmealm I think you confirmed in https://github.com/ahyatt/ekg/discussions/150#discussioncomment-10165834 that this is working for you now, so I will close this and release a new version of llm soon.

oatmealm commented 4 months ago

Sorry commented on the other issue. Yes. Seems to work. Thanks.