llm  by ahyatt

Emacs package for LLM interaction, abstracting model choice

Created 2 years ago
368 stars

Top 76.7% on SourcePulse

GitHubView on GitHub
Project Summary

This Emacs Lisp package provides a unified interface for interacting with various Large Language Models (LLMs), abstracting away differences between providers like OpenAI, Azure, Gemini, Claude, and local models via Ollama or llama.cpp. It enables Emacs users to leverage LLMs for chat, tool use, and embeddings, offering flexibility in choosing between paid APIs and free local models.

How It Works

The library uses a provider-based architecture where specific modules (e.g., llm-openai, llm-ollama) create provider objects that abstract LLM interactions. These providers handle features like chat (synchronous, asynchronous, streaming), multi-modal input (images), tool use (calling Elisp functions), and embeddings. The core llm package provides generic functions that operate on these provider objects, ensuring client code remains provider-agnostic.

Quick Start & Requirements

  • Installation: Typically installed as a dependency of other Emacs packages. To use directly, require the relevant provider module (e.g., (require 'llm-openai)).
  • Configuration: Set provider-specific variables, often involving API keys or model names, e.g., (setq llm-refactoring-provider (make-llm-openai :key "YOUR_API_KEY")). API keys can be managed securely using auth-source.
  • Dependencies: Emacs Lisp environment. Specific LLM providers may require external services or local installations (e.g., Ollama, llama.cpp).
  • Documentation: https://github.com/ahyatt/llm

Highlighted Details

  • Supports chat, embeddings, tool use, and media input (alpha).
  • Offers synchronous, asynchronous, and streaming responses.
  • Integrates with popular Emacs packages like ellama, magit-gptcommit, and ekg.
  • Provides a flexible prompt construction system with templating and context management.

Maintenance & Community

  • Developed by ahyatt.
  • Contributions are welcome via pull requests. Major providers require FSF papers due to GNU ELPA inclusion; alternative providers can be hosted on other archives like MELPA.
  • Discussions: https://github.com/ahyatt/llm/discussions

Licensing & Compatibility

  • Licensed under GPLv3.
  • As part of GNU ELPA, it aims to promote free software, with warnings issued for non-free LLM usage (configurable).

Limitations & Caveats

  • Media input functionality is currently alpha quality.
  • Tool use is in beta quality, with potential compatibility issues between providers (e.g., type handling differences).
  • The library warns when using non-free LLMs, which is the default behavior for most supported providers.
Health Check
Last Commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
9
Issues (30d)
1
Star History
5 stars in the last 30 days

Explore Similar Projects

Starred by Lysandre Debut Lysandre Debut(Chief Open-Source Officer at Hugging Face), Tim J. Baek Tim J. Baek(Founder of Open WebUI), and
12 more.

chat-ui by huggingface

0.2%
11k
Chat UI: open-source interface for LLMs
Created 3 years ago
Updated 1 day ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Carol Willing Carol Willing(Core Contributor to CPython, Jupyter), and
48 more.

llama_index by run-llama

0.5%
48k
Data framework for building LLM-powered agents
Created 3 years ago
Updated 1 day ago
Feedback? Help us improve.