Skip to main content

A utility package for RAG operations

Project description

WhiskerRAG

MIT License Python Version PyPI version

WhiskerRAG 是为 PeterCat 和 Whisker 项目开发的 RAG(Retrieval-Augmented Generation)工具包,提供完整的 RAG 相关类型定义和方法实现。

特性

  • 领域建模类型
  • 插件接口描述
  • Github、S3 数据源加载器
  • OpenAI Emedding

安装

使用 pip 安装:

pip install whiskerrag

快速开始

whiskerrag_utils

from whiskerrag_utils import loader,embedding,retriever

whiskerrag_client

from whiskerrag_client import ApiClient, Configuration
from whiskerrag_client.api import retrieval_api, knowledge_api, task_api

configuration = Configuration(host="http://localhost:8000", api_key="your_api_key")

api_client = ApiClient(configuration)

# knowledge
knowledge_instance = knowledge_api.KnowledgeApi(api_client)
knowledge_instance.add_knowledge()
knowledge_instance.get_knowledge_list()
# task
task_instance = task_api.TaskApi(api_client)
task_instance.get_task_list()
task_instance.get_task_detail()
# retrieval
retrieval_instance = retrieval_api.RetrievalApi(api_client)
retrieval_instance.retrieve_space_content()
retrieval_instance.retrieve_knowledge_content()

whiskerrag_types

from whiskerrag_types.interface import DBPluginInterface, TaskEngineInterface
from whiskerrag_types.model import Knowledge, Task, Tenant, PageParams, PageResponse

开发指南

环境设置

  1. 克隆项目
git clone https://github.com/your-username/whiskerRAG-toolkit.git
cd whiskerRAG-toolkit
  1. 创建并激活虚拟环境
make setup
source venv/bin/activate

开发工作流

  1. 代码格式化
make format
  1. 运行测试
# 运行所有测试
make test

# 运行特定测试文件
make test-file file=tests/test_specific.py
  1. 代码检查
# 运行所有检查(lint, type check, test)
make check

# 仅运行 lint
make lint

# 仅运行类型检查
make lint-mypy
  1. 生成测试覆盖率报告
make coverage

分支管理

创建新的功能分支:

make branch name=feature/new-feature

构建和发布

  1. 构建包
make build
  1. 检查构建的包
make check-build
  1. 发布到 TestPyPI
make upload-test
  1. 发布到 PyPI
make upload
  1. 创建新版本发布
# 本地发布
make release-local new_version=X.Y.Z

其他命令

  • 清理构建文件和缓存:
make clean
  • 更新依赖版本:
make update-deps
  • 运行 pre-commit 钩子:
make pre-commit

项目结构

whiskerRAG-toolkit/
├── src/
│   ├── whiskerrag_utils/
│   └── whiskerrag_types/
│   └── whiskerrag_client.py
├── requirements.txt
├── requirements-dev.txt
├── setup.py
└── Makefile

贡献指南

  1. Fork 本仓库
  2. 创建特性分支 (make branch name=feature/amazing-feature)
  3. 提交更改 (git commit -m 'Add some amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 开启 Pull Request

许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情

联系方式

项目维护者 - @petercat-ai

项目链接:https://github.com/petercat-ai/whiskerrag_toolkit

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whiskerrag-0.0.5a2.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whiskerrag-0.0.5a2-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

Details for the file whiskerrag-0.0.5a2.tar.gz.

File metadata

  • Download URL: whiskerrag-0.0.5a2.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for whiskerrag-0.0.5a2.tar.gz
Algorithm Hash digest
SHA256 098a8a4c6e016303e13ade4fb8955fc5fa01d8ee35fda49f4dd0d2f25618a9b3
MD5 5d784c70c754855c940de7eae26237d8
BLAKE2b-256 82f07924aa8baa8a7a5541d8b3236180a8c8486202e54a5f88268d4982b119fe

See more details on using hashes here.

File details

Details for the file whiskerrag-0.0.5a2-py3-none-any.whl.

File metadata

  • Download URL: whiskerrag-0.0.5a2-py3-none-any.whl
  • Upload date:
  • Size: 85.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for whiskerrag-0.0.5a2-py3-none-any.whl
Algorithm Hash digest
SHA256 9f7567fb558103b26798e634c3518752c4ff885d25965f7a8c548ba71b559c85
MD5 74d7327047bdc01d752a22ca3a020e87
BLAKE2b-256 f4dba57ab9e18b085e49eab3ee5ce787854ead344443ef3517799bf7fc95ae1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page