A Common Lisp LLM chat library
cl-chat
is available via ocicl. Install it like so:
$ ocicl install chat
The chat
package is comically small; containing just one class definition and one method. It simply maintains conversation state for completions
-based conversations.
In its simplest form, use:
(let ((c (make-instance 'chat)))
(say c "Tell me a joke"))
The default chat LLM is OpenAI, and requires that the OPENAI_API_KEY
environment variable be set. However, you can also create chats using any LLM supported by
the completions package. For instance:
(let ((c (make-instance 'chat :completer (make-instance 'completions:ollama-completer
:model "mistral:latest"))))
(say c "Tell me a joke"))
This repo also includes a web-chat interface. Run it like so:
$ sbcl --eval "(asdf:load-system :web-chat)" --eval "(web-chat:start-server)"
Related projects include:
- cl-completions an LLM completions library
- cl-embeddings an LLM embeddings library
- cl-chroma for a Lisp interface to the Chroma vector database.
cl-chat
was written by Anthony
Green and is distributed under the terms
of the MIT license.