fabric
is an open-source framework for augmenting humans using AI.fabric
's primary features is helping people collect and integrate prompts, which we call _Patterns_, into various parts of their lives.
Fabric has Patterns for all sorts of life and work activities, including:
- Extracting the most interesting parts of YouTube videos and podcasts
- Writing an essay in your own voice with just an idea as an input
- Summarizing opaque academic papers
- Creating perfectly matched AI art prompts for a piece of writing
- Rating the quality of content to see if you want to read/watch the whole thing
- Getting summaries of long, boring content
- Explaining code to you
- Turning bad documentation into usable documentation
- Create social media posts from any content input
- And a million more…
### Our approach to prompting
Fabric _Patterns_ are different than most prompts you'll see.
- **First, we use `Markdown` to help ensure maximum readability and editability**. This not only helps the creator make a good one, but also anyone who wants to deeply understand what it does. _Importantly, this also includes the AI you're sending it to!_
Here's an example of a Fabric Pattern.
```bash
https://github.com/danielmiessler/fabric/blob/main/patterns/extract_wisdom/system.md
```
- **Next, we are extremely clear in our instructions**, and we use the Markdown structure to emphasize what we want the AI to do, and in what order.
- **And finally, we tend to use the System section of the prompt almost exclusively**. In over a year of being heads-down with this stuff, we've just seen more efficacy from doing that. If that changes, or we're shown data that says otherwise, we will adjust.
## Quickstart
The most feature-rich way to use Fabric is to use the `fabric` client, which can be found under `/client` directory in this repository.
### Setting up the fabric commands
Follow these steps to get all fabric related apps installed and configured.
1. Navigate to where you want the Fabric project to live on your system in a semi-permanent place on your computer.
```bash
# Find a home for Fabric
cd /where/you/keep/code
```
2. Clone the project to your computer.
```bash
# Clone Fabric to your computer
git clone https://github.com/danielmiessler/fabric.git
```
3. Enter Fabric's main directory
```bash
# Enter the project folder (where you cloned it)
cd fabric
```
4. Install poetry
ref.: https://python-poetry.org/docs/#installing-with-the-official-installer
```bash
curl -sSL https://install.python-poetry.org | python3 -
```
5. Run the `setup.sh`, which will do the following:
- Installs python dependencies.
- Creates aliases in your OS. It should update `~/.bashrc`, `/.zshrc`, and `~/.bash_profile` if they are present in your file system.
```bash
./setup.sh
```
6. Restart your shell to reload everything.
7. Set your `OPENAI_API_KEY`.
```bash
fabric --setup
```
You'll be asked to enter your OpenAI API key, which will be written to `~/.config/fabric/.env`. Patterns will then be downloaded from Github, which will take a few moments.
8. Now you are up and running! You can test by pulling the help.
```bash
# Making sure the paths are set up correctly
fabric --help
```
> [!NOTE]
> If you're using the `server` functions, `fabric-api` and `fabric-webui` need to be run in distinct terminal windows.
### Using the `fabric` client
Once you have it all set up, here's how to use it.
1. Check out the options
`fabric -h`
```bash
fabric [-h] [--text TEXT] [--copy] [--output [OUTPUT]] [--stream] [--list]
[--update] [--pattern PATTERN] [--setup]
An open-source framework for augmenting humans using AI.
options:
-h, --help show this help message and exit
--text TEXT, -t TEXT Text to extract summary from
--copy, -c Copy the response to the clipboard
--output [OUTPUT], -o [OUTPUT]
Save the response to a file
--stream, -s Use this option if you want to see the results in realtime.
NOTE: You will not be able to pipe the output into another
command.
--list, -l List available patterns
--update, -u Update patterns
--pattern PATTERN, -p PATTERN
The pattern (prompt) to use
--setup Set up your fabric instance
```
#### Example commands
The client, by default, runs Fabric patterns without needing a server (the Patterns were downloaded during setup). This means the client connects directly to OpenAI using the input given and the Fabric pattern used.
1. Run the `summarize` Pattern based on input from `stdin`. In this case, the body of an article.
```bash
pbpaste | fabric --pattern summarize
```
2. Run the `analyze_claims` Pattern with the `--stream` option to get immediate and streaming results.
```bash
pbpaste | fabric --stream --pattern analyze_claims
```
> [!NOTE]
> More examples coming in the next few days, including a demo video!
### Just use the Patterns