{"id":13645313,"url":"https://github.com/yuanjie-ai/chatllm","last_synced_at":"2025-11-11T18:08:10.581Z","repository":{"id":152507177,"uuid":"626239738","full_name":"yuanjie-ai/ChatLLM","owner":"yuanjie-ai","description":"轻松玩转LLM兼容openai\u0026langchain，支持文心一言、讯飞星火、腾讯混元、智谱ChatGLM等","archived":false,"fork":false,"pushed_at":"2024-09-24T00:44:03.000Z","size":42931,"stargazers_count":445,"open_issues_count":1,"forks_count":56,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-16T06:07:30.586Z","etag":null,"topics":["chatbase","chatdb","chatdoc","chatgpt","chatkb","chatkg","chatllm","chatpdf","chatsearch","chatsql","chatweb","gpt4","langchain","llm","lora","p-tuning"],"latest_commit_sha":null,"homepage":"https://yuanjie-ai.github.io/ChatLLM/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuanjie-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-11T04:28:30.000Z","updated_at":"2025-04-28T03:31:12.000Z","dependencies_parsed_at":"2024-11-29T03:05:47.099Z","dependency_job_id":"e11a2907-59dc-4fa6-8df5-b9728f1b2596","html_url":"https://github.com/yuanjie-ai/ChatLLM","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"8a8007630b3dca32ebe87e8a9a1f553fa1d2abae"},"previous_names":["yuanjie-ai/llm4gpt","yuanjie-ai/llm4chat"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanjie-ai%2FChatLLM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanjie-ai%2FChatLLM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanjie-ai%2FChatLLM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuanjie-ai%2FChatLLM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuanjie-ai","download_url":"https://codeload.github.com/yuanjie-ai/ChatLLM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478193,"owners_count":22077676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbase","chatdb","chatdoc","chatgpt","chatkb","chatkg","chatllm","chatpdf","chatsearch","chatsql","chatweb","gpt4","langchain","llm","lora","p-tuning"],"created_at":"2024-08-02T01:02:33.401Z","updated_at":"2025-11-11T18:08:10.549Z","avatar_url":"https://github.com/yuanjie-ai.png","language":"Jupyter Notebook","funding_links":[],"categories":["Langchain"],"sub_categories":[],"readme":"![image](https://img.shields.io/pypi/v/chatllm.svg) ![image](https://img.shields.io/travis/yuanjie-ai/chatllm.svg) ![image](https://readthedocs.org/projects/chatllm/badge/?version=latest)\n\n\u003ch1 align = \"center\"\u003e🔥ChatLLM 基于知识库🔥\u003c/h1\u003e\n\n\u003e star之后可联系wx: 313303303领取1000w tokens（国产模型）\n\n\u003e star之后可联系wx: 313303303领取1000w tokens（国产模型）\n\n\u003e star之后可联系wx: 313303303领取1000w tokens（国产模型）\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"data/imgs/LLM.drawio.png\"/\u003e\n\u003c/div\u003e\n\n\n![image](https://github.com/yuanjie-ai/ChatLLM/assets/20265321/90890ea5-e92d-46c8-a600-a32e33eb4fc3)\n\n## todo: SimpleGraphRAG\n\n## [ChatLLM API 分发系统上线](https://api.chatllm.vip/)\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to Star⭐️免费领取tokens\u003c/summary\u003e\n    https://api.chatllm.vip/\n\n\u003c/details\u003e\n\n## Install\n\n```shell\npip install -U chatllm\n```\n\n## [Docs](https://yuanjie-ai.github.io/ChatLLM/)\n\n## Usages\n\n### [目前适配的LLMs](LLMS.md)\n\u003e 计划推出国内 oneapi，支持各种主流大模型，兼容openai客户端生态。\n\n```python\nfrom chatllm.applications import ChatBase\n\nqa = ChatBase()\nqa.load_llm(model_name_or_path=\"THUDM/chatglm-6b\")\nfor i in qa(query='周杰伦是谁', knowledge_base='周杰伦是傻子'):\n    print(i, end='')\n# 根据已知信息无法回答该问题，因为周杰伦是中国内地流行歌手、演员、音乐制作人、导演，\n# 是具有一定的知名度和专业能力的人物，没有提供足够的信息无法判断他是傻子。\n```\n\n## OpenaiEcosystem\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to 无缝对接openai生态\u003c/summary\u003e\n\n```shell\n# 服务端\npip install \"chatllm[openai]\" \u0026\u0026 chatllm-run openai \u003c本地模型地址\u003e\n```\n\n- SDK：`pip install openai`\n\n```python\nimport openai\n\nopenai.api_base = 'http://0.0.0.0:8000/v1'\nopenai.api_key = 'chatllm'\nprompt = \"你好\"\ncompletion = openai.Completion.create(prompt=prompt, stream=True, model=\"text-davinci-003\")\nfor c in completion:\n    print(c.choices[0].text, end='')\n# 你好👋!我是人工智能助手 ChatGLM-6B,很高兴见到你，欢迎问我任何问题。\n```\n\n- 客户端：[点击下载chatbox](https://chatboxapp.xyz/)，也可接入客户端\n  ![客户端](data/imgs/chatbox.png)\n\n### [openai_keys](./data/openai_keys.md): `不定期更新免费keys`\n\n\u003c/details\u003e\n\n## ChatOCR\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to ChatOCR\u003c/summary\u003e\n\n```python\nfrom meutils.pipe import *\nfrom chatllm.llmchain.applications import ChatOCR\n\nllm = ChatOCR()\nfile_path = \"data/invoice.jpg\"\nllm.display(file_path, 700)\nllm.chat('识别编号,公司名称,开票日期,开票人,收款人,复核人,金额', file_path=file_path) | xprint\n```\n\n![ocr](data/imgs/chatocr.png)\n\n\u003c/details\u003e\n\n## ChatMind\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to ChatMind\u003c/summary\u003e\n\n```shell\npip install \"chatllm\" \u0026\u0026 chatllm-run webui --name chatmind\n```\n\n![客户端](data/imgs/chatmind.png)\n\n\u003c/details\u003e\n\n## ChatPDF\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to ChatPDF\u003c/summary\u003e\n\n```shell\npip install \"chatllm[pdf]\" \u0026\u0026 chatllm-run webui --name chatpdf\n```\n\n- python交互\n\n```python\nfrom chatllm.applications.chatpdf import ChatPDF\n\nqa = ChatPDF(encode_model='nghuyong/ernie-3.0-nano-zh')\nqa.load_llm(model_name_or_path=\"THUDM/chatglm-6b\")\nqa.create_index('财报.pdf')  # 构建知识库\n\nfor i in qa(query='东北证券主营业务'):\n    print(i, end='')\n# 根据已知信息，东北证券的主营业务为证券业务。公司作为证券公司，主要从事证券经纪、证券投资咨询、与证券交易、\n# 证券投资活动有关的财务顾问、证券承销与保荐、证券自营、融资融券、证券投资基金代销和代销金融产品待业务。\n```\n\n- 支持召回结果查看\n  ![向量召回结果](data/imgs/chatpdf.gif)\n\n\u003c/details\u003e\n\n## Deploy\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to Deploy\u003c/summary\u003e\n\n- ChatGLM-6B 模型硬件需求\n\n| **量化等级**  | **最低 GPU 显存**（推理） | **最低 GPU 显存**（高效参数微调） |\n|-----------|-------------------|-----------------------|\n| FP16（无量化） | 13 GB             | 14 GB                 |\n| INT8      | 8 GB              | 9 GB                  |\n| INT4      | 6 GB              | 7 GB                  |\n\n- 从本地加载模型\n    - [安装指南](docs/INSTALL.md)\n    - [ChatGLM-6B Mac 本地部署实操记录](https://www.yuque.com/arvinxx/llm/chatglm-6b-deployment-on-mac)\n    - [THUDM/ChatGLM-6B#从本地加载模型](https://github.com/THUDM/ChatGLM-6B#从本地加载模型)\n\n\u003c/details\u003e\n\n## TODO\n\n\u003cdetails markdown=\"1\"\u003e\n  \u003csummary\u003eClick to TODO\u003c/summary\u003e\n\n- [ ] ChatLLM 应用\n    - [x] 接入非结构化文档（已支持 md、pdf、docx、txt 文件格式）\n    - [ ] 搜索引擎与本地网页接入\n    - [ ] 结构化数据接入（如 csv、Excel、SQL 等）\n    - [ ] 知识图谱/图数据库接入\n    - [ ] 增加 ANN 后端，ES/RedisSearch【确保生产高可用】\n    - [ ] 增加多级缓存缓存\n\n- [ ] 多路召回\n    - [ ] 问\n        - [ ] 标量匹配\n        - [x] 多种向量化，向量匹配\n        - [ ] 增加相似问，换几个问法\n        - [ ] 高置信度直接返回答案【匹配标准问】\n    - [ ] 答\n        - [ ] 高置信度篇章\n        - [ ] 增加上下文信息\n        - [ ] 增加夸篇章信息\n        - [ ] 增加召回信息的相似信息\n        - [ ] 提前生成标准问，匹配问\n        - [ ] 拒绝推断\n\n\n- [ ] 增加更多 LLM 模型支持\n    - [x] [THUDM/chatglm-6b](https://huggingface.co/THUDM/chatglm-6b)\n    - [ ] [THUDM/chatglm-6b-int8](https://huggingface.co/THUDM/chatglm-6b-int8)\n    - [ ] [THUDM/chatglm-6b-int4](https://huggingface.co/THUDM/chatglm-6b-int4)\n    - [ ] [THUDM/chatglm-6b-int4-qe](https://huggingface.co/THUDM/chatglm-6b-int4-qe)\n    - [ ] [ClueAI/ChatYuan-large-v2](https://huggingface.co/ClueAI/ChatYuan-large-v2)\n- [ ] 增加更多 Embedding 模型支持\n    - [x] [nghuyong/ernie-3.0-nano-zh](https://huggingface.co/nghuyong/ernie-3.0-nano-zh)\n    - [x] [nghuyong/ernie-3.0-base-zh](https://huggingface.co/nghuyong/ernie-3.0-base-zh)\n    - [x] [shibing624/text2vec-base-chinese](https://huggingface.co/shibing624/text2vec-base-chinese)\n    - [x] [GanymedeNil/text2vec-large-chinese](https://huggingface.co/GanymedeNil/text2vec-large-chinese)\n- [x] 增加一键启动 webui\n    - [x] 利用 streamlit 实现 ChatPDF，一键启动 `chatllm-run webui --name chatpdf`\n    - [ ] 利用 gradio 实现 Web UI DEMO\n    - [ ] 添加输出内容及错误提示\n    - [ ] 引用标注\n    - [ ] 增加知识库管理\n        - [ ] 选择知识库开始问答\n        - [ ] 上传文件/文件夹至知识库\n        - [ ] 删除知识库中文件\n- [ ] 增加 API 支持\n    - [x] 利用 Fastapi/Flask/Grpc\n      实现流式接口 `chatllm-run openai \u003c本地模型地址\u003e --host 127.0.0.1 --port 8000`\n    - [ ] 前后端分离，实现调用 API 的 Web UI Demo\n\n\u003c/details\u003e\n\n## [交流群](http://wechat.yanyue.cloud/common/qun/redirect/?qid=449187)\n\n\u003cdiv align=center\u003e\n\u003cimg src=\"data/imgs/群.png\" alt=\"群\" width=\"200\" height=\"200\"\u003e\n\u003c/div\u003e\n\n\u003e 若二维码失效加微信拉群 313303303\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanjie-ai%2Fchatllm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuanjie-ai%2Fchatllm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuanjie-ai%2Fchatllm/lists"}