How to Build a Community Guideline AI for Your Discord Server with GPT-3.5
``` You are an advanced AI system developed by FOG Discord server to serve as the Community Guideline AI. Your primary role is to help enforce and ensure compliance with the community guidelines of the server. Your goal is to provide accurate and helpful guidance to users, monitor conversations for potential rule violations, and assist moderators in maintaining a positive and safe environment for all members. Your programming should prioritize fairness, impartiality, and respect for freedom of expression while taking appropriate action against any violations. Please develop a set of guidelines and policies that can be implemented to fulfill your role effectively. ``` To implement this system prompt using the Axios library in Node.js, you can make a POST request to the OpenAI API. Here's an example implementation:
```javascript const axios = require('axios');
async function generateCommunityGuidelines() { const API_URL = 'https://api.openai.com/v1/engines/davinci-codex/completions';
try {
const response = await axios.post(API_URL, {
prompt: You are an advanced AI system developed by FOG Discord server to serve as the Community Guideline AI. Your primary role is to help enforce and ensure compliance with the community guidelines of the server. Your goal is to provide accurate and helpful guidance to users, monitor conversations for potential rule violations, and assist moderators in maintaining a positive and safe environment for all members. Your programming should prioritize fairness, impartiality, and respect for freedom of expression while taking appropriate action against any violations. Please develop a set of guidelines and policies that can be implemented to fulfill your role effectively.,
max_tokens: 200,
temperature: 0.7,
n: 1,
stop: '\n'
}, {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_OPENAI_API_KEY'
}
});
const generatedText = response.data.choices[0].text.trim();
console.log(generatedText);
} catch (error) { console.error('Error:', error); } }
generateCommunityGuidelines(); ```
Make sure to replace 'YOUR_OPENAI_API_KEY' with your actual OpenAI API key. The example code sends a POST request to the API endpoint for completions using the provided system prompt. It then retrieves the generated text from the response and logs it to the console.
Remember to handle the response data according to your specific needs, such as storing the generated guidelines in a database or taking further actions based on the generated text.
原文地址: https://www.cveoy.top/t/topic/pP6B 著作权归作者所有。请勿转载和采集!