Fabric AI Framework on Mac

Okay, jumping on the AI bandwagon today. As usual, this post is mostly for my own note taking as opposed to anything else, but if someone finds this handy then so be it - beers all round!

I've been trying to get my head around a few AI tools recently as, in spite of the cacophony of hype/slander/"it's just auto-complete on steroids - what's the big deal?", there's no way you can't say it's not having a big impact. I'm finding I need to look at pretty much any form of personal and occupational communication in a very different way these days as it's becoming harder to set apart what's legit and what's just AI generated fluff. From what I've used so far, it's given me some pretty good results, while the promises of AGI seem pretty laughable. Nonetheless, it would be foolish not to try and know a little more about it's inner workings or how to harness it.

While beginning with the task of setting up Langflow on my Macbook, after a quick break for coffee and telling myself that my computer didn't actually hate me and it didn't deserve to be thrown from the top floor of a very tall building, I remembered a video I'd seen of Daniel Miessler of 'Seclists' fame on an AI framework he'd been working on. I have to admit that this guy has a bit of an Obi-Wan effect on me so my ears perked up. Consider this:

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.

This is the first statement of the README.md of the Github repo, and after reading it I made a swift pivot to get it setup on my machine.

Are you on a Mac? Lucky you - the installation is quite easy. No git clone , no installing from zip/tar/brown paper bags. Just Homebrew it!

brew install fabric-ai

That was a white lie...I'm sorry. But really, there's only a few other bits and peices needed.

First, go install Go from the official website here https://go.dev/doc/install

Second, make things a little easier on yourself and set up an alias in your zshrc file. You 'could' use nano, but you know very well that you prefer vim:

vim ~/.zshrc

You can add the following to the bottom of the file:

alias fabric=fabric-ai

Don't close it down just yet. While you're there add the following below that (this is for silicon based Macs btw):

# Golang environment variables
export GOROOT=$(brew --prefix go)/libexec
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH

Now you can exit out of that (press ESC then : and wq + ENTER) and reload your shell (source ~/.zshrc).

Available plugins (please configure all required plugins)::

AI Vendors [at least one, required]

        [1]     OpenAI (configured)
        [2]     Ollama (configured)
        [3]     Azure
        [4]     Groq
        [5]     Gemini
        [6]     Anthropic
        [7]     SiliconCloud
        [8]     OpenRouter
        [9]     LM Studio
        [10]    Mistral
        [11]    DeepSeek
        [12]    Exolab
        [13]    LiteLLM

Tools

        [14]    Default AI Vendor and Model [required] ()
        [15]    Patterns - Downloads patterns [required] ()
        [16]    YouTube - to grab video transcripts and comments ()
        [17]    Language - Default AI Vendor Output Language (configured)
        [18]    Jina AI Service - to grab a webpage as clean, LLM-friendly text (configured)
        [19]    Strategies - Downloads Prompting Strategies (like chain of thought) [required] ()

[Plugin Number] Enter the number of the plugin to setup (leave empty to skip):

I found a couple of eccentricities here which are not well documented, namely that both Patterns and Strategies are not installed by default. You'll need to choose them in this setup screen and install them. Let's do Patterns first. Just type 15 (or whatever number is assigned to it on your screen) and you'll get a number of further promts for entry. You can just press enter in all of them as we just want the defaults e.g.

[Plugin Number] Enter the number of the plugin to setup (leave empty to skip):
15

[Patterns Loader]

Enter the default Git repository URL for the patterns (leave empty for 'https://github.com/danielmiessler/fabric.git' or type 'reset' to remove the value):

Do the same for Strategies and then we need to setup our Default AI Vendor.

Heads up, you'll either need API keys here or need your own model running locally, like oooh, I dunno, say Ollama? I'll go through both. The process is pretty much the same as above. In the case of using a paid for AI service such as OpenAI or Claude just follow the prompts and put in your API key where necessary. You'll need to choose which model you want to use too. Bear this in mind regarding how much much you want to spend (the better the model, the more you'll use in general). If you're using ollama you'll need to fire it up first by running ollama serve and grabbing the localhost url it spits out.

We should now be able to run a few commands to check that we're up and running. To check, find a big 'ol article in one of the billions of tabs you have open, select all the text copy it. Now go into your terminal and type the below:

pbpaste | fabric --pattern summarize

pbpaste is a cool util that ships with macs that pastes whatever is on your clipboard. We then pipe that to Fabric and use the 'summarize' pattern. You should get a pretty good output of the main points of your text.

N.B. If you get an error something to the effect of too many requests made then it's likely you need to add some credits to your OpenAI account. It took me a while to figure what was going on here so fair warning.

Now if you want to get really cool we can transcribe a whole Youtube video and do the same 🤯. You'll need to get a YT api key for this too I'm afraid but it's just as easy as above. Use the fabric --setup command and just follow the commands.

fabric -y https://www.youtube.com/watch\?v\=some_really_cool_video --stream --pattern extract_wisdom

The output will differ here depending on the model you're using and how you've tweeked it, but hopefully you'll how, with just a few small CLI commands we can use this awesome tool.

Tanks ! 😉