GithubHelp home page GithubHelp logo

autolabel-gpt's Introduction

AutoLabel-GPT

使用 GPT 模型的接口完成自动化数据标注。

支持使用多个 API 密钥来组成 API 池, 允许并发访问 API,提高效率并减少触及速率限制的风险。循环使用提供的 API 密钥,该工具可以同时处理更大量的请求,使数据标注过程更快速。

配置

config.json 格式

{
    "model_type": "gpt-3.5-turbo",
    "api_url": "https://api.openai.com/v1/chat/completions",
    "api_keys": [
        "YOUR_API_KEY_1",
        "YOUR_API_KEY_2"
    ]
}

使用方法

安装依赖

pip install requests

示例用法

  1. 创建 config.json: 创建一个包含必要配置详情的 config.json 文件, 或者直接通过参数字典构造ApiConfig实例

  2. 运行脚本: 使用提供的脚本为一组提示生成响应。

if __name__ == "__main__":
    api_config = ApiConfig.from_json_file("./config.json")
    system_prompt = "You are a helpful assistant."

    prompts = [
        "What is the capital of France?",
        "Explain the theory of relativity.",
        "How does quantum computing work?",
        "Hi, say this is a test."
    ]

    for prompt, response in process_prompts_with_retries(api_config, prompts, system_prompt=system_prompt):
        response = response.strip().replace("\n", "")
        print(f"Prompt: {prompt}\nResponse: {response}\n")

autolabel-gpt's People

Contributors

hammershock avatar

Stargazers

 avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.