npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@re-ai/rag

v0.2.2

Published

ReAI RAG,向量数据库,EMBEDDING,图谱

Downloads

34

Readme

@re-ai/rag

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

更新 (v0.2)

  • 24.08.01
    • 添加LanceDB远程支持(需部署单独远程服务)
  • 24.07.31
    • LanceDB支持,本地测试ok
    • 腾讯云向量库测试完毕,支持base/AI库,上传文件(markdown格式)
  • 24.07.30 腾讯云向量库

安装

使用 npm 安装:

npm install @re-ai/rag

使用方法

向量服务

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

数据库操作

特别说明:若创建AI库,需要第二个参数传入: true,其他相关操作,也传入第二个参数: true

// 示例:创建数据库
service.database().create({ /* 数据库配置 */ }, isAI: true);

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

// 示例:删除数据库
service.database().drop({ /* 数据库配置 */ });

集合操作


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

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

// 示例:列出集合
service.collection().list();

// 示例:删除集合
service.collection().drop({ /* 指定集合 */ });

// 示例:删除所有文档
service.collection().truncate({ /* 集合配置 */ });

文档操作


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

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

// 示例:向量搜索
service.document().search({ /* 查询条件 */ });

// 示例:删除文档
service.document().delete({ /* 查询条件 */ });

// 更新文档
service.document().update({ /* 查询条件 */ });

// AI库特有操作,上传文件
service.document().upload({ /* 数据 */ });

sql where 查询字符串

import { ReAIFilter } from '@re-ai/rag';
const str = ReAIFilter.buildWhereClause({
    name: '张三',
})

Embedding向量接口

export { ReAIVector, ReAIEmbedding } from "@re-ai/rag"
const e = ReAIEmbedding.getAPI(EmbeddingAPIType.OLLAMA, {
    model: "milkey/gte:large-zh-f16"
})
e.getEmbeddings(["你好", "天气好"]).then((res) => {
    console.log(res)
})

贡献

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

许可证

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