指南 3个标注团队操作手册:提升标注速度与质量

使用Ragas评估RAG

该模板使用Ragas框架来评估您的RAG流程。当给定提示时,它将利用Ragas和OpenAI返回以下内容:

  • 针对提示生成的LLM响应(ML后端示例使用OpenAI)。
  • Ragas 对 faithfulnessanswer relevancy 的评分。
  • 对响应进行LLM生成的评估。
  • 全面概述了具体哪些文档被用作上下文。

前提条件

此模板需要ML后端才能工作。请按照RAG快速标注入门指南中的说明将ML后端连接到您的项目。

您需要一个OpenAI API密钥和一个包含文档文件的目录作为上下文。

提示

如果您只是想尝试这个模板和机器学习后端,可以克隆Label Studio仓库并使用label-studio\docs目录作为您的上下文。

配置标注界面

为您的项目使用以下标注配置:

<View>
    <Style>
        .lsf-main-content.lsf-requesting .prompt::before { content: ' loading...'; color: #808080; }
        .text-container {
        background-color: white;
        border-radius: 10px;
        box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
        padding: 20px;
        font-family: 'Courier New', monospace;
        line-height: 1.6;
        font-size: 16px;
        }
        .ragas input {
            background: none;
            border: none;
            padding: 0;
            margin-top: -8px;
            font-size: 20px;
            font-weight: 600;
        }
        .ragas input::-webkit-inner-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }
    </Style>
    <Header value="Question:"/>
    <View className="text-container">
        <Text name="context" value="$text"/>
    </View>
    <Header value="Additional instructions for the LLM prompt (optional):"/>
    <View className="prompt">
        <TextArea name="prompt"
                  toName="context"
                  rows="4"
                  editable="true"
                  showSubmitButton="false"
                  placeholder="Provide additional instructions here then Shift+Enter - to provide none, simply enter a space then shift+enter."
        />
    </View>
    <Header value="Response:"/>
    <TextArea name="response"
              toName="context"
              rows="4"
              editable="true"
              maxSubmissions="1"
              showSubmitButton="false"
              smart="false"
              placeholder="Generated response will appear here..."
    />
    <View className="ragas" >
    <View style="display: flex;">
      <Header style="padding-right: 1em;" value="Ragas evaluation (averaged, 0 to 100):"/><Number name="float_eval" toName="context" defaultValue="0" />
    </View>
    <TextArea name="ragas"
              toName="context"
              rows="2"
              maxSubmissions="1"
              showSubmitButton="false"
              smart="false"
              placeholder="Ragas evaluation will appear here..."
    />
    </View>
    <View className="evaluation" >
    <View style="display: flex;">
      <Header style="padding-right: 1em;" value="Textual evaluation:"/>
    </View>
    <TextArea name="evaluation"
              toName="context"
              rows="2"
              maxSubmissions="1"
              showSubmitButton="false"
              smart="false"
              placeholder="Textual evaluation will appear here..."
    />
    </View>
    <Header value="Documentation:"/>
    <View className="documentation">
    <TextArea name="documentation"
              toName="context"
              rows="2"
              maxSubmissions="1"
              showSubmitButton="false"
              smart="false"
              placeholder="Retrieved documentation will appear here..."
    />
    </View>
</View>

此配置包含以下元素:

  • - All labeling configurations must include a base View tag. In this configuration, the View tag is used to configure the display of blocks, similar to the div tag in HTML. It helps in organizing the layout of the labeling interface.
  • - Header标签用于在标注界面中显示标题或题头。标题文本通过value参数定义。
  • - TextArea标签提供了一个可输入文本的字段。在本例中,大部分文本字段将由ML后端自动完成。有一个字段可供您向LLM提供额外指令(例如,要求其将答案格式化为列表)。按Shift + Enter提交您的指令。

输入数据

使用上述配置时,您需要将输入数据结构化为包含text元素。这是LLM提示词。例如:

[
  {
    "id": 1,
    "data": {
      "text": "What are the system requirements for Label Studio?"
    }
  },
  {
    "id": 2,
    "data": {
      "text": "How do I update Label Studio?"
    }
  }
]
专为各种规模的团队设计 版本比较