FilterRSS
1.0.0
GPT-4から関連スコアを要求し、ユーザー定義のしきい値を満たすエントリのみを含むRSSフィードをフィルタリングするPythonスクリプト。 Twitter2RSSで試して証明しました。
python filter_rss.py <rss_feed_path> <rss_dest_path> <system_prompt_path> [--threshold THRESHOLD]
rss_feed_path th:ソースRSSフィードファイルへのパス。rss_dest_path :宛先RSSフィードファイルへのパス。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 General Public License v3.0(Agplv3)の下でライセンスされています。詳細については、ライセンスファイルを参照してください。