Fabric

其他源码 2025-08-06
Fabric受到…的慷慨支持。

Fabric


Fabric是使用AI增强人类的开源框架。

更新•什么以及原因•理念•安装•用法•示例•只使用模式•自定义模式•助手应用•元

什么和原因

自2022年底现代AI开始以来,我们已经看到了许多用于完成任务的AI应用程序。有成千上万的网站,聊天机器人,移动应用程序和其他用于使用所有其他AI的接口。

这一切都非常令人兴奋和强大,但是将这种功能整合到我们的生活并不容易。

换句话说,AI没有功能问题,它存在集成问题。

通过创建和组织AI的基本单位来创建Fabric来解决这个问题,这是提示自己!

Fabric通过现实世界任务组织提示,使人们可以在自己喜欢的工具中单个地方创建,收集和组织其最重要的AI解决方案。而且,如果您以命令行的重点进行,则可以将Fabric本身用作接口!

介绍视频

请记住,其中许多是基于Python的Fabric时记录的,因此请记住使用下面的当前安装说明。

  • 网络查克
  • 大卫·孟加尔(David Bombal)
  • 我自己的工具介绍
  • 更多Fabric YouTube视频

导航

  • Fabric
    • 什么和原因
    • 介绍视频
    • 导航
    • 更新
    • 哲学
      • 将问题分解为组件
      • 提示太多
    • 安装
      • 获取最新版本的二进制文件
        • 视窗
        • macOS(ARM64)
        • macos(AMD64)
        • Linux(AMD64)
        • Linux(ARM64)
      • 使用软件包经理
        • macos(自制)
        • Arch Linux(AUR)
      • 来自来源
      • 环境变量
      • 设置
      • 为所有模式添加别名
        • 使用别名将文件保存在Markdown中
      • 迁移
      • 升级
      • 外壳完成
        • ZSH完成
        • bash完成
        • 鱼的完工
    • 用法
    • 我们提示的方法
    • 例子
    • 只使用模式
      • 迅速的策略
    • 自定义模式
      • 设置自定义模式
      • 使用自定义模式
      • 它如何工作
    • 助手应用程序
      • to_pdf
      • TO_PDF安装
      • code_helper
    • pbpaste
    • Web界面
      • 安装
      • 简化UI
        • 剪贴板支持
      • 主要贡献者
      • 贡献者

更新

Fabric正在迅速发展。

通过查看ChangElog的所有最新更改,请遵守最新功能。

哲学

人工智能不是事;这是一件事情的放大镜。那东西是人类的创造力

我们认为,技术的目的是帮助人类蓬勃发展,因此,当我们谈论AI时,我们就从我们要解决的人类问题开始。

将问题分解为组件

我们的方法是将问题分解成各个部分(见下文),然后一次将AI应用于它们。请参阅下面的一些示例。

提示太多

提示对此是有好处的,但是我在2023年面临的最大挑战 - 今天仍然存在 - AI的数量庞大。我们都有有用的提示,但是很难发现新的提示,知道它们是否好,并管理我们喜欢的版本的不同版本

Fabric的主要特征之一是帮助人们收集和集成提示,我们称之为模式,将其称为生活的各个部分。

Fabric具有各种生活和工作活动的模式,包括:

  • 提取YouTube视频和播客中最有趣的部分
  • 用自己的声音写一篇文章,只是一个想法作为输入
  • 总结不透明的学术论文
  • 创建完美匹配的AI艺术提示
  • 对内容的质量进行评分,以查看您是否想阅读/观看整个内容
  • 获取长时间无聊的内容的摘要
  • 向您解释代码
  • 将不良文档变成可用的文档
  • 从任何内容输入中创建社交媒体帖子
  • 还有一百万…

安装

要安装Fabric ,您可以使用最新的版本二进制文件或从源中安装它。

获取最新版本的二进制文件

视窗

https://*github.**com/danielmiessler/fabric/releases/latest/download/ Fabric -windows-amd64.exe

macOS(ARM64)

curl -l -l https://github.com/danielmiessler/fabric/releases/latest/download/ Fabric / fabric-darwin-arm64> Fabric && chmod +chmod +x Fabric && ./ Fabric 。

