Go to file
2024-08-17 00:59:34 +02:00
.github Trigger at main 2024-08-16 23:09:17 +02:00
cli feat: add last changes from fabric-go; fix some Gemini problems 2024-08-17 00:02:03 +02:00
common initial 2024-08-16 15:43:27 -04:00
core feat: add YouTube Configurable Support (without setup activation because the key is external) 2024-08-17 00:29:21 +02:00
db feat: add last changes from fabric-go; fix some Gemini problems 2024-08-17 00:02:03 +02:00
images added images folder 2024-08-16 17:30:35 -04:00
patterns added patterns folder 2024-08-16 15:56:48 -04:00
utils initial 2024-08-16 15:43:27 -04:00
vendors feat: improve Gemini model name handling 2024-08-17 00:59:34 +02:00
youtube feat: add YouTube Configurable Support (without setup activation because the key is external) 2024-08-17 00:29:21 +02:00
.gitignore fabric as a CLI; poetry for dep management with latest versions; gitignore re-added 2024-02-09 09:52:07 -03:00
go.mod initial 2024-08-16 15:43:27 -04:00
go.sum initial 2024-08-16 15:43:27 -04:00
main.go initial 2024-08-16 15:43:27 -04:00
NOTES.md initial 2024-08-16 15:43:27 -04:00
README.md Updated README. 2024-08-16 14:09:42 -07:00

fabriclogo

fabric

Static Badge
GitHub top language GitHub last commit License: MIT

fabric is an open-source framework for augmenting humans using AI.

What and WhyPhilosophyInstallationUsageExamplesJust Use the PatternsCustom PatternsHelper AppsMeta

Navigation


Note

August 16, 2024 — We have migrated to Go! The biggest thing to know is that the previous installation instructions in the various Fabric videos out there will no longer work because they were for the legacy (Python) version. Check the new install instructions below.

Note

August 16, 2024 — We have cleaned up the Pull Requests and Issues in the following ways as part of the Go release: 1) We incorporated all Pattern submissions in the new version. 2) We closed all Issues related to Python/Code because we we moved to Go. If your issue still persists, just resubmit and we'll get on it. 3) We did the same with Question issues because most of them were related to Python. 4) We left the Enhancement issues because those tend to not relate as much to Python vs. Go, and we'll be working through those.

What and why

Since the start of 2023 and GenAI we've seen a massive number of AI applications for accomplishing tasks. It's powerful, but it's not easy to integrate this functionality into our lives.

In other words, AI doesn't have a capabilities problem—it has an integration problem.

Fabric was created to address this by enabling everyone to granularly apply AI to everyday challenges.

Philosophy

AI isn't a thing; it's a magnifier of a thing. And that thing is human creativity.

We believe the purpose of technology is to help humans flourish, so when we talk about AI we start with the human problems we want to solve.

Breaking problems into components

Our approach is to break problems into individual pieces (see below) and then apply AI to them one at a time. See below for some examples.

augmented_challenges

Too many prompts

Prompts are good for this, but the biggest challenge I faced in 2023——which still exists today—is the sheer number of AI prompts out there. We all have prompts that are useful, but it's hard to discover new ones, know if they are good or not, and manage different versions of the ones we like.

One of 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…

Installation

To install Fabric, make sure Go is installed, and then run the following command.

# Install Fabric directly from the repo
go install github.com/danielmiessler/fabric@latest
# Run the setup to set up your directories and keys
fabric --setup

Usage

Once you have it all set up, here's how to use it.

  1. Check out the options fabric -h
usage: fabric -h
Usage:
  fabric [OPTIONS]

