emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add plz-media-type and plz-event-source to GNU ELPA when stabilized


From: Roman Scherer
Subject: Add plz-media-type and plz-event-source to GNU ELPA when stabilized
Date: Sat, 27 Apr 2024 11:02:44 +0200
User-agent: mu4e 1.12.4; emacs 29.3

Hello Emacs Developers,

I am writing you to ask if we could include the ~plz-media-type~ [1]
and the ~plz-event-source~ [2] libraries to GNU ELPA, once Andrew
Hyatt and I declare them as releasable.

At the moment those 2 libraries are "vendored" (we copied 2 files) in
the llm [3] library. Andrew and I would like to ship them via the llm
library to users for now, and once we are confident there are no
serious issues we would like to release them to GNU ELPA. We plan to
do so in Q4 of 2024.

These libraries are designed to handle HTTP responses based on the
content type header and process the response in a way specific to the
media type. One example of this is to process a HTTP response in the
text/event-stream format (aka server sent events) and handle the
events as they arrive.

Both libraries use Adam Porter's plz library and I wrote them to
support Andrew Hyatt in his work on the llm library. We are planning
to add support to the llm library to make HTTP requests with
curl. This should solve reliability issues that Andrew saw, and allows
me to use the llm library with LLMs that sit behind the proxy of my
employer, who supported my work on this.

They also simplified the code in the llm library that handles the
various response formats that are in use by all those LLMs deployed
out there. The libraries are designed to be extendable and could be
used by Emacs packages that, as of today, implement their own way to
handle for example, server sent events in a streaming way.

*plz-media-type:*

This library builds upon the ~plz.el~ HTTP library and provides a
mechanism to process responses based on their content type headers. It
defines classes for parsing and processing the HTTP body of some
standard MIME types like JSON, XML, HTML. It also contains classes
that can handle formats like newline delimited JSON, or JSON arrays in
a streaming way. Those last formats are often used by LLMs. The
library is designed to be extendable (you can replace and bring your
own media type class) and frees users from writing their own process
filter functions.

*plz-event-source:*

This library provides a media type class, parser, and event source
implementation for the Server-Sent Events (SSE) protocol. The media
type class can be used with the ~plz-media-type~ library. We use it in
the llm library to process HTTP responses for LLMs that return a MIME
type of text/event-stream.

I won't spend any significant time on re-designing the API (we went
through many iterations) or making it compatible with url-retrieve
right now, in case someone is suggesting this. This project was partly
sponsored by my employer while I was on a 3 month working group and we
want to use the llm library with curl. My time on this is reaching an
end I would like to bring it over the finish line. I am committed to
support Andrew should any bugs or significant issues come up.

Andrew Hyatt asked me to write to you to get the green light for
publishing those libraries to GNU ELPA, once we think they are
stable. We plan to do this in about half a year.

If you agree on eventually releasing those libraries to GNU ELPA, we
plan to merge the "plz" branch of the llm library into master soon and
release it to a wider audience. One package that would immediately
benefit is Ellama [4] which I thoroughly tested while working on this.

My employer and I already did the copyright assignment paperwork,
which has been completed a month ago.

Wdyt?

Thanks, Roman.

[1] https://github.com/r0man/plz-media-type
[2] https://github.com/r0man/plz-event-source
[3] https://github.com/ahyatt/llm/tree/plz
[4] https://github.com/s-kostyaev/ellama

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]