Code Monkey home page Code Monkey logo

xielong / ai-hub Goto Github PK

View Code? Open in Web Editor NEW
40.0 3.0 7.0 2.91 MB

AI Hub 是一个为了接入包括ChatGPT、Baichuan、Zhipu、混元、MiniMax、Moonshot等多种大型语言模型而设计的服务。它旨在积累和管理各种有效的模型调用提示(prompt),并对这些大型语言模型进行持续的测试和评估。

License: Apache License 2.0

Java 74.47% HTML 1.66% CSS 2.55% JavaScript 20.75% Dockerfile 0.56%
baichuan chatgpt-api zhipuai tongyiqianwen wenxin wenxinyiyan llm minimax hunyuan xinghuo

ai-hub's Introduction

AI Hub Project

简介

AI Hub旨在持续测试和评估主流大型语言模型,同时积累和管理各种有效的模型调用提示(prompt)。目前,AI Hub已接入国内所有主流的大型语言模型,包括文心一言、腾讯混元、智谱AI、MiniMax、百川智能等,并计划持续追踪、接入和评估新模型。

已支持模型列表:

  1. OpenAI / gpt-4-turbo
  2. OpenAI / gpt-3.5-turbo
  3. Baidu / ERNIE-Bot-4(文心一言4)
  4. Baidu / ERNIE-Bot-turbo(文心一言)
  5. Zhipu / glm-4(智谱GLM-4)
  6. Zhipu / chatGLM_turbo(智谱chatGLM)
  7. Ali / qwen-plus(通义千问plus)
  8. Ali / qwen-turbo(通义千问)
  9. Tencent / ChatPro(腾讯混元高级版)
  10. Tencent / ChatStd(腾讯混元标准版)
  11. Baichuan / Baichuan2-Turbo(百川)
  12. Minimax / abab5.5-chat(MiniMax)
  13. Minimax / abab6-chat(MiniMax)
  14. Xunfei / Spark3.1(讯飞星火)
  15. Moonshot / moonshot-v1-8k (月之暗面)
  16. Xunfei / Spark3.5 (讯飞星火3.5)
  17. ByteDance / Skylark-chat (字节豆包)
  18. Lingyi / yi-34b-chat-0205 (零一万物)
  19. Lingyi / yi-34b-chat-200k (零一万物)
  20. Lingyi / yi-vl-plus (零一万物)

chat-demo

使用前请在 Settings 页面设置模型的 credentials: settings

评估结果

英文翻译

测试用例看这里 英文翻译

编程

测试用例看这里 英文翻译

指令输出

测试用例看这里 英文翻译

大模型接入

如果你想自己接入列表中的大模型,可以通过以下方式。

Rest 服务

启动 ai-hub-server,访问

http://127.0.0.1:3000/api/v1/models/${provider}/${model}:chat

Post:

{
    "input": "${input}"
}

Java 代码接入

可以参考这里

@Service
public class AIModelInvokerFactory {

    private final ApplicationContext context;

    @Autowired
    public AIModelInvokerFactory(ApplicationContext context) {
        this.context = context;
    }

    public AIModelInvoker getProviderAdapter(String providerName) {
        AIProvider provider = AIProvider.fromName(providerName);

        switch (provider) {
            case OPENAI:
                return context.getBean(OpenAIInvoker.class);
            case BAICHUAN:
                return context.getBean(BaichuanInvoker.class);
            case ALI:
                return context.getBean(AliInvoker.class);
            case BAIDU:
                return context.getBean(BaiduInvoker.class);
            case ZHIPU:
                return context.getBean(ZhipuInvoker.class);
            case TENCENT:
                return context.getBean(TencentInvoker.class);
            case XUNFEI:
                return context.getBean(XunfeiInvoker.class);
            case MINIMAX:
                return context.getBean(MiniMaxInvoker.class);
            default:
                throw new IllegalArgumentException("Unknown provider: " + provider);
        }
    }

}

运行

Docker

推荐使用 docker-compose 启动服务

cd docker
docker-compose up -d

数据库

参考脚本

前端

cd ai-hub-fe
npm run start

服务端

需要 JDK 11 以上版本

cd ai-hub-server
mvn clean package
java -jar ai-hub-server-1.0.0-SNAPSHOT-exec.jar

测试集

z-bench 测试集

价格

Company Model Price Notes
MiniMax abab6 0.2元/千tokens
MiniMax abab5.5 0.015元/千tokens
Zhipu GLM-4 0.1元/千tokens
Zhipu GLM-3-Turbo 0.005元/千tokens
Ali qwen-plus 0.02元/千tokens
Ali qwen-turbo 0.008元/千tokens
Baichuan Baichuan2-Turbo 0.008元/千tokens
OpenAI gpt-4-0125-preview $0.01/1k tokens(input)  $0.03/1k tokens (output)
OpenAI gpt-3.5-turbo-0125 $0.0005/1k tokens (input)  $0.0015/1k tokens (output)
Baidu ERNIE-Bot-turbo 0.012元/千tokens
Baidu ERNIE-Bot 4.0 0.12元/千tokens
Tencent ChatStd 0.01元/千tokens 赠10万token的免费调用额度,有效期12个月
Tencent ChatPro 0.10元/千tokens 赠10万token的免费调用额度,有效期12个月
ByteDance Skylark-chat 0.011元/千tokens
Xunfei Spark3.5 0.03元/千tokens 企业赠500万token的免费调用额度,有效期12个月
Xunfei Spark3.1 0.03元/千tokens 企业赠500万token的免费调用额度,有效期12个月
Moonshot moonshot-v1-8k 0.012元/千tokens 新账户赠送15元
Lingyi yi-34b-chat-0205 0.0025元/千tokens 新账户赠送60元
Lingyi yi-vl-plus 0.006元/千tokens 新账户赠送60元
Lingyi yi-34b-chat-200k 0.012元/千tokens 新账户赠送60元

ai-hub's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ai-hub's Issues

openai多调用几次会失败

openai前几次调用成功,后续多调用几次会报:HttpClientWithRetry#onRetry:35 => Retry failed with exception: java.io.IOException: Received fatal alert: handshake_failure

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.