FilterRSS
1.0.0
Python脚本通过请求GPT-4的相关性分数,仅包括符合用户定义阈值的条目,以过滤RSS feed。通过Twitter2RSS进行了尝试并经过证明。
python filter_rss.py <rss_feed_path> <rss_dest_path> <system_prompt_path> [--threshold THRESHOLD]
rss_feed_path :源RSS feed文件的路径。rss_dest_path :通往目标RSS feed文件的路径。system_prompt_path :通往包含系统提示的文本文件的路径。--threshold :(可选)基于GPT-4分数过滤条目的阈值。默认值为0.5。在使用此脚本之前,请确保使用OpenAI API密钥设置OPENAI_API_KEY环境变量。
System_prompt_path提到的文本文件指示GPT-4用作内容审核系统。这是一个样本(也可以在sample-prompt.txt中复制,可以使用):
You are a content moderation system. Rate the relevance of the input on a scale of 0 to 1. Only numbers are permitted replies. prioritize tweets that contain insightful, informative, or thought-provoking content. Avoid: overly promotional, political issues, platitudes, languages other than English or German.
为了创建GPT-4的系统提示,您可以使用GPT-4本身从几个示例中学习,并使用这样的系统提示:
You are given multiple user inputs which represent tweets to learn from. These are prefixed with either [WANTED] or [UNWANTED] for you, but these prefixes are not in the real data. From these inputs, create one System instruction for you, GPT-4, to use for future content ranking. This instruction only needs to be understandable by you. Tweets will be submitted individually to you, so while repetitive content is unwanted, you will not be able to infer it from the individual tweets.
和这样的用户提示:
[UNWANTED]Insightful_User Retweeted Boring_User
Trying out @bluesky for the past couple of days.
将生成的提示符保存在文本文件中,并在运行脚本时提供文件的路径。
使用PIP安装依赖项:
pip install feedparser beautifulsoup4 openai
该项目是根据GNU Affero通用公共许可证v3.0(AGPLV3)许可的。有关更多详细信息,请参阅许可证文件。