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.
- Creating 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.
## Installation
`fabric` is now written in Go, so you don't even need
To install Fabric, simply run:
```bash
go install github.com/danielmiessler/fabric
```
6. Run setup:
```bash
fabric --setup
```
7. Restart your shell to reload everything.
8. Now you are up and running! You can test by running 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.
## Updating
To update Fabric, run the following commands.
```bash
# From the fabric directory
pipx install . --force
fabric --update
```
Then restart your shell.
### Using the `fabric` client
If you want to use it with OpenAI API-compatible inference servers, such as [FastChat](https://github.com/lm-sys/FastChat), [Helmholtz Blablador](http://helmholtz-blablador.fz-juelich.de), [LM Studio](https://lmstudio.ai) and others, simply export the following environment variables:
- `export OPENAI_BASE_URL=https://YOUR-SERVER:8000/v1/`
- `export DEFAULT_MODEL="YOUR_MODEL"`
And if your server needs authentication tokens, as Blablador does, you export the token the same way you would with OpenAI:
- `export OPENAI_API_KEY="YOUR TOKEN"`
Once you have it all set up, here's how to use it:
1. Check out the options
`fabric -h`
```bash
usage: fabric -h
usage: fabric [-h] [--text TEXT] [--copy] [--agents] [--output [OUTPUT]] [--session [SESSION]] [--gui] [--stream] [--list] [--temp TEMP] [--top_p TOP_P] [--frequency_penalty FREQUENCY_PENALTY]
[--presence_penalty PRESENCE_PENALTY] [--update] [--pattern PATTERN] [--setup] [--changeDefaultModel CHANGEDEFAULTMODEL] [--model MODEL] [--listmodels]
[--remoteOllamaServer REMOTEOLLAMASERVER] [--context]
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
--agents, -a Use praisonAI to create an AI agent and then use it. ex: 'write me a movie script'
--output [OUTPUT], -o [OUTPUT]
Save the response to a file
--session [SESSION], -S [SESSION]
Continue your previous conversation. Default is your previous conversation
--gui Use the GUI (Node and npm need to be installed)
--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
--temp TEMP sets the temperature for the model. Default is 0
--top_p TOP_P set the top_p for the model. Default is 1
--frequency_penalty FREQUENCY_PENALTY
sets the frequency penalty for the model. Default is 0.1
--presence_penalty PRESENCE_PENALTY
sets the presence penalty for the model. Default is 0.1
--update, -u Update patterns.
--pattern PATTERN, -p PATTERN
The pattern (prompt) to use
--setup Set up your fabric instance
--changeDefaultModel CHANGEDEFAULTMODEL
Change the default model. For a list of available models, use the --listmodels flag.
--model MODEL, -m MODEL
Select the model to use
--listmodels List all available models
--remoteOllamaServer REMOTEOLLAMASERVER
The URL of the remote ollamaserver to use. ONLY USE THIS if you are using a local ollama server in a non-default location or port
--context, -c Use Context file (context.md) to add context to your pattern
```
#### 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
```
3. Run the `extract_wisdom` Pattern with the `--stream` option to get immediate and streaming results from any Youtube video (much like in the original introduction video).
```bash
yt --transcript https://youtube.com/watch?v=uXs-zPc63kM | fabric --stream --pattern extract_wisdom
```
4. **new** All of the patterns have been added as aliases to your bash (or zsh) config file
```bash
pbpaste | analyze_claims --stream
```
> [!NOTE]
> More examples coming in the next few days, including a demo video!
### Just use the Patterns