1 Star 1 Fork 0

William / octet.chat

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

🚀 Octet.Chat

CI Maven Central README English GitHub

这是一个Java实现的LLMs项目。你可以用它部署自己的私有服务,支持 Llama2GPT 模型及其他开源模型。

提供

  • 简单易用的Java库 llama-java-core
  • 完整的应用服务 octet-chat-app
    • 服务端部署,快速实现私有化服务
    • 命令行交互,简单的本地聊天交互

主要特点

  • 🦙 基于 llama.cpp 构建
  • 😊 支持 AI Agent,基于 Qwen-chat 实现 Function calling
  • 🤖 支持 并行推理连续对话文本生成
  • 📦 支持 Llama2GPT 模型及其他开源模型,例如:Baichuan 7BQwen 7B

最近更新

...

  • 🚀 新增自定义AI角色、优化OpenAPI
  • 🚀 新增AI智能体,可调用插件的能力
  • 🚀 支持动态温度采样
  • 🚀 Octet-chat-app 增加了 WebUI

快速开始

[!NOTE]

你可以自行量化原始模型或搜索 huggingface 获取开源模型。

🤖 命令行交互

如何使用

编辑 characters.template.json 设置一个自定义的AI角色。

示例角色
{
  "name": "Assistant Octet",
  "agent_mode": false,
  "prompt": "Answer the questions.",
  "model_parameter": {
    "model_path": "/models/ggml-model-7b_m-q6_k.gguf",
    "model_type": "LLAMA2",
    "context_size": 4096,
    "threads": 6,
    "threads_batch": 6,
    "mmap": true,
    "mlock": false,
    "verbose": true
  },
  "generate_parameter": {
    "temperature": 0.85,
    "repeat_penalty": 1.2,
    "top_k": 40,
    "top_p": 0.9,
    "verbose_prompt": true,
    "user": "User",
    "assistant": "Octet"
  }
}

运行命令行交互并指定刚才设置的角色名称,开始聊天:

java -jar octet-chat-app.jar --character YOUR_CHARACTER

[!TIP]

使用 help 查看更多参数,示例如下:

java -jar octet-chat-app.jar --help

usage: Octet.Chat
    --app <arg>          App launch type: cli | api (default: cli).
 -c,--completions        Use completions mode.
 -ch,--character <arg>   Load the specified AI character, default:
                         llama2-chat.
 -h,--help               Show this help message and exit.
 -q,--questions <arg>    Load the specified user question list, example:
                         /PATH/questions.txt.

🚀 AI Agent

[!NOTE]

实现基于 Qwen-chat 系列模型,更多信息请参考:Qwen Github

如何使用

下载 Qwen-chat 模型,编辑 octet.json 设置模型文件路径,将 agent_mode 修改为 true 即可开启智能体模式。

  • 目前实现了两个插件,作为示例你可以继续丰富扩展它们。
插件 描述
时间查询 可以查询当前系统时间的插件。
接口调用 通用的接口调用插件,基于此你可以实现天气、文生图、搜索等服务的接入。

插件配置文件示例:plugins.json

Octet Agent

🖥 Web UI

如何使用

和命令行交互一样,首先设置一个自定义的AI角色。

启动服务,打开浏览器开始聊天,默认地址:http://YOUR_IP_ADDR:8152/

# Default URL: http://YOUR_IP_ADDR:8152/

cd <YOUR_PATH>/octet-chat-app
bash app_server.sh start YOUR_CHARACTER

webui.png

[!TIP]

你也可以将API服务集成到你的应用中,例如:VsCodeAppWechat等。

如何调用API

Api docs: http://127.0.0.1:8152/swagger-ui.html

curl --location 'http://127.0.0.1:8152/v1/chat/completions' \
--header 'Content-Type: application/json' \
--data '{
    "messages": [
        {
            "role": "USER",
            "content": "Who are you?"
        }
    ],
    "user": "User",
    "stream": true
}'

接口将以流的方式返回数据:

{
    "id": "octetchat-98fhd2dvj7",
    "model": "Llama2-chat",
    "created": 1695614393810,
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "你好"
            },
            "finish_reason": "NONE"
        }
    ]
}

帮助文档

开发文档

角色配置

免责声明

[!IMPORTANT]

  • 本项目不提供任何模型,请自行获取模型文件并遵守相关协议。
  • 请勿将本项目用于非法用途,包括但不限于商业用途、盈利用途、以及违反法律法规的用途。
  • 因使用本项目所产生的任何法律责任,由使用者自行承担,本项目不承担任何法律责任。

问题反馈

  • 如果你有任何疑问,欢迎在GitHub Issue中提交。
MIT License Copyright (c) 2023 William Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Build your own private auto agent using Octet.Chat. 展开 收起
Java 等 5 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/octets/octet.chat.git
git@gitee.com:octets/octet.chat.git
octets
octet.chat
octet.chat
main

搜索帮助