Metadata-Version: 2.4
Name: llm-templates-fabric
Version: 0.2.1
Summary: Load LLM templates from Fabric
Author: Simon Willison
License: Apache-2.0
Project-URL: Homepage, https://github.com/simonw/llm-templates-fabric
Project-URL: Changelog, https://github.com/simonw/llm-templates-fabric/releases
Project-URL: Issues, https://github.com/simonw/llm-templates-fabric/issues
Project-URL: CI, https://github.com/simonw/llm-templates-fabric/actions
Classifier: License :: OSI Approved :: Apache Software License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: llm>=0.24
Requires-Dist: httpx
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file

# llm-templates-fabric

[![PyPI](https://img.shields.io/pypi/v/llm-templates-fabric.svg)](https://pypi.org/project/llm-templates-fabric/)
[![Changelog](https://img.shields.io/github/v/release/simonw/llm-templates-fabric?include_prereleases&label=changelog)](https://github.com/simonw/llm-templates-fabric/releases)
[![Tests](https://github.com/simonw/llm-templates-fabric/actions/workflows/test.yml/badge.svg)](https://github.com/simonw/llm-templates-fabric/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/llm-templates-fabric/blob/main/LICENSE)

Load LLM templates from Fabric

## Installation

Install this plugin in the same environment as [LLM](https://llm.datasette.io/).
```bash
llm install llm-templates-fabric
```
## Usage

This plugin adds a template loader with the `fabric:` prefix that loads templates from the [Fabric repository](https://github.com/danielmiessler/fabric).

In this example, we use the [summarize pattern](https://github.com/danielmiessler/fabric/tree/main/patterns/summarize) for the Wikipedia Application software page.

```bash
llm -t fabric:summarize -f https://en.wikipedia.org/wiki/Application_software
```

The plugin looks for templates in the Fabric repository's `patterns/` directory. The command above will load from:

- System prompt: https://github.com/danielmiessler/fabric/blob/main/patterns/summarize/system.md
- User prompt: https://github.com/danielmiessler/fabric/blob/main/patterns/summarize/user.md

Both files are optional - if at least one of them exists, the template will load successfully.

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-templates-fabric
python -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
python -m pytest
```
