ChatGPTのAPIを利用して、任意のテキストを短くしたり長くするPythonコードです。 APIに投げるprompt部分をもう少し詳細に指定するようにすれば、どのくらいの短さ(長さ)にするかも制御できるかもしれません。 import openai def convert_to_short(prompt): response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role…