Code Monkey home page Code Monkey logo

medchat's Introduction

知识增强的chatgpt

这个项目是为了给ChatGPT加入外部知识,已经加入的是医学知识

为了保持轻量和可拓展性,不用Llama Index等库,而是采用Sbert直接对知识进行编码,对知识进行编码检索的过程可以轻易定制

项目流程

  1. 根据输入检索相关医学知识
  2. prompt改造
  3. chatgpt生成回复

快速上手

准备工作

安装环境

pip install -r requirements.txt

设置api key

修改./chat.py中第7行"Your_Openai_API_KEY",替换为你的openai的api key

运行项目

python main.py

启动如下图所示的网页,对用户输入会先检索相关知识,然后给ChatGPT做参考 demo演示

定制知识库

如果想换成自己的知识库,需要替换掉./knowledge_base/disease.txt,这个文件中每一行文本是一条知识

然后运行

# 需要将vector.py中72行知识库名字改成你的新知识库名字
python tools/vector.py

执行之后会在知识库同级目录生成向量化之后的文件***.npy

然后修改./tools/vector.py第65和66行为实际的知识库路径

最后执行

python main.py

交流建议

进群

medchat's People

Contributors

thinksoso avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.