ChatDOC


NameChatDOC JSON
Version 2023.4.25.9.28.0 PyPI version JSON
download
home_pagehttps://github.com/yuanjie-ai/llm4gpt
SummaryCreate a Python package.
upload_time2023-04-25 01:28:13
maintainer
docs_urlNone
authoryuanjie
requires_python>=3.6
licenseMIT license
keywords chatllm
VCS
bugtrack_url
requirements meutils transformers sentence_transformers
Travis-CI
coveralls test coverage No coveralls.
            ![image](https://img.shields.io/pypi/v/llm4gpt.svg) ![image](https://img.shields.io/travis/yuanjie-ai/llm4gpt.svg) ![image](https://readthedocs.org/projects/llm4gpt/badge/?version=latest)



<h1 align = "center">🔥ChatLLM🔥</h1>

---

# Install

```python
pip install -U llm4gpt
```

# [Docs](https://jie-yuan.github.io/llm4gpt/)

# Usages

```python
from chatllm.qa import QA
from chatllm.kb import FaissANN
from chatllm.chatllm import ChatLLM
from chatllm.utils import llm_load

from meutils.pipe import *

# 解析知识库
texts = []
metadatas = []
for p in Path('data').glob('*.txt'):
    texts.append(p.read_text())
    metadatas.append({'source': p})

# 文档向量化
faissann = FaissANN(model_name_or_path="shibing624/text2vec-base-chinese")
faissann.add_texts(texts, metadatas)

# 构建pipeline
model, tokenizer = llm_load(model_name_or_path="THUDM/chatglm-6b", device='cpu')
glm = ChatLLM()
glm.chat_func = partial(model.chat, tokenizer=tokenizer)

qa = QA(glm, faiss_ann=faissann.faiss_ann)

qa.get_knowledge_based_answer('周杰伦在干吗')
qa.get_knowledge_based_answer('姚明住哪里')
```

---

# TODO

- [ ] 增加UI

- [x] 增加本地知识库组件

- [ ] 增加互联网搜索组件

- [ ] 增加知识图谱组件

- [ ] 增加微调模块

- [ ] 增加流式输出





=======
History
=======

0.0.0 (2023-04-11)
------------------

* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yuanjie-ai/llm4gpt",
    "name": "ChatDOC",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "chatllm",
    "author": "yuanjie",
    "author_email": "313303303@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/e2/b4/67a63c7ed5ee1b4c27ef2fd11df5d1f1b9f2fa33d48e936c7bc2ecbc1d98/ChatDOC-2023.4.25.9.28.0.tar.gz",
    "platform": null,
    "description": "![image](https://img.shields.io/pypi/v/llm4gpt.svg) ![image](https://img.shields.io/travis/yuanjie-ai/llm4gpt.svg) ![image](https://readthedocs.org/projects/llm4gpt/badge/?version=latest)\n\n\n\n<h1 align = \"center\">\ud83d\udd25ChatLLM\ud83d\udd25</h1>\n\n---\n\n# Install\n\n```python\npip install -U llm4gpt\n```\n\n# [Docs](https://jie-yuan.github.io/llm4gpt/)\n\n# Usages\n\n```python\nfrom chatllm.qa import QA\nfrom chatllm.kb import FaissANN\nfrom chatllm.chatllm import ChatLLM\nfrom chatllm.utils import llm_load\n\nfrom meutils.pipe import *\n\n# \u89e3\u6790\u77e5\u8bc6\u5e93\ntexts = []\nmetadatas = []\nfor p in Path('data').glob('*.txt'):\n    texts.append(p.read_text())\n    metadatas.append({'source': p})\n\n# \u6587\u6863\u5411\u91cf\u5316\nfaissann = FaissANN(model_name_or_path=\"shibing624/text2vec-base-chinese\")\nfaissann.add_texts(texts, metadatas)\n\n# \u6784\u5efapipeline\nmodel, tokenizer = llm_load(model_name_or_path=\"THUDM/chatglm-6b\", device='cpu')\nglm = ChatLLM()\nglm.chat_func = partial(model.chat, tokenizer=tokenizer)\n\nqa = QA(glm, faiss_ann=faissann.faiss_ann)\n\nqa.get_knowledge_based_answer('\u5468\u6770\u4f26\u5728\u5e72\u5417')\nqa.get_knowledge_based_answer('\u59da\u660e\u4f4f\u54ea\u91cc')\n```\n\n---\n\n# TODO\n\n- [ ] \u589e\u52a0UI\n\n- [x] \u589e\u52a0\u672c\u5730\u77e5\u8bc6\u5e93\u7ec4\u4ef6\n\n- [ ] \u589e\u52a0\u4e92\u8054\u7f51\u641c\u7d22\u7ec4\u4ef6\n\n- [ ] \u589e\u52a0\u77e5\u8bc6\u56fe\u8c31\u7ec4\u4ef6\n\n- [ ] \u589e\u52a0\u5fae\u8c03\u6a21\u5757\n\n- [ ] \u589e\u52a0\u6d41\u5f0f\u8f93\u51fa\n\n\n\n\n\n=======\nHistory\n=======\n\n0.0.0 (2023-04-11)\n------------------\n\n* First release on PyPI.\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Create a Python package.",
    "version": "2023.4.25.9.28.0",
    "split_keywords": [
        "chatllm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e9d2cf1dddf1e610851f0c134e460ea6ea872b5c3562ff0c01ac87cb5dbaf68e",
                "md5": "c3f18d74dbc85d9a13ae6dc3b4509ca3",
                "sha256": "4052e62d8ee3fb82b1f0c55b81eb02ccd071ce9540b1fc5cbf149edbde7088dd"
            },
            "downloads": -1,
            "filename": "ChatDOC-2023.4.25.9.28.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3f18d74dbc85d9a13ae6dc3b4509ca3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 22238,
            "upload_time": "2023-04-25T01:28:02",
            "upload_time_iso_8601": "2023-04-25T01:28:02.972579Z",
            "url": "https://files.pythonhosted.org/packages/e9/d2/cf1dddf1e610851f0c134e460ea6ea872b5c3562ff0c01ac87cb5dbaf68e/ChatDOC-2023.4.25.9.28.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2b467a63c7ed5ee1b4c27ef2fd11df5d1f1b9f2fa33d48e936c7bc2ecbc1d98",
                "md5": "aa71f7d7e4d01546394c76008aadb761",
                "sha256": "b01187d24b4681e8e07b8cd70c08b339135490ba6384d7013b5fb2b1c81aea0f"
            },
            "downloads": -1,
            "filename": "ChatDOC-2023.4.25.9.28.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aa71f7d7e4d01546394c76008aadb761",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3756275,
            "upload_time": "2023-04-25T01:28:13",
            "upload_time_iso_8601": "2023-04-25T01:28:13.869559Z",
            "url": "https://files.pythonhosted.org/packages/e2/b4/67a63c7ed5ee1b4c27ef2fd11df5d1f1b9f2fa33d48e936c7bc2ecbc1d98/ChatDOC-2023.4.25.9.28.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-25 01:28:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yuanjie-ai",
    "github_project": "llm4gpt",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "meutils",
            "specs": []
        },
        {
            "name": "transformers",
            "specs": []
        },
        {
            "name": "sentence_transformers",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "chatdoc"
}
        
Elapsed time: 0.14190s