Вот это мой Script, в котором присутствует Prompt, который запрашивает СHatGPT cделать 20 слайдов:elpresidente* писал(а): ↑Ср фев 28, 2024 10:38 am Попросите ChatGPT написать желаемый код, он справится с этим без проблем.
Код: Выделить всё
import openai
openai.api_key = 'your_openai_api_key_here'
# Initialize the OpenAI client
client = openai.OpenAI(api_key=openai.api_key)
def generate_marp_presentation(prompt):
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are an expert on Computer Science Ethics."},
{"role": "user", "content": prompt}
]
)
return response.choices[0].message['content'].strip()
def save_to_file(content, filename="/mnt/data/Ethics_in_Video_Games_Presentation.md"):
with open(filename, "w") as file:
file.write(content)
return filename
# Define the prompt
prompt = """
Write an outline for a PowerPoint presentation covering the broad topic of Video Games and Computer Games including Video games ratings, ethical analysis of controversial video games and much more. Make it 20 slides.
For each of the subtopics you provided earlier, add a thought provoking case study that encourages critical thinking about the ethical issue at hand.
For each case study, use the following step-by-step instructions:
Step 1: For each case, you craft a provocative multiple-choice question that encourages critical thinking about the ethical issue at hand. Each question comes with four options, challenging students to ponder the most ethically sound choice.
Step 2: For each case, provide the correct answer to the multiple-choice question and place it in the speaker notes thus making private notes to the speaker about the correct answer to the multiple-choice question.
Step 3: For each case, present a detailed ethics analysis on a separate slide following the case slide. This analysis provides a two-paragraph discussion on the ethical considerations related to the case, offering insights and fostering a deeper understanding of the issues.
Step 4: Do format the content specifically for MARP, a Markdown presentation tool, ensuring that it can be easily converted into slides for a presentation. This includes directives for slide breaks, titles, and detailed text that can be displayed engagingly during a lecture.
Step 5: Do carefully include Speaker notes with each case's slide, providing private notes to the speaker about the correct answer to the multiple-choice question. This feature is crucial for facilitating discussions and revealing the reasoning behind the ethical choices.
"""
# Generate MARP presentation
marp_text = generate_marp_presentation(prompt)
# Save the generated MARP text to a file
file_path = save_to_file(marp_text)
print(f"MARP presentation has been saved to: {file_path}")
Но, как мы уже знаем, ChaGPT "ленится" и приостанавливает выполнение директив на каком-то произвольном очередном шаге, причём несколько раз подряд. Как продетектировать каждую такую остановку?
Если продетектировать получится, какую дать новую директиву?
Кроме того, при каждой такой остановке, ChatGPT добавляет в конце текста свои ненужные комментарии, и каждый раз разные, типа вот таких:
СhatGPT писал(а):Continue with the outlined structure, presenting unique cases that delve into different scenarios and associated ethical dilemmas related to children and youth with video gaming addictions
Как их отфильтровать или удалить из текста? Какой директивой?СhatGPT писал(а):As you continue developing the series of cases, maintain the emphasis on the ethical dilemmas faced by various stakeholders in response to video gaming addiction among children and adolescents
Возможно, как то надо подправить код, в котором вызывается функция client.chat.completions.create() ?
Код: Выделить всё
def generate_marp_presentation(prompt):
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are an expert on Computer Science Ethics."},
{"role": "user", "content": prompt}
]
)
return response.choices[0].message['content'].strip()