macos(AMD64)

curl -l -l https://github.com/danielmiessler/fabric/releases/latest/download/ Fabric Fabric -amd64> Fabric && && chmod +chmod +x Fabric &&。

Linux(AMD64)

curl -l -l https://github.com/danielmiessler/fabric/releases/latest/download/ Fabric Fabric -linux -amd64> Fabric && && chmod +chmod +x Fabric && ./

Linux(ARM64)

curl -l -l https://github.com/danielmiessler/fabric/releases/latest/download/ Fabric Fabric -arm64> Fabric && chmod&chmod +x Fabric &&。

使用软件包经理

注意:使用Homebrew或Arch Linux软件包管理器将Fabric作为Fabric -ai提供,因此将以下别名添加到Shell启动文件中以考虑以下内容:

Fabric -ai'">
 alias Fabric = ' Fabric -ai ' 

macos(自制)

啤酒安装Fabric -AI

Arch Linux(AUR)

是的-s Fabric -ai

来自来源

要安装Fabric ,请确保安装GO,然后运行以下命令。

Fabric directly from the repo go install github.com/danielmiessler/ Fabric /cmd/ Fabric @latest">
 # Install Fabric directly from the repo
go install github.com/danielmiessler/ Fabric /cmd/ Fabric @latest

环境变量

您可能需要在Linux上的〜/.bashrc或Mac上的〜/.zshrc文件中设置一些环境变量,以便能够运行Fabric命令。这是您可以添加的示例:

用于基于英特尔的Mac或Linux

 # Golang environment variables
export GOROOT=/usr/local/go
export GOPATH= $HOME /go

# Update PATH to include GOPATH and GOROOT binaries
export PATH= $GOPATH /bin: $GOROOT /bin: $HOME /.local/bin: $PATH

用于基于苹果硅的Mac

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

设置

现在运行以下命令

 # Run the setup to set up your directories and keys
Fabric --setup

如果一切正常,那么您就可以了。

为所有模式添加别名

为了添加所有模式的别名,并将它们直接用作命令IE。总结而不是Fabric -Pattern总结您可以将以下内容添加到.zshrc或.bashrc文件中。

