import openai openai.api_key = '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' def generate_voice(text): prompt = f"Read the following text:\n\n{text}\n\nVoice: " response = openai.Completion.create( engine="text-davinci-003", # Use the most advanced model available prompt=prompt, max_tokens=500 # Adjust as needed ) return response.choices[0].text.strip() article_text = "The public debut of AI over the last 18 months has been, shall we say, some­thing less than an unal­loyed success. Contra C.J. Roberts, there is plenty about today’s AI systems that is unjust, slow, and expen­sive. Indeed, if AI is intro­duced into the judi­cial system overea­gerly, this will likely itself be liti­gated as a viola­tion of US consti­tu­tional rights—say, viola­tion of equal protec­tion, of due process, of the right of access to the courts, of the right to counsel, or of the right to a jury. (Though if these consti­tu­tional chal­lenges to AI arise, I predict that certain citi­zens will advo­cate for amending the Consti­tu­tion, not the AI.) To be fair, I’m the guy who thinks courts mandating Times New Roman for filings are violating the Consti­tu­tion." voice_output = generate_voice(article_text) print(voice_output)