Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest commit d9edbbc seems broken "gptel--stream-convert-markdown->org is void" #694

Open
wlauppe opened this issue Mar 12, 2025 · 11 comments · May be fixed by #698
Open

Latest commit d9edbbc seems broken "gptel--stream-convert-markdown->org is void" #694

wlauppe opened this issue Mar 12, 2025 · 11 comments · May be fixed by #698
Labels
bug Something isn't working

Comments

@wlauppe
Copy link

wlauppe commented Mar 12, 2025

Bug Description

While running commit d9edbbc i get the following message in the messages bufffer

gptel-curl-get-response: Symbol’s function definition is void: gptel--stream-convert-markdown->org

the last commit i was on 8889e27, works fine

Steps to Reproduce

execute gptel in an orgmode buffer

@wlauppe wlauppe added the bug Something isn't working label Mar 12, 2025
@pabl0
Copy link
Contributor

pabl0 commented Mar 12, 2025

Can't reproduce here, but 7400df6 does indeed drop loading gptel-org.el using with-eval-after-load ("since we require it anyway when sending commands").

Can you provide more details how to reproduce (emacs version, etc)?

@wlauppe
Copy link
Author

wlauppe commented Mar 12, 2025

Hello:
i use the master branch, from the emacs source
https://git.savannah.gnu.org/cgit/emacs.git/

Emacs version: "31.0.50"
OS: ubuntu linux

@wlauppe
Copy link
Author

wlauppe commented Mar 12, 2025

@pabl0 thanks for triaging the commits. I can confirm that the problem started with commit:
7400df6
the parent commit
aef57c2
works fine

@pabl0
Copy link
Contributor

pabl0 commented Mar 12, 2025

Can you provide the exact steps how to reproduce? Can you try with emacs -q?

If I run a new fresh emacs session with emacs foo.org and run M-x gptel-send, with d9edbbc it works fine for me.

@karthink
Copy link
Owner

@wlauppe do you have specific instructions on reproducing this?

After 7400df6 this can indeed happen, but under very special conditions. (By calling gptel-request directly with a string as the prompt while you're in an Org mode buffer, for example.)

I'm curious about how you triggered them.

Alternatively, you might just need to rebuild/reinstall gptel if there are some byte-compilation order issues.

@wlauppe
Copy link
Author

wlauppe commented Mar 12, 2025

@wlauppe do you have specific instructions on reproducing this?

  1. start emacs
  2. open a new file: foo.org
  3. ensure that you have a model with streaming chosen, for example
(gptel-make-anthropic "Claude"
  :stream t :key gptel-api-key)

in the .emacs config and
M-x gptel-menu -> -m -> Claude:claude-3-5-sonnet-20241

  1. write a new line in foo.org
    * count from 1 to 10
  2. select as region the text "count from 1 to 10"
  3. press "M-x gptel-send"
  4. watch the Messages Buffer

you will see the line

gptel-curl-get-response: Symbol’s function definition is void: gptel--stream-convert-markdown->org

@pabl0
Copy link
Contributor

pabl0 commented Mar 12, 2025

OK I am able to reproduce with Github:deepseek-r1 and Github:gpt-4o and I have a proposed fix.

pabl0 added a commit to pabl0/gptel that referenced this issue Mar 12, 2025
…nk#694)

* gptel-curl.el (gptel-curl-get-response): Require `gptel-org' for
`gptel--stream-convert-markdown->org'.
* gptel.el (gptel--url-get-response): Likewise for the url
implementation.
@karthink
Copy link
Owner

To solve this, I first need to answer a question I could use your feedback on:

If I select a region in Org mode and send it, should it be subject to the same processing as regular non-region gptel-send? This includes respecting gptel-org-branching-context and stripping property drawers and other elements according to gptel-org-ignore-elements.

If sending regions does respect these settings, there is no way to send a literal region in Org mode without turning off these settings first. On the other hand, if it always sends the region literally, this might not be what you want when you select a portion of an Org buffer.

What is your expectation?

@karthink
Copy link
Owner

@wlauppe While I decide between the two possible fixes, you can avoid this error by running (require 'gptel-org).

@wlauppe
Copy link
Author

wlauppe commented Mar 13, 2025

To solve this, I first need to answer a question I could use your feedback on:

If I select a region in Org mode and send it, should it be subject to the same processing as regular non-region gptel-send? This includes respecting gptel-org-branching-context and stripping property drawers and other elements according to gptel-org-ignore-elements.

If sending regions does respect these settings, there is no way to send a literal region in Org mode without turning off these settings first. On the other hand, if it always sends the region literally, this might not be what you want when you select a portion of an Org buffer.

What is your expectation?

Simpler is better. I didnt even know there are 3 modes. Until now i assumed there is the chat mode called "gptel-mode" and normal mode.

Im not using gptel-branching, so im maybe im not qualified to answer.
in fact, i only use region-gptel and dedicated-buffer-chat-gptel-mode

You hesitate, so you see some arguments in favour of the distinction? What are they?

I think it is easier for the users, if there are not too many different behaviours. Otherwise the bugs increase, because the edge cases are not tested well enough, or gptel behaviour is simply confusing, especially for newer users.

if you decide on not unifying the behaviour this should be made explicit in the documentation

from the README:

* Usage 
...
** In Any buffer 
...
2. If a region is selected, the conversation will be limited to its contents.

If there is more happening it should be documented there.

@karthink
Copy link
Owner

Simpler is better. I didnt even know there are 3 modes. Until now i assumed there is the chat mode called "gptel-mode" and normal mode.

The question is what "simpler" means. In this screenshot with a selected region

Image

Should the PROPERTIES block be removed when sending the region? It is removed when calling gptel-send without the region active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants