### [fabric](https://github.com/danielmiessler/fabric)

> Handle: `fabric`
> URL: -

<div align="center">

<img src="https://github.com/danielmiessler/fabric/blob/main/images/fabric-logo-gif.gif" alt="fabriclogo" width="400" height="400"/>
</div>

![Static Badge](https://img.shields.io/badge/mission-human_flourishing_via_AI_augmentation-purple)
<br />
![GitHub top language](https://img.shields.io/github/languages/top/danielmiessler/fabric)
![GitHub last commit](https://img.shields.io/github/last-commit/danielmiessler/fabric)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

<p class="align center">
<code>fabric</code> is an open-source framework for augmenting humans using AI.
</p>

#### Starting

`fabric` is a CLI, so it doesn't need to be started on its own. It can be used in the same way as `cmdh` or `opint` on an ad-hoc basis.

```bash
# [Optional] prebuild the fabric images
harbor build fabric

# First run - you'll have to run through setup
# otherwise the CLI will continue ignoring the commands
# If running with Harbors ollama - skip all the steps
harbor fabric --setup

# Check if service patterns are loading
# as expected - indicating everything is working
harbor fabric --listpatterns
```

#### Configuration

###### Ollama

Harbor automatically connects `fabric` to a running `ollama` instance. Additionally, you can configure a specific model to run.

```bash
# Should display same list as "harbor ollama ls"
harbor fabric --listmodels

# Set the model to run
harbor fabric model llama3.1:70b
```

###### Other backends

Ufortunately not supported, `fabric` doesn't allow configuring of the base URLs, so it can't talk to a custom OpenAI endpoint.

#### Usage

> [!NOTE]
> Note, during testing, `fabric` didn't seem to work with large contexts with ollama, so be cautious about the input size.

`fabric` is essentially a CLI for a library of very useful and diverse prompts to accomplish all kinds of tasks. Harbor supports the default pipe pattern when working with a CLI. Here are a few examples:

```bash
# Create a quiz about Harbor CLI - Neat!
cat $(h home)/harbor.sh | head -n 150 | h fabric --pattern create_quiz --stream
# > Subject: Bash Scripting and Container Management (Harbor CLI)
#   * Learning objective: Understand and utilize basic container management functions in a bash script
#    - Question 1: Which command is used to view the logs of running containers?
#      Answer 1: The `logs` or `l` command is used to view the logs of running containers.
#
#    - Question 2: What does the `exec` function in the Harbor CLI do?
#      Answer 2: The `exec` function in the Harbor CLI allows
#      you to execute a specific command inside a running service container.
#
#    - Question 3: How can you run a one-off command in a service container using the Harbor CLI?
#      Answer 3: You can use the `run` command followed by the name of
#      the service and then the command you want to execute, like so: `./harbor.sh run <service> <command>`.

# Why not generate some tags for the Harbor CLI
cat $(h home)/harbor.sh | head -n 50 | h fabric -sp create_tags
#   harbor_cli bash_script ollama nvidia gpu docker
#   llamacpp tgi lite_llm openai vllm aphrodite tabbyapi
#   mistralrs cloudflare parllama plandex open_interpreter fabric hugging_face

# Or a character card for DnD
cat $(h home)/harbor.sh | head -n 100 | h fabric -sp create_npc
#  Harbor CLI Character:
#
# Background: A former sailor and now a coder in the bustling
# city of Port Adrift, Alister was once known for his #adventurous
# spirit. He's since settled down and transformed his hobbies
# into professional opportunities, but he still has a knack for getting into trouble.
#
# Stats:
# - Strength: 14
# - Dexterity: 16 (due to his sailing experience)
# - Constitution: 12
# - Intelligence: 18
# - Wisdom: 10
# - Charisma: 15
```