Fabric/patterns directory for pattern_file in $HOME/.config/ Fabric /patterns/*; do # Get the base name of the file (i.e., remove the directory path) pattern_name=$(basename "$pattern_file") # Create an alias in the form: alias pattern_name=" Fabric --pattern pattern_name" alias_command="alias $pattern_name=' Fabric --pattern $pattern_name'" # Evaluate the alias command to add it to the current shell eval "$alias_command" done yt() { if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then echo "Usage: yt [-t | --timestamps] youtube-link" echo "Use the '-t' flag to get the transcript with timestamps." return 1 fi transcript_flag="--transcript" if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then transcript_flag="--transcript-with-timestamps" shift fi local video_link="$1" Fabric -y "$video_link" $transcript_flag }">
 # Loop through all files in the ~/.config/ Fabric /patterns directory
for pattern_file in $HOME /.config/ Fabric /patterns/ * ; do
    # Get the base name of the file (i.e., remove the directory path)
    pattern_name= $( basename " $pattern_file " )

    # Create an alias in the form: alias pattern_name=" Fabric --pattern pattern_name"
    alias_command= " alias $pattern_name =' Fabric --pattern $pattern_name ' "

    # Evaluate the alias command to add it to the current shell
    eval " $alias_command "
done

yt () {
    if [ " $# " -eq 0 ] || [ " $# " -gt 2 ] ; then
        echo " Usage: yt [-t | --timestamps] youtube-link "
        echo " Use the '-t' flag to get the transcript with timestamps. "
        return 1
    fi

    transcript_flag= " --transcript "
    if [ " $1 " = " -t " ] || [ " $1 " = " --timestamps " ] ; then
        transcript_flag= " --transcript-with-timestamps "
        shift
    fi
    local video_link= " $1 "
    Fabric -y " $video_link " $transcript_flag
}

您可以通过在powershell窗口内运行记事本$ profile在powershell中的等效别名添加以下代码:

Fabric/patterns" foreach ($patternDir in Get-ChildItem -Path $patternsPath -Directory) { $patternName = $patternDir.Name # Dynamically define a function for each pattern $functionDefinition = @" function $patternName { [CmdletBinding()] param( [Parameter(ValueFromPipeline = `$true)] [string] `$InputObject, [Parameter(ValueFromRemainingArguments = `$true)] [String[]] `$patternArgs ) begin { # Initialize an array to collect pipeline input `$collector = @() } process { # Collect pipeline input objects if (`$InputObject) { `$collector += `$InputObject } } end { # Join all pipeline input into a single string, separated by newlines `$pipelineContent = `$collector -join "`n" # If there's pipeline input, include it in the call to Fabric if (`$pipelineContent) { `$pipelineContent | Fabric --pattern $patternName `$patternArgs } else { # No pipeline input; just call Fabric with the additional args Fabric --pattern $patternName `$patternArgs } } } "@ # Add the function to the current session Invoke-Expression $functionDefinition } # Define the 'yt' function as well function yt { [CmdletBinding()] param( [Parameter()] [Alias("timestamps")] [switch]$t, [Parameter(Position = 0, ValueFromPipeline = $true)] [string]$videoLink ) begin { $transcriptFlag = "--transcript" if ($t) { $transcriptFlag = "--transcript-with-timestamps" } } process { if (-not $videoLink) { Write-Error "Usage: yt [-t | --timestamps] youtube-link" return } } end { if ($videoLink) { # Execute and allow output to flow through the pipeline Fabric -y $videoLink $transcriptFlag } } }">
 # Path to the patterns directory
$patternsPath = Join-Path $HOME " .config/ Fabric /patterns "
foreach ( $patternDir in Get-ChildItem - Path $patternsPath - Directory) {
    $patternName = $patternDir .Name

    # Dynamically define a function for each pattern
    $functionDefinition = @"
function $patternName {
    [CmdletBinding()]
    param(
        [Parameter(ValueFromPipeline = `$ true)]
        [string] `$ InputObject,

        [Parameter(ValueFromRemainingArguments = `$ true)]
        [String[]] `$ patternArgs
    )

    begin {
        # Initialize an array to collect pipeline input
        `$ collector = @()
    }

    process {
        # Collect pipeline input objects
        if ( `$ InputObject) {
            `$ collector += `$ InputObject
        }
    }

    end {
        # Join all pipeline input into a single string, separated by newlines
        `$ pipelineContent = `$ collector -join " `n "

        # If there's pipeline input, include it in the call to Fabric
        if ( `$ pipelineContent) {
            `$ pipelineContent | Fabric --pattern $patternName `$ patternArgs
        } else {
            # No pipeline input; just call Fabric with the additional args
            Fabric --pattern $patternName `$ patternArgs
        }
    }
}
"@
    # Add the function to the current session
    Invoke-Expression $functionDefinition
}

# Define the 'yt' function as well
function yt {
    [ CmdletBinding ()]
    param (
        [ Parameter ()]
        [ Alias ( " timestamps " )]
        [ switch ] $t ,

        [ Parameter ( Position = 0 , ValueFromPipeline = $true )]
        [ string ] $videoLink
    )

    begin {
        $transcriptFlag = " --transcript "
        if ( $t ) {
            $transcriptFlag = " --transcript-with-timestamps "
        }
    }

    process {
        if ( -not $videoLink ) {
            Write-Error " Usage: yt [-t | --timestamps] youtube-link "
            return
        }
    }

    end {
        if ( $videoLink ) {
            # Execute and allow output to flow through the pipeline
            Fabric - y $videoLink $transcriptFlag
        }
    }
}

这也创建了一个YT别名,可让您使用yt https://www.y*ou*t*ube.com/watch?v=4b0iet22vik获取成绩单,评论和元数据。

使用别名将文件保存在Markdown中

如果除上述别名外,您还希望将输出保存到您喜欢的Markdown Note Vault如Moteidian,而不是上面的以下内容添加到您的.zshrc或.bashrc文件:

Fabric/patterns directory for pattern_file in ~/.config/ Fabric /patterns/*; do # Get the base name of the file (i.e., remove the directory path) pattern_name=$(basename "$pattern_file") # Remove any existing alias with the same name unalias "$pattern_name" 2>/dev/null # Define a function dynamically for each pattern eval " $pattern_name() { local title=$1 local date_stamp=$(date +'%Y-%m-%d') local output_path="$obsidian_base/${date_stamp}-${title}.md" # Check if a title was provided if [ -n "$title" ]; then # If a title is provided, use the output path Fabric --pattern "$pattern_name" -o "$output_path" else # If no title is provided, use --stream Fabric --pattern "$pattern_name" --stream fi } " done">
 # Define the base directory for Obsidian notes
obsidian_base= " /path/to/obsidian "

# Loop through all files in the ~/.config/ Fabric /patterns directory
for pattern_file in ~ /.config/ Fabric /patterns/ * ; do
    # Get the base name of the file (i.e., remove the directory path)
    pattern_name= $( basename " $pattern_file " )

    # Remove any existing alias with the same name
    unalias " $pattern_name " 2> /dev/null

    # Define a function dynamically for each pattern
    eval "
    $pattern_name () {
        local title= $ 1
        local date_stamp= $ (date +'%Y-%m-%d')
        local output_path= "$ obsidian_base/ $ {date_stamp}- $ {title}.md "

        # Check if a title was provided
        if [ -n "$ title " ]; then
            # If a title is provided, use the output path
            Fabric --pattern " $pattern_name " -o "$ output_path "
        else
            # If no title is provided, use --stream
            Fabric --pattern " $pattern_name " --stream
        fi
    }
    "
done

This will allow you to use the patterns as aliases like in the above for example summarize instead of Fabric --pattern summarize --stream, however if you pass in an extra argument like this summarize "my_article_title" your output will be saved in the destination that you set in obsidian_base="/path/to/obsidian" in the following format YYYY-MM-DD-my_article_title.md where the date为您自动化。您可以通过调整date_stamp格式来调整日期格式。

迁移

如果您已经安装了旧版(Python)版本并希望迁移到GO版本,则是您的操作方式。基本上是两个步骤:1)卸载Python版本,以及2)安装GO版本。

Fabric pipx uninstall Fabric # Clear any old Fabric aliases (check your .bashrc, .zshrc, etc.) # Install the Go version go install github.com/danielmiessler/ Fabric /cmd/ Fabric @latest # Run setup for the new version. Important because things have changed Fabric --setup">
 # 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 /cmd/ Fabric @latest
# Run setup for the new version. Important because things have changed
Fabric --setup

然后设置您的环境变量,如上所示。

升级

Go的好处是,它非常容易升级。只需首先运行与用来安装它的相同命令,您将始终获得最新版本。

Fabric @latest">
go install github.com/danielmiessler/ Fabric /cmd/ Fabric @latest

外壳完成

Fabric为ZSH,Bash和Fish壳提供了外壳完成脚本,通过为命令和选项提供选项卡完成,可以更轻松地使用CLI。

ZSH完成

启用ZSH完成:

Fabric ~/.zsh/completions/ # Add the directory to fpath in your .zshrc before compinit echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc echo 'autoload -Uz compinit && compinit' >> ~/.zshrc">
 # Copy the completion file to a directory in your $fpath
mkdir -p ~ /.zsh/completions
cp completions/_ Fabric ~ /.zsh/completions/

# Add the directory to fpath in your .zshrc before compinit
echo ' fpath=(~/.zsh/completions $fpath) ' >> ~ /.zshrc
echo ' autoload -Uz compinit && compinit ' >> ~ /.zshrc

bash完成

启用bash完成:

Fabric .bash' >> ~/.bashrc # Or copy to the system-wide bash completion directory sudo cp completions/ Fabric .bash /etc/bash_completion.d/">
 # Source the completion script in your .bashrc
echo ' source /path/to/ Fabric /completions/ Fabric .bash ' >> ~ /.bashrc

# Or copy to the system-wide bash completion directory
sudo cp completions/ Fabric .bash /etc/bash_completion.d/

鱼的完工

使鱼填满:

 # Copy the completion file to the fish completions directory
mkdir -p ~ /.config/fish/completions
cp completions/ Fabric .fish ~ /.config/fish/completions/

用法

一旦设置了所有设置,这就是如何使用它的方法。

 Fabric -h
Fabric [OPTIONS] Application Options: -p, --pattern= Choose a pattern from the available patterns -v, --variable= Values for pattern variables, e.g. -v=#role:expert -v=#points:30 -C, --context= Choose a context from the available contexts --session= Choose a session from the available sessions -a, --attachment= Attachment path or URL (e.g. for OpenAI image recognition messages) -S, --setup Run setup for all reconfigurable parts of Fabric -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) -r, --raw Use the defaults of the model without sending chat options (like temperature etc.) and use the user role instead of the system role for patterns. -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 --modelContextLength= Model context length (only affects ollama) -o, --output= Output to file --output-session Output the entire session (also a temporary one) to the output file -n, --latest= Number of latest patterns to list (default: 0) -d, --changeDefaultModel Change default model -y, --youtube= YouTube video or play list "URL" to grab transcript, comments from it and send to chat or print it put to the console and store it in the output file --playlist Prefer playlist over video if both ids are present in the URL --transcript Grab transcript from YouTube video and send to chat (it is used per default). --transcript-with-timestamps Grab transcript from YouTube video with timestamps and send to chat --comments Grab comments from YouTube video and send to chat --metadata Output video metadata -g, --language= Specify the Language Code for the chat, e.g. -g=en -g=zh -u, --scrape_url= Scrape website URL to markdown using Jina AI -q, --scrape_question= Search question using Jina AI -e, --seed= Seed to be used for LMM generation -w, --wipecontext= Wipe context -W, --wipesession= Wipe session --printcontext= Print context --printsession= Print session --readability Convert HTML input into a clean, readable view --input-has-vars Apply variables to user input --dry-run Show what would be sent to the model without actually sending it --serve Serve the Fabric Rest API --serveOllama Serve the Fabric Rest API with ollama endpoints --address= The address to bind the REST API (default: :8080) --api-key= API key used to secure server routes --config= Path to YAML config file --version Print current version --listextensions List all registered extensions --addextension= Register a new extension from config file path --rmextension= Remove a registered extension by name --strategy= Choose a strategy from the available strategies --liststrategies List all strategies --listvendors List all vendors --shell-complete-list Output raw list without headers/formatting (for shell completion) --search Enable web search tool for supported models (Anthropic, OpenAI) --search-location= Set location for web search results (e.g., 'America/Los_Angeles') --image-file= Save generated image to specified file path (e.g., 'output.png') --image-size= Image dimensions: 1024x1024, 1536x1024, 1024x1536, auto (default: auto) --image-quality= Image quality: low, medium, high, auto (default: auto) --image-compression= Compression level 0-100 for JPEG/WebP formats (default: not set) --image-background= Background type: opaque, transparent (default: opaque, only for PNG/WebP) --suppress-think Suppress text enclosed in thinking tags --think-start-tag= Start tag for thinking sections (default: ) --think-end-tag= End tag for thinking sections (default: ) --disable-responses-api Disable OpenAI Responses API (default: false) --voice= TTS voice name for supported models (e.g., Kore, Charon, Puck) (default: Kore) --list-gemini-voices List all available Gemini TTS voices Help Options: -h, --help Show this help message">
Usage:
  Fabric [OPTIONS]

Application Options:
  -p, --pattern=                    Choose a pattern from the available patterns
  -v, --variable=                   Values for pattern variables, e.g. -v=#role:expert -v=#points:30
  -C, --context=                    Choose a context from the available contexts
      --session=                    Choose a session from the available sessions
  -a, --attachment=                 Attachment path or URL (e.g. for OpenAI image recognition messages)
  -S, --setup                       Run setup for all reconfigurable parts of Fabric
  -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)
  -r, --raw                         Use the defaults of the model without sending chat options (like
                                    temperature etc.) and use the user role instead of the system role for
                                    patterns.
  -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
      --modelContextLength=         Model context length (only affects ollama)
  -o, --output=                     Output to file
      --output-session              Output the entire session (also a temporary one) to the output file
  -n, --latest=                     Number of latest patterns to list (default: 0)
  -d, --changeDefaultModel          Change default model
  -y, --youtube=                    YouTube video or play list "URL" to grab transcript, comments from it
                                    and send to chat or print it put to the console and store it in the
                                    output file
      --playlist                    Prefer playlist over video if both ids are present in the URL
      --transcript                  Grab transcript from YouTube video and send to chat (it is used per
                                    default).
      --transcript-with-timestamps  Grab transcript from YouTube video with timestamps and send to chat
      --comments                    Grab comments from YouTube video and send to chat
      --metadata                    Output video metadata
  -g, --language=                   Specify the Language Code for the chat, e.g. -g=en -g=zh
  -u, --scrape_url=                 Scrape website URL to markdown using Jina AI
  -q, --scrape_question=            Search question using Jina AI
  -e, --seed=                       Seed to be used for LMM generation
  -w, --wipecontext=                Wipe context
  -W, --wipesession=                Wipe session
      --printcontext=               Print context
      --printsession=               Print session
      --readability                 Convert HTML input into a clean, readable view
      --input-has-vars              Apply variables to user input
      --dry-run                     Show what would be sent to the model without actually sending it
      --serve                       Serve the Fabric Rest API
      --serveOllama                 Serve the Fabric Rest API with ollama endpoints
      --address=                    The address to bind the REST API (default: :8080)
      --api-key=                    API key used to secure server routes
      --config=                     Path to YAML config file
      --version                     Print current version
      --listextensions              List all registered extensions
      --addextension=               Register a new extension from config file path
      --rmextension=                Remove a registered extension by name
      --strategy=                   Choose a strategy from the available strategies
      --liststrategies              List all strategies
      --listvendors                 List all vendors
      --shell-complete-list         Output raw list without headers/formatting (for shell completion)
      --search                      Enable web search tool for supported models (Anthropic, OpenAI)
      --search-location=            Set location for web search results (e.g., 'America/Los_Angeles')
      --image-file=                 Save generated image to specified file path (e.g., 'output.png')
      --image-size=                 Image dimensions: 1024x1024, 1536x1024, 1024x1536, auto (default: auto)
      --image-quality=              Image quality: low, medium, high, auto (default: auto)
      --image-compression=          Compression level 0-100 for JPEG/WebP formats (default: not set)
      --image-background=           Background type: opaque, transparent (default: opaque, only for
                                    PNG/WebP)
      --suppress-think              Suppress text enclosed in thinking tags
      --think-start-tag=            Start tag for thinking sections (default: )
      --think-end-tag=              End tag for thinking sections (default: )
      --disable-responses-api       Disable OpenAI Responses API (default: false)
      --voice=                      TTS voice name for supported models (e.g., Kore, Charon, Puck)
                                    (default: Kore)
      --list-gemini-voices          List all available Gemini TTS voices

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

我们提示的方法

Fabric图案与您看到的大多数提示不同。

  • 首先,我们使用Markdown来帮助确保最大的可读性和编辑性。这不仅有助于创造者做一个好人,还可以帮助他们深入了解它的作用。重要的是,这还包括您发送的AI!

这是Fabric图案的示例。

https://github.co**m*/danielmiessler/Fabric/blob/main/patterns/extract_wisdom/system.md
  • 接下来,我们在说明中非常清楚,我们使用Markdown结构来强调我们想要AI的工作以及按什么顺序进行的。

  • 最后,我们倾向于几乎完全使用提示的系统部分。在过去一年多的时间里,我们已经看到了这样做的更大功效。如果发生变化,或者我们显示的数据说其他情况,我们将进行调整。

