anything-llm [FEAT] 代码解释器,用于提供更高质量的响应和输出,同时总结文件和文档,

olhwl3o2  于 2个月前  发布在  其他
关注(0)|答案(9)|浏览(44)

AnythingLLM运行得怎么样?

AnythingLLM桌面应用

发生了什么?

我正在尝试与我的文档进行聊天。这是一个包含员工姓名和ID的基本文档,但它无法生成高质量的响应。大多数时候,它给我的是随机数据,输出与已有的工具不匹配。
我已经测试过了。

  1. Claude-2.1 .
  2. Gemini Pro .
  3. Local Models.
    我不是在推销我的产品,但是我将它与已有的代码解释器进行了比较,这些代码解释器可以生成代码,并分析我们本地系统中的所有文件。
    链接 Code-Interpreter 这是我用类似模型测试过的工具,如 Claude 2.1 ,我得到了更好的结果,而且更准确,其他已经存在的被称为代码解释器的工具也是如此。

有已知的重现步骤吗?

你可以尝试使用非常基本的文件,并询问关于数据的问题,它会尝试生成表格,但数据并不总是准确的,即使你使用了相同的模型和不同的代码解释器软件。

yhived7q

yhived7q1#

ACK。我会跳到那个项目上。
我已经切换到了本地开发环境,这样我可以实时测试它。

0lvr5msh

0lvr5msh2#

我遇到了相同的问题。我使用nomic-embed-text将嵌入加载到ollama上,以查看是否是这个问题,因为我看到本地嵌入有这个设置:embeddingMaxChunkLength = 1_00;,但结果仍然相同。我还将LLM推送到LM studio,查看API调用中的日志,并注意到上下文非常有限。有限到足以使LLM经常产生错觉。

vbkedwbf

vbkedwbf3#

是的,我们需要提高这个质量并减少幻觉。

h43kikqp

h43kikqp4#

尝试将BERT分词器覆盖现有的分词器并查看结果。
在 /collector/utils/tokenizer/index.js 中添加:

// Importing the BertTokenizer class from bert-tokenizer module.
const { BertTokenizer } = require("bert-tokenizer");

// Instantiate the BERT tokenizer.
const tokenizer = new BertTokenizer();

// A function that tokenizes a string using the BERT's text encoding.
// If no string is provided, it defaults to an empty string.
function tokenizeString(input = "") {
  try {
    // Tokenize the input string and return the tokens.
    return tokenizer.tokenize(input);
  } catch (e) {
    // If an error occurs, log a message to the console and return an empty array.
    console.error("Could not tokenize string!");
    return [];
  }
}

// Export the tokenizeString function.
module.exports = {
  tokenizeString,
};

您可能需要从 /collector/ 获取 yarn add bert-tokenizer
在某些PDF中,我能够获得更好的上下文。仍在我的设备上进行测试

vq8itlhq

vq8itlhq5#

我应该补充一下:

我正在使用

this.model = "NomicAi/nomic-embed-text-v1_5";
    this.cacheDir = path.resolve(
      process.env.STORAGE_DIR
        ? path.resolve(process.env.STORAGE_DIR, `models`)
        : path.resolve(__dirname, `../../../storage/models`)
    );
    //this.modelPath = path.resolve(this.cacheDir, "Xenova", "all-MiniLM-L6-v2"); //DEFAULT
    //this.modelPath = path.resolve(this.cacheDir, "BAAI", "bge-small-en-v1_5"); //Test 1
    this.modelPath = path.resolve(
      this.cacheDir,
      "NomicAi",
      "nomic-embed-text-v1_5"
    );

作为嵌入器在 server/utils/EmbeddingEngines/native/index.js 中,稍后我会跳到BERT嵌入以使它们匹配(如果你打算使用这个,你需要将文件复制到STORAGE_DIR模型文件夹中)。然后,Qdrant作为数据库,Mixtral 8x7b作为LM studio上的LLM。

cld4siwp

cld4siwp6#

仍在继续这个项目。

我学到的东西

  • bge-small-en-v1_5 嵌入器表现得还不错,但仍然希望得到更好的响应
  • nomic-embed-text-v1_5 表现得更好,但当嵌入大型文档时,容器会被关闭。可能可以根据文档大小来降低速度,这样就不会发生这种情况了吗?
  • 仍然可以说一些无意义的话,并给出不理想的响应。希望能够在上下文中获取文档标题以供以后参考。
    迄今为止最好的结果
  • 上面提到的Bert分词器
  • Ollama在2048块大小上运行nomic进行嵌入(也可以在localAi上完成)
  • LM studio运行Muxtral 8x7b
f87krz0w

f87krz0w7#

Step by step instructions would be much appreciated 🙏
Issues:

  • When I use Mixtral 8x7b I get during embedding: Error: "1 document failed to add. Could not embed document chunks! This document will not be recorded."

And in LM Studio i get: [ERROR] Unexpected endpoint or method. (POST /v1/embeddings). Returning 200 anyway

  • I can not find a path that fits: "/collector/utils/tokenizer/"
ni65a41a

ni65a41a8#

更新。V2. 使用不同的嵌入模型,结果一直低于预期。目前运行的设置是:

  • BERT分词器(如上所述)
  • 嵌入:nomic-embed-text
  • 向量存储:Qdrant
  • LLM:TheBloke / dolphin-2.7-mixtral-8x7b.Q6_K.gguf

我一直在尝试不同的分块方法和文本分割方法以及重叠。我了解到父子方法效果很好,稍后会尝试一下。
我认为在这个部分的./server/utils/vectorDBProvidors/<your db>/index.js处发生了分块。

const textSplitter = new RecursiveCharacterTextSplitter({
        chunkSize:
          getEmbeddingEngineSelection()?.embeddingMaxChunkLength || 1_000,
        chunkOverlap: 20,
      });
      const textChunks = await textSplitter.splitText(pageContent);

即使只是手动将重叠更改为大约100,我也觉得结果更好。我还将其与400和40进行了比较,看看会发生什么,它的表现还不错。但这对于大量的点击来说可能不是很好,因为它会在LLM中混淆上下文,并且有一个硬编码的最大值。

rhfm7lfc

rhfm7lfc9#

@tylerfeldstein 顺便说一下,相关问题! #490
我们可以优先处理这个问题,这样你就可以更轻松地处理它。你是使用Docker Desktop还是本地开发?

相关问题