日本時間未明(午前三時)ものすごいスピードで語られたOpenAI初の開発者向けイベントDevDayで発表されたGPT-4-TurboとGPT-3.5-TurboによるJSONモード。 これはものすごく強力なんだけど、Python APIによる使い方がどこにも描いてないので試行錯誤の末見つけましたので共有いたします。 from openai import OpenAI import openai import os openai.api_key = "<APIキー>" client = OpenAI() def gpt(utterance): #response = openai.chat( response = client.chat.completions.create( #model="gpt-4-1106-preview", model="gpt-3.5-turbo-1106", r
![GPT-3.5-Turbo / GPT-4-Turbo 1106のJSONモードの使い方|shi3z](https://cdn-ak-scissors.b.st-hatena.com/image/square/64afd2295402e00b07b6af27423f0e49c83d427a/height=288;version=1;width=512/https%3A%2F%2Fassets.st-note.com%2Fproduction%2Fuploads%2Fimages%2F121019698%2Frectangle_large_type_2_2f2c13a94c5580875eb815995bef97e7.jpeg%3Ffit%3Dbounds%26quality%3D85%26width%3D1280)