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)許可的。有關更多詳細信息,請參閱許可證文件。