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

Langchain搜索智能体

本示例演示如何将Label Studio与自定义机器学习后端结合使用。

它使用基于Langchain的智能体,该智能体接收文本输入,搜索Google,并根据搜索结果返回答案(也称为检索增强生成)。

开始之前

在开始之前,您必须安装Label Studio ML后端

本教程使用langchain_search_agent示例

前提条件

要使用谷歌搜索引擎,您需要拥有谷歌自定义搜索引擎(CSE)的API密钥和搜索引擎ID。

GOOGLE_API_KEY=<your_google_api_key>
GOOGLE_CSE_ID=<your_google_search_engine_id>

更多信息,请参阅Programmable Search Engine ID

使用OpenAI

要使用OpenAI,您需要拥有一个OpenAI API密钥。

OPENAI_API_KEY=<your_openai_api_key>

更多信息,请参阅Where do I find my OpenAI API Key?

标注界面

标注界面必须包含:

  • 输入提示
  • LLM响应
  • 搜索结果片段
  • 分类标签

示例


<View>
    <Style>
        .lsf-main-content.lsf-requesting .prompt::before { content: ' loading...'; color: #808080; }
    </Style>
    <Text name="input" value="$text"/>
    <View className="prompt">
        <TextArea name="prompt" toName="input" maxSubmissions="1" editable="true"/>
    </View>
    <TextArea name="response" toName="input" maxSubmissions="1" editable="true"/>
    <TextArea name="snippets" toName="input"/>
    <Choices name="classification" toName="input" choice="single" showInLine="true">
        <Choice value="Good"/>
        <Choice value="Bad"/>
    </Choices>
</View>

快速入门

  1. http://localhost:9090上构建并启动机器学习后端:
docker-compose up
  1. 验证后端是否正在运行:
$ curl http://localhost:9090/health
{"status":"UP"}
  1. 在Label Studio中创建一个项目。然后从项目设置的模型页面,连接模型。默认URL是http://localhost:9090