Tabby v0.21.0 发布解析:llamafile 后端接入、HTTP 模型限流与索引格式迁移
【免费下载链接】tabbySelf-hosted AI coding assistant项目地址: https://gitcode.com/GitHub_Trending/tab/tabby
Tabby v0.21.0(2024-12-02 发布)是一次围绕"HTTP 模型后端"与"Answer Engine 使用体验"展开的迭代。本篇基于仓库内的发布说明 v0.21.0.md、对应的 CHANGELOG.md 条目以及相关源码,完整拆解该版本的四项新特性、升级注意事项与全部修复项,并结合 配置定义、限流实现 与 GraphQL 模式 给出源码级的原理佐证,帮助你在升级 0.21.0 后正确配置 llamafile 后端、设置请求限流,并理解索引目录被重建的原因。
升级前必读:索引格式变更
发布说明的 Notice 部分给出了一个影响所有自托管部署的关键信息:
Due to changes in the indexing format, the
~/.tabby/indexdirectory will be automatically removed before any further indexing jobs are run. It is expected that the indexing jobs will be re-run (instead of incrementally) after the upgrade.
翻译过来即:由于索引格式发生了变化,在任何后续的索引任务运行之前,~/.tabby/index目录会被自动删除。升级 0.21.0 后,你需要预期以下行为:
- 索引任务将全量重跑,而不是像以前那样增量更新;
- 删除与重建是服务端自动完成的,无需(也不建议)手动干预
~/.tabby/index目录; - 如果你的代码库规模较大,升级窗口内索引重建会消耗一段时间的磁盘 I/O 与向量计算资源,建议在低峰期执行升级。
这一行为是 0.21.0 版本升级计划中唯一需要运维侧提前知悉的事项,其余功能均为增量能力。
新特性一:支持连接 llamafile 模型后端
llamafile 是一个"单文件分发并运行 LLM"的方案,它内嵌了 llama.cpp 服务器并暴露 OpenAI 兼容的 chat-completions 端点。Tabby 0.21.0 允许直接把它作为模型后端接入。官方接入指南见 llamafile.md,其核心要点如下。
端口冲突与启动方式
llamafile 默认使用8080端口,而 Tabby 的默认 Web 端口同样是8080,二者会冲突。官方建议 llamafile 通过--port参数换到8081等端口;若需要 embedding 能力,则需同时启用--embedding与--port两个选项。
三类模型的配置示例
llamafile 的三种能力对应 Tabby 中三种不同的kind,配置写在~/.tabby/config.toml:
Chat 模型——llamafile 提供 OpenAI 兼容的 chat API,端点 URL 必须包含v1后缀:
[model.chat.http] kind = "openai/chat" # llamafile uses openai/chat kind model_name = "your_model" api_endpoint = "http://localhost:8081/v1" # Please add and conclude with the `v1` suffix api_key = ""Completion 模型——llamafile 使用 llama.cpp 的 completion API,端点 URL 不应包含v1后缀:
[model.completion.http] kind = "llama.cpp/completion" model_name = "your_model" api_endpoint = "http://localhost:8081" # DO NOT append the `v1` suffix api_key = "secret-api-key" prompt_template = "<|fim_prefix|>{prefix}<|fim_prefix|>{suffix}【免费下载链接】tabbySelf-hosted AI coding assistant项目地址: https://gitcode.com/GitHub_Trending/tab/tabby
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考