llm/docs/index.md
Dan Turkel 88d3e11c65
Support fragments in chat through -f, --sf, and !fragments (#1048)
* add vscode and uv artifacts to gitignore
* !fragment feature
* Update fragment command to accept multiple fragments
* Add support for multiple fragments in !fragment command, factor out fragment processing
* Add support for fragment/system fragment arguments in chat command
* update docs

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-05-23 23:31:16 -07:00

4 KiB

LLM

GitHub repo PyPI Changelog Tests License Discord Homebrew

A CLI utility and Python library for interacting with Large Language Models, both via remote APIs and models that can be installed and run on your own machine.

{ref}Run prompts from the command-line <usage-executing-prompts>, {ref}store the results in SQLite <logging>, {ref}generate embeddings <embeddings> and more.

Here's a YouTube video demo and accompanying detailed notes.

Background on this project:

For more check out the llm tag on my blog.

Quick start

First, install LLM using pip or Homebrew or pipx:

pip install llm

Or with Homebrew (see {ref}warning note <homebrew-warning>):

brew install llm

Or with pipx:

pipx install llm

Or with uv

uv tool install llm

If you have an OpenAI API key key you can run this:

# Paste your OpenAI API key into this
llm keys set openai

# Run a prompt (with the default gpt-4o-mini model)
llm "Ten fun names for a pet pelican"

# Extract text from an image
llm "extract text" -a scanned-document.jpg

# Use a system prompt against a file
cat myfile.py | llm -s "Explain this code"

Or you can {ref}install a plugin <installing-plugins> and use models that can run on your local device:

# Install the plugin
llm install llm-gpt4all

# Download and run a prompt against the Orca Mini 7B model
llm -m orca-mini-3b-gguf2-q4_0 'What is the capital of France?'

To start {ref}an interactive chat <usage-chat> with a model, use llm chat:

llm chat -m gpt-4o
Chatting with gpt-4o
Type 'exit' or 'quit' to exit
Type '!multi' to enter multiple lines, then '!end' to finish
Type '!edit' to open your default editor and modify the prompt.
Type '!fragment <my_fragment> [<another_fragment> ...]' to insert one or more fragments
> Tell me a joke about a pelican
Why don't pelicans like to tip waiters?

Because they always have a big bill!
>

Contents

---
maxdepth: 3
---
setup
usage
openai-models
other-models
tools
schemas
templates
fragments
aliases
embeddings/index
plugins/index
python-api
logging
related-tools
help
contributing
changelog