例子

以下示例使用MacOS pbpaste从剪贴板粘贴。有关Windows和Linux替代方案,请参见下面的PBPASTE部分。

现在,让我们看一些您可以用Fabric做的事情。

  1. 根据STDIN的输入运行汇总模式。在这种情况下,文章的正文。

    pbpaste | Fabric --pattern summarize
  2. 使用-stream选项运行Analyze_Claims模式,以获得即时和流式的结果。

    pbpaste | Fabric --stream --pattern analyze_claims
  3. 使用 - 流选项运行Extract_wisdom模式,以从任何YouTube视频中获取即时和流式传输结果(就像原始介绍视频中一样)。

    Fabric -y " https://yo**ut*ube.com/watch?v=uXs-zPc63kM " --stream --pattern extract_wisdom
  4. 创建模式 - 您必须使用该模式创建.md文件,然后将其保存到〜/.config/ Fabric /datterns/[yourpatternname]。

  5. 在网站上运行Analyze_Claims模式。 Fabric使用Jina AI将URL刮入降级格式之前,然后将其发送到模型。

     Fabric -u https://g**i*thub.com/danielmiessler/Fabric/ -p analyze_claims

只使用模式



如果您不想做任何花哨的事情,而只需要大量出色的提示,则可以导航到 /模式目录并开始探索!