Application Options:
  -p, --pattern=          Choose a pattern
  -C, --context=          Choose a context
      --session=          Choose a session
  -S, --setup             Run setup
  -t, --temperature=      Set temperature (default: 0.7)
  -T, --topp=             Set top P (default: 0.9)
  -s, --stream            Stream
  -P, --presencepenalty=  Set presence penalty (default: 0.0)
  -F, --frequencypenalty= Set frequency penalty (default: 0.0)
  -l, --listpatterns      List all patterns
  -L, --listmodels        List all available models
  -x, --listcontexts      List all contexts
  -X, --listsessions      List all sessions
  -U, --updatepatterns    Update patterns
  -c, --copy              Copy to clipboard
  -m, --model=            Choose model
  -u, --url=              Choose ollama url (default: http://127.0.0.1:11434)
  -o, --output=           Output to file
  -n, --latest=           Number of latest patterns to list (default: 0)

Help Options:
  -h, --help              Show this help message

Usage:
  fabric [OPTIONS]

Application Options:
  -p, --pattern=          Choose a pattern
  -C, --context=          Choose a context
      --session=          Choose a session
  -S, --setup             Run setup
  -t, --temperature=      Set temperature (default: 0.7)
  -T, --topp=             Set top P (default: 0.9)
  -s, --stream            Stream
  -P, --presencepenalty=  Set presence penalty (default: 0.0)
  -F, --frequencypenalty= Set frequency penalty (default: 0.0)
  -l, --listpatterns      List all patterns
  -L, --listmodels        List all available models
  -x, --listcontexts      List all contexts
  -X, --listsessions      List all sessions
  -U, --updatepatterns    Update patterns
  -A, --addcontext        Add a context
  -c, --copy              Copy to clipboard
  -m, --model=            Choose model
  -u, --url=              Choose ollama url (default: http://127.0.0.1:11434)
  -o, --output=           Output to file
  -n, --latest=           Number of latest patterns to list (default: 0)

Help Options:
  -h, --help              Show this help message

Migration from Legacy (Python) Version

If you have the Legacy (Python) version installed and want to migrate to the Go version, here's how you do it. It's basically two steps: 1) uninstall the Python version, and 2) install the Go version.

# Uninstall Legacy Fabric
pipx uninstall fabric

# Clear any old Fabric aliases
(check your .bashrc, .zshrc, etc.)
# Install the Go version
go install github.com/danielmiessler/fabric@latest
# Run setup for the new version. Important because things have changed
fabric --setup 

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.

https://github.com/danielmiessler/fabric/blob/main/patterns/extract_wisdom/system.md
pattern-example
  • 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.

Examples

  1. Run the summarize Pattern based on input from stdin. In this case, the body of an article.
pbpaste | fabric --pattern summarize
  1. Run the analyze_claims Pattern with the --stream option to get immediate and streaming results.
pbpaste | fabric --stream --pattern analyze_claims
  1. 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).
yt --transcript https://youtube.com/watch?v=uXs-zPc63kM | fabric --stream --pattern extract_wisdom
  1. Create patterns- you must create a .md file with the pattern and save it to ~/.config/fabric/pattterns/[yourpatternname].

Just use the Patterns

fabric-patterns-screenshot

If you're not looking to do anything fancy, and you just want a lot of great prompts, you can navigate to the /patterns directory and start exploring!

We hope that if you used nothing else from Fabric, the Patterns by themselves will make the project useful.

You can use any of the Patterns you see there in any AI application that you have, whether that's ChatGPT or some other app or website. Our plan and prediction is that people will soon be sharing many more than those we've published, and they will be way better than ours.

The wisdom of crowds for the win.

Custom Patterns

You may want to use Fabric to create your own custom Patterns—but not share them with others. No problem!

Just make a directory in ~/.config/custompatterns/ (or wherever) and put your .md files in there.

When you're ready to use them, copy them into:

~/.config/fabric/patterns/

You can then use them like any other Patterns, but they won't be public unless you explicitly submit them as Pull Requests to the Fabric project. So don't worry—they're private to you.

This feature works with all openai and ollama models but does NOT work with claude. You can specify your model with the -m flag

Helper Apps

Fabric also makes use of some core helper apps (tools) to make it easier to integrate with your various workflows. Here are some examples:

yt is a helper command that extracts the transcript from a YouTube video. You can use it like this:

yt https://www.youtube.com/watch?v=lQVcbY52_gY

This will return the transcript from the video, which you can then pipe into Fabric like this:

yt https://www.youtube.com/watch?v=lQVcbY52_gY | fabric --pattern extract_wisdom

yt Installation

To install yt, install it the same way as you install Fabric, just with a different repo name.

go install github.com/danielmiessler/yt@latest

Be sure to add your YOUTUBE_API_KEY to ~/.config/fabric/.env.

Meta

Note

Special thanks to the following people for their inspiration and contributions!

  • Jonathan Dunn for being the absolute MVP dev on the project, including spearheading the new Go version, as well as the GUI! All this while also being a full-time medical doctor!
  • Caleb Sima for pushing me over the edge of whether to make this a public project or not.
  • Eugen Eisler and Frederick Ros for their invaluable contributions to the Go version
  • Joel Parish for super useful input on the project's Github directory structure..
  • Joseph Thacker for the idea of a -c context flag that adds pre-created context in the ./config/fabric/ directory to all Pattern queries.
  • Jason Haddix for the idea of a stitch (chained Pattern) to filter content using a local model before sending on to a cloud model, i.e., cleaning customer data using llama2 before sending on to gpt-4 for analysis.
  • Andre Guerra for assisting with numerous components to make things simpler and more maintainable.

Primary contributors

fabric was created by Daniel Miessler in January of 2024.

X (formerly Twitter) Follow