跳至主要内容

在 GitHub 仓库中存储提示词

直接在您的 GitHub 仓库中存储提示,以利用自动文本摘要和其他 AI 驱动的功能。

本文内容

提示可以直接作为文件存储在 GitHub 仓库中。这使您能够在有序的 UI 中查看提示,向非技术利益相关者共享提示,并对模型和提示的调整进行无缝迭代和比较。

优势

  • 轻松集成全新的 GitHub AI 开发工具套件。
  • 从简单到复杂的使用场景都简易且可扩展。
  • 使用广泛支持的格式,兼容现有工具。

支持的文件格式

在 YAML 文件中存储提示。

文件可以位于仓库的任何位置,但 必须使用扩展名 .prompt.yml.prompt.yaml

示例

YAML
name: Text Summarizer
description: Summarizes input text concisely
model: openai/gpt-4o-mini
modelParameters:
  temperature: 0.5
messages:
  - role: system
    content: You are a text summarizer. Your only job is to summarize text given to you.
  - role: user
    content: |
      Summarize the given text, beginning with "Summary -":
      <text>
      {{input}}
      </text>
testData:
  - input: |
      The quick brown fox jumped over the lazy dog.
      The dog was too tired to react.
    expected: Summary - A fox jumped over a lazy, unresponsive dog.
evaluators:
  - name: Output should start with 'Summary -'
    string:
      startsWith: 'Summary -'

提示结构

提示包含两个关键部分

  • 运行时信息(必需)
    • 提示模板(系统、用户等),使用简单的 {{variable}} 占位符
  • 开发信息(可选)
    • 可供人阅读的名称和描述
    • 模型标识符和参数
    • 用于测试和评估的示例数据
    • 描述评估者本身的数据

限制

您无法为以下内容存储提示

  • 复杂的模板语言
  • 专有或复杂的文件格式(例如 .ghprompt,或 .prompty
© . This site is unofficial and not affiliated with GitHub, Inc.