我们希望,如果您什么也不使用Fabric ,那么模式就会使该项目有用。

您可以在任何AI应用程序中使用的任何模式,无论是CHATGPT还是其他应用程序或网站。我们的计划和预测是,人们很快将分享比我们发表的人分享的更多,而他们将比我们更好。

赢得胜利的智慧。

迅速的策略

Fabric还采用诸如“思想链”或“草稿链”之类的促进策略,除基本模式外还可以使用。

通过少写纸张和学习的思维生成部分来促使迅速策略的示例,请参阅更快的思维。

/策略目录中的每种策略都可以作为小型JSON文件提供。

策略的及时修改将应用于系统提示,并将其传递到聊天会议中的LLM。

使用Fabric -s,然后选择在您的〜/ .config/ Fabric目录中安装策略的选项。

自定义模式

您可能需要使用Fabric来创建自己的自定义模式,但不要与他人共享。没问题!

Fabric现在支持专用的自定义模式目录,该目录将您的个人模式与内置模式分开。这意味着当您更新Fabric的内置图案时,您的自定义图案不会被覆盖。

设置自定义模式

  1. 运行Fabric设置:

     Fabric --setup
  2. 从工具菜单中选择“自定义模式”选项,然后输入您所需的目录路径(例如,〜/my-custom-patterns)

  3. 如果目录不存在, Fabric将自动创建该目录。

