# Fabric Integration

Integration of `fabric` has been available from version: 0.2.90+.

Enter `@fabric` or `@append_fabric`, followed by fabric parameters

`@fabric` Execute the given fabric command

`@append_fabric` Append assistant previous response to the given fabric command and execute.

# How to use `fabric` with other FreeGenius AI tools?

Assuming `fabric` is installed and the FreeGenius AI tool plugin `fabric` is enabled, you may run something like:

```
@fabric -m gemini-1.5-pro -p write_essay "What is machine learning?"
@append_fabric -m llama3.1:latest -p extract_wisdom
@append_fabric -m mistral-large:123b -p summarize
@ask_gemini Explain it to a five-year kid
@ask_chatgpt Translate it into Chinese
```

For using multiple tools in a single prompt, read https://github.com/eliranwong/freegenius/blob/main/package/freegenius/docs/Running%20Multiple%20Tools%20in%20One%20Go.md

# Difference from Running Fabric Alone

Fabric integration in FreeGenius AI brings `fabric` to interact with other AI tools, supported by FreeGenius AI. Fabric output is directly integrated into the main FreeGenius AI message chain.

# Requirement

Install `fabric` first! Read https://github.com/danielmiessler/fabric

# How does the integration work?

The integration works with the tools `@command` and `@append_command` in FreeGenius AI

`@command` Execute the given command

`@append_command` Append assistant previous response to the given command and execute.

In plugin `fabric.py`, two aliases are created:

`@fabric` -> `@command fabric`

`@append_fabric` -> `@append_command fabric`

Version 0.2.91 added config item `fabricPath`.  Users can customise fabric path by editing its value in `config.py`.

Read more about system command integration at system command integration at https://github.com/eliranwong/freegenius/blob/main/package/freegenius/docs/System%20Command%20Integration.md

# Differences between Running Fabric via FreGenius AI and Running Fabric Alone

There are three major differences:

1. FreeGenius AI work with both text generation and task execution.  Running fabric alone chains up mainly generated texts. With FreeGenius AI, text generated by fabric and work with a wider scope of AI tools. `fabric` weaves text together but `FreeGenius AI` chains up both texts and actions.

2. Visual text output

Though you may run fabric alone in terminal, like:

```
fabric -p write_essay "What is machine learning?" | fabric -p extract_wisdom | fabric -p summarize
```
Text output in intermediate steps are not visible. You can, however, visual all text-output by running fabric with FreeGenius AI, e.g.:

```
@fabric -m gemini-1.5-pro -p write_essay "What is machine learning?"
@append_fabric -m llama3.1:latest -p extract_wisdom
@append_fabric -m mistral-large:123b -p summarize
```

3. Auto-save and Searchable

Results generated in FreeGenius AI are auto-saved and searchable.