Skip to content

2.3.10 Satellite: fabric

av edited this page Sep 24, 2024 · 3 revisions

Handle: fabric URL: -

fabriclogo

Static Badge
GitHub top language GitHub last commit License: MIT

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

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.

# [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.

# 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

[!INFO] 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:

# 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
Clone this wiki locally