使用自定义模式

  1. 创建您的自定义模式目录结构:

    mkdir -p ~ /my-custom-patterns/my-analyzer
  2. 创建您的模式文件

     echo " You are an expert analyzer of ... " > ~ /my-custom-patterns/my-analyzer/system.md
  3. 使用您的自定义模式:

     Fabric --pattern my-analyzer " analyze this text "

它如何工作

  • 优先系统:自定义模式优先于具有相同名称的内置模式
  • 无缝集成:自定义图案出现在Fabric中 - listpatterns与内置的图案
  • 更新安全:您的自定义图案永远不会受到Fabric的影响 - updatepatterns
  • 默认情况下私人:除非您明确共享,否则自定义模式保持私密

您的自定义图案是完全私人的,不会受到Fabric更新的影响!

助手应用程序

Fabric还利用一些核心辅助应用程序(工具),使其更容易与您的各种工作流集成。这里有一些例子:

to_pdf

TO_PDF是一个助手命令,可将乳胶文件转换为PDF格式。您可以这样使用:

to_pdf input.tex

这将从同一目录中的输入latex文件中创建一个PDF文件。

您也可以将其与stdin一起使用,该stdin与write_latex模式完美搭配:

 echo " ai security primer " | Fabric --pattern write_latex | to_pdf

