Skip to content

SearchGPT: Building a quick conversation-based search engine with LLMs.

License

Notifications You must be signed in to change notification settings

shibing624/SearchGPT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🇨🇳中文 | 🌐English


SearchGPT: Build your own conversational search engine with LLMs

HF Models Contributions welcome License Apache 2.0 python_version GitHub issues Wechat Group

Features

  • 支持多种大模型厂商的模型,包括OpenAI/ZhipuAI API,推荐用免费的glm-4-flash
  • 内置支持google serper/DDGS/ZhipuAI SearchPro搜索引擎(免费,推荐)
  • 可定制的美观UI界面
  • 可分享,缓存搜索结果
  • 支持猜你想问,连续问答

安装依赖

pip install -r requirements.txt

运行

export ZHIPUAI_API_KEY=your_api_key
python search.py

好了,现在你的搜索应用正在运行:http://0.0.0.0:8081

rebuild前端web

使用npm构建前端(需要nodejs 18以上版本)

cd web && npm install && npm run build

输出:项目根目录产出ui文件夹,包含前端静态文件。

使用搜索引擎API

使用Serper的Google搜索:

export SERPER_SEARCH_API_KEY=YOUR_SERPER_API_KEY
BACKEND=SERPER python search.py

使用OpenAI LLM

如果你追求更好LLM生成效果,你可以使用OpenAI的LLM模型gpt-4

export SERPER_SEARCH_API_KEY=YOUR_SERPER_API_KEY
export OPENAI_API_KEY=YOUR_OPENAI_API_KEY
export OPENAI_BASE_URL=https://xxx/v1
BACKEND=SERPER LLM_TYPE=OPENAI LLM_MODEL=gpt-4 python search.py

配置

部署配置,见search.py

设置以下环境变量:

  • BACKEND:要使用的搜索后端。默认使用ZhipuAI的免费搜索工具SEARCHPRO。否则,请设置为SERPER,并搭配填写相应的API_KEY,或者使用开源搜索引擎DDGS
  • LLM_TYPE:要使用的LLM类型。默认设置为ZHIPUAI。否则,将其设置为OPENAI,需要设置对应的LLM API key。
  • LLM_MODEL: 运行的LLM模型。我们建议使用免费的glm-4-flash, 或者使用其他的模型,但需要跟上面的LLM_TYPE配套。
  • RELATED_QUESTIONS: 是否生成相关问题. 如果设定为true, 搜索引擎会为你生成相关问题. 否则就不会
  • ENABLE_HISTORY:是否启用历史记录。如果您将此设置为true,LLM将存储搜索历史记录。否则,它不会

此外,您还可以设置以下KEY:

  • ZHIPUAI_API_KEY: 如果正在使用ZhipuAI, 需要指定api密钥
  • OPENAI_API_KEY: 如果正在使用OpenAI, 需要指定api密钥
  • SERPER_SEARCH_API_KEY: 如果正在使用serper的Google, 需要指定搜索api密钥

Contact

  • Issue(建议):GitHub issues
  • 邮件我:xuming: xuming624@qq.com
  • 微信我:加我微信号:xuming624, 备注:姓名-公司-NLP 进NLP交流群。

License

授权协议为 The Apache License 2.0,可免费用做商业用途。请在产品说明中附加SearchGPT的链接和授权协议。

Contribute

项目代码还很粗糙,如果大家对代码有所改进,欢迎提交回本项目。

Reference

About

SearchGPT: Building a quick conversation-based search engine with LLMs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 37.0%
  • Python 30.5%
  • HTML 28.9%
  • Jupyter Notebook 2.0%
  • JavaScript 0.9%
  • CSS 0.5%
  • Shell 0.2%