Un script de Python para filtrar un feed RSS solicitando puntajes de relevancia de GPT-4 y solo incluye entradas que cumplan con un umbral definido por el usuario. Probado y probado con Twitter2RSS.
python filter_rss.py <rss_feed_path> <rss_dest_path> <system_prompt_path> [--threshold THRESHOLD]
rss_feed_path : ruta al archivo de alimentación RSS de origen.rss_dest_path : ruta al archivo de alimentación RSS de destino.system_prompt_path : ruta al archivo de texto que contiene el mensaje del sistema.--threshold : umbral (opcional) para filtrar entradas basadas en la puntuación GPT-4. El valor predeterminado es 0.5. Antes de usar este script, asegúrese de haber establecido la variable de entorno OPENAI_API_KEY con su tecla API OpenAI.
El archivo de texto mencionado por SYSTEM_PROMPT_PATH instruye a GPT-4 que funcione como un sistema de moderación de contenido. Esta es una muestra (también reproducida en Sample-ProMpt.txt, lista para usar):
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.
Para crear una solicitud del sistema para GPT-4, puede usar GPT-4 en sí mismo para aprender de algunos ejemplos, con un mensaje de sistema como este:
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.
y las indicaciones del usuario como esta:
[UNWANTED]Insightful_User Retweeted Boring_User
Trying out @bluesky for the past couple of days.
Guarde el indicador generado en un archivo de texto y proporcione la ruta al archivo al ejecutar el script.
Instale las dependencias usando PIP:
pip install feedparser beautifulsoup4 openai
Este proyecto tiene licencia bajo la Licencia Pública General GNU Affero V3.0 (AGPLV3). Para obtener más detalles, consulte el archivo de licencia.