这将在当前目录中创建一个名为output.pdf的PDF文件。

TO_PDF安装

要安装to_pdf,请以与安装Fabric相同的方式安装它,只需使用不同的存储库名称即可。

go install github.com/danielmiessler/ Fabric /cmd/to_pdf@latest

确保系统上安装了乳胶发行版(例如Tex Live或Miktex),因为TO_PDF要求PDFLATEX在系统的路径中可用。

code_helper

Code_helper与create_coding_feature模式结合使用。它生成了代码目录的JSON表示形式,该目录可将其送入AI模型中,并带有指令以创建新功能或以指定方式编辑代码。

有关详细信息,请参见“创建编码功能模式”。

首先使用:

go install github.com/danielmiessler/ Fabric /cmd/code_helper@latest

pbpaste

这些示例使用MacOS程序PBPASTE将内容从剪贴板粘贴到Fabric中作为输入。 pbpaste在Windows或Linux上不可用,但是有其他选择。

在Windows上,您可以通过PowerShell命令提示符使用PowerShell命令get-clipboard。如果您愿意,也可以将其与PBPASTE相称。如果您使用的是经典的PowerShell,请编辑文件〜 documents windowspowershell .profile.ps1,或者如果使用powerShell core,请编辑〜 documents powershell .profile .profile.ps1并添加别名,并添加别名,

 Set-Alias pbpaste Get-Clipboard

