From d9a6f671d1c27e4ffd60b1e2eb4cf69191774b8a Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 24 May 2025 19:43:22 -0700 Subject: [PATCH] Use sphinx-markdown-builder and cog for README, refs #1081 --- .github/workflows/cog.yml | 2 +- Justfile | 2 +- README.md | 482 ++++++++++++++++++++++++++++++-------- docs/conf.py | 5 +- docs/requirements.txt | 1 + 5 files changed, 393 insertions(+), 99 deletions(-) diff --git a/.github/workflows/cog.yml b/.github/workflows/cog.yml index 56ce1b2..81af2cf 100644 --- a/.github/workflows/cog.yml +++ b/.github/workflows/cog.yml @@ -27,7 +27,7 @@ jobs: - name: Run cog run: | - cog -r -p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" docs/**/*.md docs/*.md + cog -r -p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" docs/**/*.md docs/*.md README.md - name: Check for changes id: check-changes diff --git a/Justfile b/Justfile index 868e7ea..033ebda 100644 --- a/Justfile +++ b/Justfile @@ -29,7 +29,7 @@ # Rebuild docs with cog @cog: - pipenv run cog -r -p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" docs/**/*.md docs/*.md + pipenv run cog -r -p "import sys, os; sys._called_from_test=True; os.environ['LLM_USER_PATH'] = '/tmp'" docs/**/*.md docs/*.md README.md # Serve live docs on localhost:8000 @docs: cog diff --git a/README.md b/README.md index 7cc8858..37a7c49 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,133 @@ + # LLM +[![GitHub repo](https://img.shields.io/badge/github-repo-green)](https://github.com/simonw/llm) [![PyPI](https://img.shields.io/pypi/v/llm.svg)](https://pypi.org/project/llm/) -[![Documentation](https://readthedocs.org/projects/llm/badge/?version=latest)](https://llm.datasette.io/) [![Changelog](https://img.shields.io/github/v/release/simonw/llm?include_prereleases&label=changelog)](https://llm.datasette.io/en/stable/changelog.html) [![Tests](https://github.com/simonw/llm/workflows/Test/badge.svg)](https://github.com/simonw/llm/actions?query=workflow%3ATest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm/blob/main/LICENSE) [![Discord](https://img.shields.io/discord/823971286308356157?label=discord)](https://datasette.io/discord-llm) [![Homebrew](https://img.shields.io/homebrew/installs/dy/llm?color=yellow&label=homebrew&logo=homebrew)](https://formulae.brew.sh/formula/llm) -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. +A CLI tool and Python library for interacting with **OpenAI**, **Anthropic’s Claude**, **Google’s Gemini**, **Meta’s Llama** and dozens of other Large Language Models, both via remote APIs and with models that can be installed and run on your own machine. -[Run prompts from the command-line](https://llm.datasette.io/en/stable/usage.html#executing-a-prompt), [store the results in SQLite](https://llm.datasette.io/en/stable/logging.html), [generate embeddings](https://llm.datasette.io/en/stable/embeddings/index.html) and more. +Watch **[Language models on the command-line](https://www.youtube.com/watch?v=QUXQNi6jQ30)** on YouTube for a demo or [read the accompanying detailed notes](https://simonwillison.net/2024/Jun/17/cli-language-models/). -Consult the **[LLM plugins directory](https://llm.datasette.io/en/stable/plugins/directory.html)** for plugins that provide access to remote and local models. +With LLM you can: -Full documentation: **[llm.datasette.io](https://llm.datasette.io/)** +- [Run prompts from the command-line](https://llm.datasette.io/en/stable/usage.html#usage-executing-prompts) +- [Store prompts and responses in SQLite](https://llm.datasette.io/en/stable/logging.html#logging) +- [Generate and store embeddings](https://llm.datasette.io/en/stable/embeddings/index.html#embeddings) +- [Extract structured content from text and images](https://llm.datasette.io/en/stable/schemas.html#schemas) +- … and much, much more -Background on this project: +## Quick start + +First, install LLM using `pip` or Homebrew or `pipx` or `uv`: + +```bash +pip install llm +``` + +Or with Homebrew (see [warning note](https://llm.datasette.io/en/stable/setup.html#homebrew-warning)): + +```bash +brew install llm +``` + +Or with [pipx](https://pypa.github.io/pipx/): + +```bash +pipx install llm +``` + +Or with [uv](https://docs.astral.sh/uv/guides/tools/) + +```bash +uv tool install llm +``` + +If you have an [OpenAI API key](https://platform.openai.com/api-keys) key you can run this: + +```bash +# 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" +``` + +Run prompts against [Gemini](https://aistudio.google.com/apikey) or [Anthropic](https://console.anthropic.com/) with their respective plugins: + +```bash +llm install llm-gemini +llm keys set gemini +# Paste Gemini API key here +llm -m gemini-2.0-flash 'Tell me fun facts about Mountain View' + +llm install llm-anthropic +llm keys set anthropic +# Paste Anthropic API key here +llm -m claude-4-opus 'Impress me with wild facts about turnips' +``` + +You can also [install a plugin](https://llm.datasette.io/en/stable/plugins/installing-plugins.html#installing-plugins) to access models that can run on your local device. If you use [Ollama](https://ollama.com/): + +```bash +# Install the plugin +llm install llm-ollama + +# Download and run a prompt against the Orca Mini 7B model +ollama pull llama3.2:latest +llm -m llama3.2:latest 'What is the capital of France?' +``` + +To start [an interactive chat](https://llm.datasette.io/en/stable/usage.html#usage-chat) with a model, use `llm chat`: + +```bash +llm chat -m gpt-4.1 +``` + +```default +Chatting with gpt-4.1 +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 [ ...]' 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! +``` + +More background on this project: - [llm, ttok and strip-tags—CLI tools for working with ChatGPT and other LLMs](https://simonwillison.net/2023/May/18/cli-tools-for-llms/) - [The LLM CLI tool now supports self-hosted language models via plugins](https://simonwillison.net/2023/Jul/12/llm/) @@ -26,95 +137,274 @@ Background on this project: - [Structured data extraction from unstructured content using LLM schemas](https://simonwillison.net/2025/Feb/28/llm-schemas/) - [Long context support in LLM 0.24 using fragments and template plugins](https://simonwillison.net/2025/Apr/7/long-context-llm/) -## Installation +For more check out [the llm tag](https://simonwillison.net/tags/llm/) on my blog. -Install this tool using `pip`: -```bash -pip install llm -``` -Or using [Homebrew](https://brew.sh/): -```bash -brew install llm -``` -[Detailed installation instructions](https://llm.datasette.io/en/stable/setup.html). +## Contents -## Getting started - -If you have an [OpenAI API key](https://platform.openai.com/api-keys) you can get started using the OpenAI models right away. - -As an alternative to OpenAI, you can [install plugins](https://llm.datasette.io/en/stable/plugins/installing-plugins.html) to access models by other providers, including models that can be installed and run on your own device. - -Save your OpenAI API key like this: - -```bash -llm keys set openai -``` -This will prompt you for your key like so: -``` -Enter key: -``` -Now that you've saved a key you can run a prompt like this: -```bash -llm "Five cute names for a pet penguin" -``` -``` -1. Waddles -2. Pebbles -3. Bubbles -4. Flappy -5. Chilly -``` -Read the [usage instructions](https://llm.datasette.io/en/stable/usage.html) for more. - -## Installing a model that runs on your own machine - -[LLM plugins](https://llm.datasette.io/en/stable/plugins/index.html) can add support for alternative models, including models that run on your own machine. - -To download and run Mistral 7B Instruct locally, you can install the [llm-gpt4all](https://github.com/simonw/llm-gpt4all) plugin: -```bash -llm install llm-gpt4all -``` -Then run this command to see which models it makes available: -```bash -llm models -``` -``` -gpt4all: all-MiniLM-L6-v2-f16 - SBert, 43.76MB download, needs 1GB RAM -gpt4all: orca-mini-3b-gguf2-q4_0 - Mini Orca (Small), 1.84GB download, needs 4GB RAM -gpt4all: mistral-7b-instruct-v0 - Mistral Instruct, 3.83GB download, needs 8GB RAM -... -``` -Each model file will be downloaded once the first time you use it. Try Mistral out like this: -```bash -llm -m mistral-7b-instruct-v0 'difference between a pelican and a walrus' -``` -You can also start a chat session with the model using the `llm chat` command: -```bash -llm chat -m mistral-7b-instruct-v0 -``` -``` -Chatting with mistral-7b-instruct-v0 -Type 'exit' or 'quit' to exit -Type '!multi' to enter multiple lines, then '!end' to finish -> -``` - -## Using a system prompt - -You can use the `-s/--system` option to set a system prompt, providing instructions for processing other input to the tool. - -To describe how the code in a file works, try this: - -```bash -cat mycode.py | llm -s "Explain this code" -``` - -## Help - -For help, run: - - llm --help - -You can also use: - - python -m llm --help +* [Setup](https://llm.datasette.io/en/stable/setup.html) + * [Installation](https://llm.datasette.io/en/stable/setup.html#installation) + * [Upgrading to the latest version](https://llm.datasette.io/en/stable/setup.html#upgrading-to-the-latest-version) + * [Using uvx](https://llm.datasette.io/en/stable/setup.html#using-uvx) + * [A note about Homebrew and PyTorch](https://llm.datasette.io/en/stable/setup.html#a-note-about-homebrew-and-pytorch) + * [Installing plugins](https://llm.datasette.io/en/stable/setup.html#installing-plugins) + * [API key management](https://llm.datasette.io/en/stable/setup.html#api-key-management) + * [Saving and using stored keys](https://llm.datasette.io/en/stable/setup.html#saving-and-using-stored-keys) + * [Passing keys using the –key option](https://llm.datasette.io/en/stable/setup.html#passing-keys-using-the-key-option) + * [Keys in environment variables](https://llm.datasette.io/en/stable/setup.html#keys-in-environment-variables) + * [Configuration](https://llm.datasette.io/en/stable/setup.html#configuration) + * [Setting a custom default model](https://llm.datasette.io/en/stable/setup.html#setting-a-custom-default-model) + * [Setting a custom directory location](https://llm.datasette.io/en/stable/setup.html#setting-a-custom-directory-location) + * [Turning SQLite logging on and off](https://llm.datasette.io/en/stable/setup.html#turning-sqlite-logging-on-and-off) +* [Usage](https://llm.datasette.io/en/stable/usage.html) + * [Executing a prompt](https://llm.datasette.io/en/stable/usage.html#executing-a-prompt) + * [Model options](https://llm.datasette.io/en/stable/usage.html#model-options) + * [Attachments](https://llm.datasette.io/en/stable/usage.html#attachments) + * [System prompts](https://llm.datasette.io/en/stable/usage.html#system-prompts) + * [Tools](https://llm.datasette.io/en/stable/usage.html#tools) + * [Extracting fenced code blocks](https://llm.datasette.io/en/stable/usage.html#extracting-fenced-code-blocks) + * [Schemas](https://llm.datasette.io/en/stable/usage.html#schemas) + * [Fragments](https://llm.datasette.io/en/stable/usage.html#fragments) + * [Continuing a conversation](https://llm.datasette.io/en/stable/usage.html#continuing-a-conversation) + * [Tips for using LLM with Bash or Zsh](https://llm.datasette.io/en/stable/usage.html#tips-for-using-llm-with-bash-or-zsh) + * [Completion prompts](https://llm.datasette.io/en/stable/usage.html#completion-prompts) + * [Starting an interactive chat](https://llm.datasette.io/en/stable/usage.html#starting-an-interactive-chat) + * [Listing available models](https://llm.datasette.io/en/stable/usage.html#listing-available-models) + * [Setting default options for models](https://llm.datasette.io/en/stable/usage.html#setting-default-options-for-models) +* [OpenAI models](https://llm.datasette.io/en/stable/openai-models.html) + * [Configuration](https://llm.datasette.io/en/stable/openai-models.html#configuration) + * [OpenAI language models](https://llm.datasette.io/en/stable/openai-models.html#openai-language-models) + * [Model features](https://llm.datasette.io/en/stable/openai-models.html#model-features) + * [OpenAI embedding models](https://llm.datasette.io/en/stable/openai-models.html#openai-embedding-models) + * [OpenAI completion models](https://llm.datasette.io/en/stable/openai-models.html#openai-completion-models) + * [Adding more OpenAI models](https://llm.datasette.io/en/stable/openai-models.html#adding-more-openai-models) +* [Other models](https://llm.datasette.io/en/stable/other-models.html) + * [Installing and using a local model](https://llm.datasette.io/en/stable/other-models.html#installing-and-using-a-local-model) + * [OpenAI-compatible models](https://llm.datasette.io/en/stable/other-models.html#openai-compatible-models) + * [Extra HTTP headers](https://llm.datasette.io/en/stable/other-models.html#extra-http-headers) +* [Tools](https://llm.datasette.io/en/stable/tools.html) + * [How tools work](https://llm.datasette.io/en/stable/tools.html#how-tools-work) + * [LLM’s implementation of tools](https://llm.datasette.io/en/stable/tools.html#llm-s-implementation-of-tools) +* [Schemas](https://llm.datasette.io/en/stable/schemas.html) + * [Schemas tutorial](https://llm.datasette.io/en/stable/schemas.html#schemas-tutorial) + * [Getting started with dogs](https://llm.datasette.io/en/stable/schemas.html#getting-started-with-dogs) + * [Extracting people from a news articles](https://llm.datasette.io/en/stable/schemas.html#extracting-people-from-a-news-articles) + * [Using JSON schemas](https://llm.datasette.io/en/stable/schemas.html#using-json-schemas) + * [Ways to specify a schema](https://llm.datasette.io/en/stable/schemas.html#ways-to-specify-a-schema) + * [Concise LLM schema syntax](https://llm.datasette.io/en/stable/schemas.html#concise-llm-schema-syntax) + * [Saving reusable schemas in templates](https://llm.datasette.io/en/stable/schemas.html#saving-reusable-schemas-in-templates) + * [Browsing logged JSON objects created using schemas](https://llm.datasette.io/en/stable/schemas.html#browsing-logged-json-objects-created-using-schemas) +* [Templates](https://llm.datasette.io/en/stable/templates.html) + * [Getting started with –save](https://llm.datasette.io/en/stable/templates.html#getting-started-with-save) + * [Using a template](https://llm.datasette.io/en/stable/templates.html#using-a-template) + * [Listing available templates](https://llm.datasette.io/en/stable/templates.html#listing-available-templates) + * [Templates as YAML files](https://llm.datasette.io/en/stable/templates.html#templates-as-yaml-files) + * [System prompts](https://llm.datasette.io/en/stable/templates.html#system-prompts) + * [Fragments](https://llm.datasette.io/en/stable/templates.html#fragments) + * [Options](https://llm.datasette.io/en/stable/templates.html#options) + * [Schemas](https://llm.datasette.io/en/stable/templates.html#schemas) + * [Additional template variables](https://llm.datasette.io/en/stable/templates.html#additional-template-variables) + * [Specifying default parameters](https://llm.datasette.io/en/stable/templates.html#specifying-default-parameters) + * [Configuring code extraction](https://llm.datasette.io/en/stable/templates.html#configuring-code-extraction) + * [Setting a default model for a template](https://llm.datasette.io/en/stable/templates.html#setting-a-default-model-for-a-template) + * [Template loaders from plugins](https://llm.datasette.io/en/stable/templates.html#template-loaders-from-plugins) +* [Fragments](https://llm.datasette.io/en/stable/fragments.html) + * [Using fragments in a prompt](https://llm.datasette.io/en/stable/fragments.html#using-fragments-in-a-prompt) + * [Using fragments in chat](https://llm.datasette.io/en/stable/fragments.html#using-fragments-in-chat) + * [Browsing fragments](https://llm.datasette.io/en/stable/fragments.html#browsing-fragments) + * [Setting aliases for fragments](https://llm.datasette.io/en/stable/fragments.html#setting-aliases-for-fragments) + * [Viewing fragments in your logs](https://llm.datasette.io/en/stable/fragments.html#viewing-fragments-in-your-logs) + * [Using fragments from plugins](https://llm.datasette.io/en/stable/fragments.html#using-fragments-from-plugins) + * [Listing available fragment prefixes](https://llm.datasette.io/en/stable/fragments.html#listing-available-fragment-prefixes) +* [Model aliases](https://llm.datasette.io/en/stable/aliases.html) + * [Listing aliases](https://llm.datasette.io/en/stable/aliases.html#listing-aliases) + * [Adding a new alias](https://llm.datasette.io/en/stable/aliases.html#adding-a-new-alias) + * [Removing an alias](https://llm.datasette.io/en/stable/aliases.html#removing-an-alias) + * [Viewing the aliases file](https://llm.datasette.io/en/stable/aliases.html#viewing-the-aliases-file) +* [Embeddings](https://llm.datasette.io/en/stable/embeddings/index.html) + * [Embedding with the CLI](https://llm.datasette.io/en/stable/embeddings/cli.html) + * [llm embed](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-embed) + * [llm embed-multi](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-embed-multi) + * [llm similar](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-similar) + * [llm embed-models](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-embed-models) + * [llm collections list](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-collections-list) + * [llm collections delete](https://llm.datasette.io/en/stable/embeddings/cli.html#llm-collections-delete) + * [Using embeddings from Python](https://llm.datasette.io/en/stable/embeddings/python-api.html) + * [Working with collections](https://llm.datasette.io/en/stable/embeddings/python-api.html#working-with-collections) + * [Retrieving similar items](https://llm.datasette.io/en/stable/embeddings/python-api.html#retrieving-similar-items) + * [SQL schema](https://llm.datasette.io/en/stable/embeddings/python-api.html#sql-schema) + * [Writing plugins to add new embedding models](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html) + * [Embedding binary content](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html#embedding-binary-content) + * [LLM_RAISE_ERRORS](https://llm.datasette.io/en/stable/embeddings/writing-plugins.html#llm-raise-errors) + * [Embedding storage format](https://llm.datasette.io/en/stable/embeddings/storage.html) +* [Plugins](https://llm.datasette.io/en/stable/plugins/index.html) + * [Installing plugins](https://llm.datasette.io/en/stable/plugins/installing-plugins.html) + * [Listing installed plugins](https://llm.datasette.io/en/stable/plugins/installing-plugins.html#listing-installed-plugins) + * [Running with a subset of plugins](https://llm.datasette.io/en/stable/plugins/installing-plugins.html#running-with-a-subset-of-plugins) + * [Plugin directory](https://llm.datasette.io/en/stable/plugins/directory.html) + * [Local models](https://llm.datasette.io/en/stable/plugins/directory.html#local-models) + * [Remote APIs](https://llm.datasette.io/en/stable/plugins/directory.html#remote-apis) + * [Fragments and template loaders](https://llm.datasette.io/en/stable/plugins/directory.html#fragments-and-template-loaders) + * [Embedding models](https://llm.datasette.io/en/stable/plugins/directory.html#embedding-models) + * [Extra commands](https://llm.datasette.io/en/stable/plugins/directory.html#extra-commands) + * [Just for fun](https://llm.datasette.io/en/stable/plugins/directory.html#just-for-fun) + * [Plugin hooks](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html) + * [register_commands(cli)](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html#register-commands-cli) + * [register_models(register)](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html#register-models-register) + * [register_tools(register)](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html#register-tools-register) + * [register_template_loaders(register)](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html#register-template-loaders-register) + * [register_fragment_loaders(register)](https://llm.datasette.io/en/stable/plugins/plugin-hooks.html#register-fragment-loaders-register) + * [Developing a model plugin](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html) + * [The initial structure of the plugin](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#the-initial-structure-of-the-plugin) + * [Installing your plugin to try it out](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#installing-your-plugin-to-try-it-out) + * [Building the Markov chain](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#building-the-markov-chain) + * [Executing the Markov chain](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#executing-the-markov-chain) + * [Adding that to the plugin](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#adding-that-to-the-plugin) + * [Understanding execute()](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#understanding-execute) + * [Prompts and responses are logged to the database](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#prompts-and-responses-are-logged-to-the-database) + * [Adding options](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#adding-options) + * [Distributing your plugin](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#distributing-your-plugin) + * [GitHub repositories](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#github-repositories) + * [Publishing plugins to PyPI](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#publishing-plugins-to-pypi) + * [Adding metadata](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#adding-metadata) + * [What to do if it breaks](https://llm.datasette.io/en/stable/plugins/tutorial-model-plugin.html#what-to-do-if-it-breaks) + * [Advanced model plugins](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html) + * [Tip: lazily load expensive dependencies](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#tip-lazily-load-expensive-dependencies) + * [Models that accept API keys](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#models-that-accept-api-keys) + * [Async models](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#async-models) + * [Supporting schemas](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#supporting-schemas) + * [Attachments for multi-modal models](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#attachments-for-multi-modal-models) + * [Tracking token usage](https://llm.datasette.io/en/stable/plugins/advanced-model-plugins.html#tracking-token-usage) + * [Utility functions for plugins](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html) + * [llm.user_dir()](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html#llm-user-dir) + * [llm.ModelError](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html#llm-modelerror) + * [Response.fake()](https://llm.datasette.io/en/stable/plugins/plugin-utilities.html#response-fake) +* [Python API](https://llm.datasette.io/en/stable/python-api.html) + * [Basic prompt execution](https://llm.datasette.io/en/stable/python-api.html#basic-prompt-execution) + * [Tools](https://llm.datasette.io/en/stable/python-api.html#tools) + * [System prompts](https://llm.datasette.io/en/stable/python-api.html#system-prompts) + * [Attachments](https://llm.datasette.io/en/stable/python-api.html#attachments) + * [Schemas](https://llm.datasette.io/en/stable/python-api.html#schemas) + * [Fragments](https://llm.datasette.io/en/stable/python-api.html#fragments) + * [Model options](https://llm.datasette.io/en/stable/python-api.html#model-options) + * [Passing an API key](https://llm.datasette.io/en/stable/python-api.html#passing-an-api-key) + * [Models from plugins](https://llm.datasette.io/en/stable/python-api.html#models-from-plugins) + * [Accessing the underlying JSON](https://llm.datasette.io/en/stable/python-api.html#accessing-the-underlying-json) + * [Token usage](https://llm.datasette.io/en/stable/python-api.html#token-usage) + * [Streaming responses](https://llm.datasette.io/en/stable/python-api.html#streaming-responses) + * [Async models](https://llm.datasette.io/en/stable/python-api.html#async-models) + * [Tool functions can be sync or async](https://llm.datasette.io/en/stable/python-api.html#tool-functions-can-be-sync-or-async) + * [Tool use for async models](https://llm.datasette.io/en/stable/python-api.html#tool-use-for-async-models) + * [Conversations](https://llm.datasette.io/en/stable/python-api.html#conversations) + * [Conversations using tools](https://llm.datasette.io/en/stable/python-api.html#conversations-using-tools) + * [Listing models](https://llm.datasette.io/en/stable/python-api.html#listing-models) + * [Running code when a response has completed](https://llm.datasette.io/en/stable/python-api.html#running-code-when-a-response-has-completed) + * [Other functions](https://llm.datasette.io/en/stable/python-api.html#other-functions) + * [set_alias(alias, model_id)](https://llm.datasette.io/en/stable/python-api.html#set-alias-alias-model-id) + * [remove_alias(alias)](https://llm.datasette.io/en/stable/python-api.html#remove-alias-alias) + * [set_default_model(alias)](https://llm.datasette.io/en/stable/python-api.html#set-default-model-alias) + * [get_default_model()](https://llm.datasette.io/en/stable/python-api.html#get-default-model) + * [set_default_embedding_model(alias) and get_default_embedding_model()](https://llm.datasette.io/en/stable/python-api.html#set-default-embedding-model-alias-and-get-default-embedding-model) +* [Logging to SQLite](https://llm.datasette.io/en/stable/logging.html) + * [Viewing the logs](https://llm.datasette.io/en/stable/logging.html#viewing-the-logs) + * [-s/–short mode](https://llm.datasette.io/en/stable/logging.html#s-short-mode) + * [Logs for a conversation](https://llm.datasette.io/en/stable/logging.html#logs-for-a-conversation) + * [Searching the logs](https://llm.datasette.io/en/stable/logging.html#searching-the-logs) + * [Filtering past a specific ID](https://llm.datasette.io/en/stable/logging.html#filtering-past-a-specific-id) + * [Filtering by model](https://llm.datasette.io/en/stable/logging.html#filtering-by-model) + * [Filtering by prompts that used specific fragments](https://llm.datasette.io/en/stable/logging.html#filtering-by-prompts-that-used-specific-fragments) + * [Filtering by prompts that used specific tools](https://llm.datasette.io/en/stable/logging.html#filtering-by-prompts-that-used-specific-tools) + * [Browsing data collected using schemas](https://llm.datasette.io/en/stable/logging.html#browsing-data-collected-using-schemas) + * [Browsing logs using Datasette](https://llm.datasette.io/en/stable/logging.html#browsing-logs-using-datasette) + * [Backing up your database](https://llm.datasette.io/en/stable/logging.html#backing-up-your-database) + * [SQL schema](https://llm.datasette.io/en/stable/logging.html#sql-schema) +* [Related tools](https://llm.datasette.io/en/stable/related-tools.html) + * [strip-tags](https://llm.datasette.io/en/stable/related-tools.html#strip-tags) + * [ttok](https://llm.datasette.io/en/stable/related-tools.html#ttok) + * [Symbex](https://llm.datasette.io/en/stable/related-tools.html#symbex) +* [CLI reference](https://llm.datasette.io/en/stable/help.html) + * [llm –help](https://llm.datasette.io/en/stable/help.html#llm-help) + * [llm prompt –help](https://llm.datasette.io/en/stable/help.html#llm-prompt-help) + * [llm chat –help](https://llm.datasette.io/en/stable/help.html#llm-chat-help) + * [llm keys –help](https://llm.datasette.io/en/stable/help.html#llm-keys-help) + * [llm logs –help](https://llm.datasette.io/en/stable/help.html#llm-logs-help) + * [llm models –help](https://llm.datasette.io/en/stable/help.html#llm-models-help) + * [llm templates –help](https://llm.datasette.io/en/stable/help.html#llm-templates-help) + * [llm schemas –help](https://llm.datasette.io/en/stable/help.html#llm-schemas-help) + * [llm tools –help](https://llm.datasette.io/en/stable/help.html#llm-tools-help) + * [llm aliases –help](https://llm.datasette.io/en/stable/help.html#llm-aliases-help) + * [llm fragments –help](https://llm.datasette.io/en/stable/help.html#llm-fragments-help) + * [llm plugins –help](https://llm.datasette.io/en/stable/help.html#llm-plugins-help) + * [llm install –help](https://llm.datasette.io/en/stable/help.html#llm-install-help) + * [llm uninstall –help](https://llm.datasette.io/en/stable/help.html#llm-uninstall-help) + * [llm embed –help](https://llm.datasette.io/en/stable/help.html#llm-embed-help) + * [llm embed-multi –help](https://llm.datasette.io/en/stable/help.html#llm-embed-multi-help) + * [llm similar –help](https://llm.datasette.io/en/stable/help.html#llm-similar-help) + * [llm embed-models –help](https://llm.datasette.io/en/stable/help.html#llm-embed-models-help) + * [llm collections –help](https://llm.datasette.io/en/stable/help.html#llm-collections-help) + * [llm openai –help](https://llm.datasette.io/en/stable/help.html#llm-openai-help) +* [Contributing](https://llm.datasette.io/en/stable/contributing.html) + * [Updating recorded HTTP API interactions and associated snapshots](https://llm.datasette.io/en/stable/contributing.html#updating-recorded-http-api-interactions-and-associated-snapshots) + * [Debugging tricks](https://llm.datasette.io/en/stable/contributing.html#debugging-tricks) + * [Documentation](https://llm.datasette.io/en/stable/contributing.html#documentation) + * [Release process](https://llm.datasette.io/en/stable/contributing.html#release-process) +* [Changelog](https://llm.datasette.io/en/stable/changelog.html) + * [0.26a0 (2025-05-13)](https://llm.datasette.io/en/stable/changelog.html#a0-2025-05-13) + * [0.25 (2025-05-04)](https://llm.datasette.io/en/stable/changelog.html#v0-25) + * [0.25a0 (2025-04-10)](https://llm.datasette.io/en/stable/changelog.html#a0-2025-04-10) + * [0.24.2 (2025-04-08)](https://llm.datasette.io/en/stable/changelog.html#v0-24-2) + * [0.24.1 (2025-04-08)](https://llm.datasette.io/en/stable/changelog.html#v0-24-1) + * [0.24 (2025-04-07)](https://llm.datasette.io/en/stable/changelog.html#v0-24) + * [0.24a1 (2025-04-06)](https://llm.datasette.io/en/stable/changelog.html#a1-2025-04-06) + * [0.24a0 (2025-02-28)](https://llm.datasette.io/en/stable/changelog.html#a0-2025-02-28) + * [0.23 (2025-02-28)](https://llm.datasette.io/en/stable/changelog.html#v0-23) + * [0.22 (2025-02-16)](https://llm.datasette.io/en/stable/changelog.html#v0-22) + * [0.21 (2025-01-31)](https://llm.datasette.io/en/stable/changelog.html#v0-21) + * [0.20 (2025-01-22)](https://llm.datasette.io/en/stable/changelog.html#v0-20) + * [0.19.1 (2024-12-05)](https://llm.datasette.io/en/stable/changelog.html#v0-19-1) + * [0.19 (2024-12-01)](https://llm.datasette.io/en/stable/changelog.html#v0-19) + * [0.19a2 (2024-11-20)](https://llm.datasette.io/en/stable/changelog.html#a2-2024-11-20) + * [0.19a1 (2024-11-19)](https://llm.datasette.io/en/stable/changelog.html#a1-2024-11-19) + * [0.19a0 (2024-11-19)](https://llm.datasette.io/en/stable/changelog.html#a0-2024-11-19) + * [0.18 (2024-11-17)](https://llm.datasette.io/en/stable/changelog.html#v0-18) + * [0.18a1 (2024-11-14)](https://llm.datasette.io/en/stable/changelog.html#a1-2024-11-14) + * [0.18a0 (2024-11-13)](https://llm.datasette.io/en/stable/changelog.html#a0-2024-11-13) + * [0.17 (2024-10-29)](https://llm.datasette.io/en/stable/changelog.html#v0-17) + * [0.17a0 (2024-10-28)](https://llm.datasette.io/en/stable/changelog.html#a0-2024-10-28) + * [0.16 (2024-09-12)](https://llm.datasette.io/en/stable/changelog.html#v0-16) + * [0.15 (2024-07-18)](https://llm.datasette.io/en/stable/changelog.html#v0-15) + * [0.14 (2024-05-13)](https://llm.datasette.io/en/stable/changelog.html#v0-14) + * [0.13.1 (2024-01-26)](https://llm.datasette.io/en/stable/changelog.html#v0-13-1) + * [0.13 (2024-01-26)](https://llm.datasette.io/en/stable/changelog.html#v0-13) + * [0.12 (2023-11-06)](https://llm.datasette.io/en/stable/changelog.html#v0-12) + * [0.11.2 (2023-11-06)](https://llm.datasette.io/en/stable/changelog.html#v0-11-2) + * [0.11.1 (2023-10-31)](https://llm.datasette.io/en/stable/changelog.html#v0-11-1) + * [0.11 (2023-09-18)](https://llm.datasette.io/en/stable/changelog.html#v0-11) + * [0.10 (2023-09-12)](https://llm.datasette.io/en/stable/changelog.html#v0-10) + * [llm chat](https://llm.datasette.io/en/stable/changelog.html#llm-chat) + * [Binary embedding support](https://llm.datasette.io/en/stable/changelog.html#binary-embedding-support) + * [Also in this release](https://llm.datasette.io/en/stable/changelog.html#also-in-this-release) + * [0.10a1 (2023-09-11)](https://llm.datasette.io/en/stable/changelog.html#a1-2023-09-11) + * [0.10a0 (2023-09-04)](https://llm.datasette.io/en/stable/changelog.html#a0-2023-09-04) + * [0.9 (2023-09-03)](https://llm.datasette.io/en/stable/changelog.html#v0-9) + * [0.8.1 (2023-08-31)](https://llm.datasette.io/en/stable/changelog.html#v0-8-1) + * [0.8 (2023-08-20)](https://llm.datasette.io/en/stable/changelog.html#v0-8) + * [0.7.1 (2023-08-19)](https://llm.datasette.io/en/stable/changelog.html#v0-7-1) + * [0.7 (2023-08-12)](https://llm.datasette.io/en/stable/changelog.html#v0-7) + * [Notable new plugins](https://llm.datasette.io/en/stable/changelog.html#notable-new-plugins) + * [Also in this release](https://llm.datasette.io/en/stable/changelog.html#id28) + * [0.6.1 (2023-07-24)](https://llm.datasette.io/en/stable/changelog.html#v0-6-1) + * [0.6 (2023-07-18)](https://llm.datasette.io/en/stable/changelog.html#v0-6) + * [0.5 (2023-07-12)](https://llm.datasette.io/en/stable/changelog.html#v0-5) + * [New features](https://llm.datasette.io/en/stable/changelog.html#new-features) + * [Smaller improvements](https://llm.datasette.io/en/stable/changelog.html#smaller-improvements) + * [0.4.1 (2023-06-17)](https://llm.datasette.io/en/stable/changelog.html#v0-4-1) + * [0.4 (2023-06-17)](https://llm.datasette.io/en/stable/changelog.html#v0-4) + * [Prompt templates](https://llm.datasette.io/en/stable/changelog.html#prompt-templates) + * [Continue previous chat](https://llm.datasette.io/en/stable/changelog.html#continue-previous-chat) + * [New mechanism for storing API keys](https://llm.datasette.io/en/stable/changelog.html#new-mechanism-for-storing-api-keys) + * [New location for the logs.db database](https://llm.datasette.io/en/stable/changelog.html#new-location-for-the-logs-db-database) + * [Other changes](https://llm.datasette.io/en/stable/changelog.html#other-changes) + * [0.3 (2023-05-17)](https://llm.datasette.io/en/stable/changelog.html#v0-3) + * [0.2 (2023-04-01)](https://llm.datasette.io/en/stable/changelog.html#v0-2) + * [0.1 (2023-04-01)](https://llm.datasette.io/en/stable/changelog.html#v0-1) + diff --git a/docs/conf.py b/docs/conf.py index ff3ca53..c1583b1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,9 +30,12 @@ from subprocess import PIPE, Popen # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["myst_parser", "sphinx_copybutton"] +extensions = ["myst_parser", "sphinx_copybutton", "sphinx_markdown_builder"] myst_enable_extensions = ["colon_fence"] +markdown_http_base = "https://llm.datasette.io/en/stable" +markdown_uri_doc_suffix = ".html" + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/requirements.txt b/docs/requirements.txt index d99164f..2238dba 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,5 +2,6 @@ sphinx==7.2.6 furo==2023.9.10 sphinx-autobuild sphinx-copybutton +sphinx-markdown-builder==0.6.8 myst-parser cogapp