البرنامج النصي Python لتصفية خلاصة RSS من خلال طلب درجات صلة من GPT-4 وتشمل فقط الإدخالات التي تلبي عتبة محددة من قبل المستخدم. حاول وثبت مع Twitter2RSS.
python filter_rss.py <rss_feed_path> <rss_dest_path> <system_prompt_path> [--threshold THRESHOLD]
rss_feed_path : مسار إلى ملف تغذية المصدر RSS.rss_dest_path : مسار إلى ملف تغذية الوجهة RSS.system_prompt_path : مسار إلى الملف النصي الذي يحتوي على موجه النظام.--threshold : عتبة (اختيارية) لتصفية الإدخالات بناءً على درجة GPT-4. الافتراضي هو 0.5. قبل استخدام هذا البرنامج النصي ، تأكد من تعيين متغير بيئة OPENAI_API_KEY باستخدام مفتاح Openai API الخاص بك.
الملف النصي المشار إليه بواسطة System_Prompt_Path يرشد GPT-4 للعمل كنظام اعتدال المحتوى. هذه عينة (مستنسخة أيضًا في عينة 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 Ascero General Public V3.0 (AGPLV3). لمزيد من التفاصيل ، راجع ملف الترخيص.