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

Restoring Ollama state correctly #181

Closed
karthink opened this issue Jan 16, 2024 · 5 comments
Closed

Restoring Ollama state correctly #181

karthink opened this issue Jan 16, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@karthink
Copy link
Owner

karthink commented Jan 16, 2024

The state of Ollama chats cannot be restored accurately since we are not (presently) storing the chat embedding vector the API returns. Storing this is simple, but this vector tends to be large, and will cause two issues with Emacs:

  1. The buffer size will increase by a factor of 2 when saved to disk.
  2. It will be stored as a string on a single logical line, and will trigger Emacs' long lines issues.

The option of storing it separately in a data file (ASCII or binary) is off the table: one gptel's objectives is to produce self-contained, single file chats that are portable and reproducible modulo pinning the Emacs+gptel version. (And we try very hard to stay backward compatible so the pinning isn't necessary.)

@karthink karthink added the enhancement New feature or request label Jan 16, 2024
@luyangliuable
Copy link

Is this why we get the Ollama error (nil): Malformed JSON in response. error whenever we receive a response from ollama?

@karthink
Copy link
Owner Author

karthink commented Feb 10, 2024 via email

@luyangliuable
Copy link

luyangliuable commented Feb 11, 2024

I get the the error when I run gptel-send with the following configurations. It also takes 10 minutes before the response arrives. I also got Response Error: nil sometimes.

image
(setq-default gptel-model "mistral:latest" ;Pick your default model
                   gptel-backend (gptel-make-ollama "Ollama"
                                   :host "localhost:11434"
                                   :stream t
                                   :models '("mistral")))
  • gptel-curl:
{"model":"mistral:latest","created_at":"2024-02-10T22:43:58.789276Z","response":"","done":true,"total_duration":417571583,"load_duration":417073333}
(8d87d74a71c4ad1eb816d1778ae4e5db . 120)

  • gptel-log:
{
  "gptel": "request body",
  "timestamp": "2024-02-11 11:13:45"
}
  {
  "model": "mistral",
  "system": "You are a large language model living in Emacs and a helpful assistant. Respond concisely.",
  "prompt": "Test",
  "stream": true
}

ollama server is also active and ollama run mistral works normally.
image

@zk395
Copy link

zk395 commented Apr 28, 2024

I wasn't aware of this issue so I tried to load Ollama saved state and with the new prompt it basically ignored all the previous context - I guess this is why? Is there any progress on this, or some kind of workaround I could use?

@karthink
Copy link
Owner Author

karthink commented Apr 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants