0.2.1 • Published 17 days ago

@re-ai/vector.local v0.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
17 days ago

@re-ai/vector.local

@re-ai/vector.local 是一个强大的向量数据库服务,提供高效的文档管理、数据库操作和集合处理功能。此包是专为需要在本地环境中处理大量数据的应用程序设计,支持多种数据操作。

更新

  • 23.05.08:添加文件的处理,分割文件,支持ollama二次处理,目前支持文档格式 markdown

功能

  • 文档操作:支持文档的插入、查询、搜索、删除和更新。
  • 数据库管理:允许用户创建、删除和列出数据库。
  • 集合操作:提供集合的创建、描述、删除、列出和清空功能。
  • 文件操作:支持文件分割,再经过大语言模型处理。

安装

使用 npm 安装:

npm install @re-ai/vector.local

使用方法

初始化

import { ReAIVector } from '@re-ai/vector.local';
const service = ReAIVector.getService(ServiceTypes.OLLAM_CHROMA_LOCAL)

文档操作

// 示例:插入文档
service.documentUpsert({ /* 数据 */ });

// 示例:查询文档
service.documentQuery({ /* 查询条件 */ });

数据库操作

// 示例:创建数据库
service.databaseCreate({ /* 数据库配置 */ });

// 示例:列出所有数据库
service.databaseList();

集合操作

// 示例:创建集合
service.collectionCreate({ /* 集合配置 */ });

// 示例:获取集合描述
service.collectionDescribe({ /* 指定集合 */ });

文件操作

process.env.OLLAMA_HOST = "http://127.0.0.1:11434" // ollama 服务地址
process.env.OLLAMA_LLM_MODEL = "phi3:mini" // llm 模型

import { FileParserTypes, ReAIFileParser } from "@re-ai/vector.local";
import { join } from 'path';

const parser = new ReAIFileParser()

parser.parse(join(__dirname, "../test.md"), FileParserTypes.MD, {
    minSize: 800,
    maxSize: 1000,
    onProcess: (data) => {
        console.log(data)
    }
}).then(ret => {
    console.log(ret)
})

贡献

欢迎通过 GitHub 提交问题或请求,以帮助我们改进 @re-ai/vector.local

许可证

此项目遵循 MIT 许可证。有关更多详细信息,请查看 LICENSE 文件。