llm  by ahyatt

Emacs package for LLM interaction, abstracting model choice

Created 2 years ago
342 stars

Top 80.8% 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

1 week ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
0
Star History
9 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Anton Troynikov Anton Troynikov(Cofounder of Chroma), and
44 more.

llama_index by run-llama

0.3%
44k
Data framework for building LLM-powered agents
Created 2 years ago
Updated 19 hours ago
Feedback? Help us improve.