在Linux上,您可以使用XClip -selection剪贴板-O从剪贴板粘贴。您可能需要使用软件包管理器安装XCLIP。对于包括Ubuntu在内的Debian系统,

sudo apt update
sudo apt install xclip -y

您还可以通过编辑〜/.bashrc或〜/.zshrc创建一个别名并添加别名,

 alias pbpaste= ' xclip -selection clipboard -o ' 

Web界面

Fabric现在包括一个内置的Web界面,该界面提供了命令行界面的GUI替代方案,并为那些想要开始使用Web开发或博客的人提供了一个开箱即用的网站。您可以将此应用程序用作Fabric的GUI界面,准备好使用博客站点的GUI界面,或者可以使用自己项目的网站模板。

Web/src/lib/content目录包括启动器.obsidian/和模板/目录,从而使您可以将Web/src/lib/content/Directory作为obsidian.md Vault打开Web/src/lib/content/Directory。准备出版后,您可以将帖子放在帖子目录中。

安装

可以通过导航到Web目录,并使用NPM安装,PNPM安装或您喜欢的软件包管理器来安装GUI。然后只需运行开发服务器即可启动应用程序。

您需要使用Fabric - 塞命令在单独的终端中运行Fabric 。

来自Fabric Project Web/ Directory:

npm run dev

# # or ##

pnpm run dev

# # or your equivalent

简化UI

运行简化的用户界面:

 # Install required dependencies
pip install -r requirements.txt

# Or manually install dependencies
pip install streamlit pandas matplotlib seaborn numpy python-dotenv pyperclip

# Run the Streamlit app
streamlit run streamlit.py

简化的UI提供了一个用户友好的接口:

  • 奔跑和链式模式
  • 管理模式输出
  • 创建和编辑模式
  • 分析模式结果

剪贴板支持

简化的UI支持跨不同平台的剪贴板操作:

  • MACOS :使用PBCOPY和PBPASTE(内置)
  • Windows :使用PyperClip库(安装PIP安装PyperClip)
  • Linux :使用XCLIP(安装sudo apt-get install xclip或等效的Linux发行版)

笔记

特别感谢以下人员的灵感和贡献!

  • 乔纳森·邓恩(Jonathan Dunn)是该项目中绝对的MVP开发人员,包括率领新的GO版本以及GUI!所有这些,同时也是一名全职医生!
  • 卡莱布·西玛(Caleb Sima)将我推向是否将这个公共项目的边缘推向了边缘。
  • 尤金·艾斯勒(Eugen Eisler)弗雷德里克·罗斯(Frederick Ros)对Go版本的宝贵贡献
  • 大卫·彼得斯(David Peters)在网络界面上的工作。
  • 乔尔教区(Joel Parish)在项目的github目录结构上提供超级有用的输入。
  • 约瑟夫·塔克(Joseph Thacker)的想法是-c上下文标志,该标志在所有模式查询中添加了./config/ Fabric / Directory中的预先创建的上下文。
  • 杰森·哈迪克斯(Jason Haddix)在发送到云模型之前,在发送到云模型之前,使用llama2清洁客户数据,然后将其发送到GPT-4进行分析,以便使用本地模型进行过滤内容。
  • 安德烈·格拉(Andre Guerra)协助众多组件,以使事情变得更简单,更可维护。

主要贡献者

贡献者

用贡献制成。

Fabric是由丹尼尔·米斯勒(Daniel Miessler)于2024年1月创建的。

下载源码

通过命令行克隆项目:

git clone https://github.com/danielmiessler/Fabric.git