intelliweb GPT
1.0.0
Intelliweb-GPT是一个智能搜索引擎/问答模块,它使用GPT技术为用户查询提供准确且相关的答案。该搜索引擎可以搜索多个来源(包括 Google News 和 Google Web)以生成答案,还可以利用 GPT 的现有知识直接回答一般用户的查询。当 GPT 连接到互联网后,它基本上就是 GPT 的增强版!这就是当您使用 Bing Chat 时 Bing 进行搜索的方式。
Intelliweb-GPT 提供以下功能:
首先安装requirements.txt中提到的所有库和模块:
pip install -r requirements.txt
在.env
文件中,将OPENAI_API_KEY
ENV 变量的值替换为您自己的 OpenAI API 密钥。
另外,如果您想使用 serper API 从网络获取相关文章,请从此处获取您自己的 API 密钥,并将您的 API 密钥添加到SERPER_API_KEY
环境变量中。它为您提供 1000 次免费搜索,比使用其他方法更安全、更可靠。调用generate_answer
方法时,将use_serper_api
参数设置为True
。
接下来,这是一个如何使用 Intelliweb-GPT 的简单示例:
from pprint import pprint
from intelliweb_GPT import generate_answer
query = "How did the Super Mario Bros. movie fare at the box office?"
answer_dict = generate_answer ( query , use_serper_api = False )
pprint ( answer_dict )
输出:
{ ' answer ' : ' The Super Mario Bros. movie has been a massive success at the box '
' office, breaking multiple records and becoming the '
' highest-grossing video game adaptation of all time, surpassing '
' Detective Pikachu. As of 2023-04-15, the film grossed $204.6 '
' million domestically and $377 million globally in its opening '
' weekend, and has since surpassed $500 million worldwide. It has '
' become the biggest opening of 2023, the highest-grossing debut '
' for Illumination, and the second-biggest debut ever for an '
' animated movie. The movie has already made more than 2.5 times its '
' budget, which is generally what a movie needs to break even. '
" There's a strong chance that the video game movie could join the "
' billion-dollar club despite the bad reviews. However, it remains '
' to be seen how well it will do in the following weeks. ' ,
' sources ' : [ ' https://deadline.com/2023/04/super-mario-bros-movie-crosses-500-million-worldwide-box-office-1235325476/ ' ,
' https://collider.com/super-mario-bros-movie-global-box-office-434-million/ ' ,
' https://variety.com/2023/film/news/super-mario-bros-movie-box-office-records-opening-weekend-1235577764/ ' ,
' https://www.shacknews.com/article/135069/super-mario-bros-movie-highest-grossing-video-game-film ' ,
' https://screenrant.com/super-mario-bros-movie-every-box-office-record/ ' ]}
还有一个 GUI 可用于与 intelliweb-GPT 交互。 UI 是使用 chainlit 创建的,可以使用以下命令运行:
PYTHONPATH= $PWD chainlit run chainlit_app/app.py
Chainlit UI 如何与 intelliweb-GPT 配合使用的演示: