s-kostyaev / ellama

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

Merge duplicate code #29

Closed Stebalien closed 7 months ago

Stebalien commented 7 months ago

ellama-stream, ellama-stream-filter, and ellama-chat were mostly identical so I merged their implementations as much as possible.

ellama-stream now supports:

  1. A :filter keyword argument for filtering responses.
  2. A :session keyword argument specifying whether or not the prompt should extend an ongoing session or be a one-off request.
  3. A :on-errorkeyword argument for specifying an "error" callback.
  4. A :on-donekeyword argument for specifying a "done" callback.

Built on #28.

Stebalien commented 7 months ago

Motivation: When implementing https://github.com/s-kostyaev/ellama/pull/31, I didn't want to repeat the same code three times.

Stebalien commented 7 months ago

Warning: I believe this is correct, bug I haven't thoroughly tested it.

s-kostyaev commented 7 months ago

@Stebalien thank you. Improve ellama-stream docstring and I will merge it.

s-kostyaev commented 7 months ago

@Stebalien please fix CI warnings

s-kostyaev commented 7 months ago

@Stebalien there are some more warnings. And also, change done callback to be called with generated text as an argument - it will be useful with other use cases too.

Stebalien commented 7 months ago

Done and done.

s-kostyaev commented 7 months ago

@Stebalien Thank you