GPT-3のエンジンの違いと値段

偉人の名前がついています．多彩な動作の割に基本的には４つしかないのが驚きです．

## Davinci

言わずもがなレオナルドダヴィンチです．

- Davinciは最も使いやすく安定した動作
- 他のモデルができることはすべてのタスクを実行でき、多くの場合、少ない指示で実行できる
- 複雑なテキストの分析に関しては最も強力
- ただ，DavinciはAPI呼び出しあたりのコストが高く、他のエンジンほど高速ではない

## Curie

キュリー夫人です．

- 非常に強力で非常に高速.バランスが良い． 
- 感情の分類や要約など、微妙な違いのある多くのタスクに対応できる
- 質問への回答やQ＆Aの実行、および一般的なサービスチャットボットに向いている

## Babbagi

インドの伝説の偉人ババジです．あれ？この人実在したんだっけ？

- 単純な分類タスクを実行

## Ada

１９世紀の女性の数学者だそうです．

- 最速
- テキストの解析、アドレス修正、ニュアンスをあまり必要としない特定の種類の分類タスクなどのタスクに向いている
- 呼び出し時に多くのプロンプトを与えることでより早くなる


## 値段

文字列に比例したトークンというもので管理されます．
英語のテキストの場合、1つのトークンは約4文字または0.75語です．
呼び出しの際に与えるプロンプトという文脈と処理されたアウトプットの合計に対して課金されます．
モデルごとに値段が異なり，1Kトークン当たり

MODEL	PRICE PER 1K TOKENS
Davinci　$0.0600
Curie	$0.0060
Babbage	$0.0012
AdaFastest　$0.0008

です．Davinciだと7円ですからやりたい放題しすぎるとやばそうです．とはいえ普通に使うならそこまで高くないですし，最初に18ドルは無料で使えてクレカも登録しなくていいので最初は使いすぎても18ドルで打ち切りになってくれます．

## Curieを使いこなす

結局値段を考慮するとCurieが便利なのですが，うまく使いこなす必要があります．
ニュアンスが重要な場合はDavinci一択ですが，テキスト分析や直接の質問に答える能力はCurieでも高いからです．

davinciならこれで動作しますのでMIA -> MCOと回答します．


```bash
Janeel is flying from San Francisco to Dallas, Texas.
Flight: SFO to DFW
Aditya is taking a flight from Seattle to Omaha.
Flight: SEA to OMA
Kim is flying from Miami to Orlando International Airport
```

curieの場合，このようにします．

```
Janeel is flying from San Francisco to Dallas, Texas.
Departure airport code: SFO 
Destination airport code: DFW
Flight: SFO to DFW
###
Aditya is taking a flight from Seattle to Omaha.
Departure airport code: SEA 
Destination airport code: OMA
Flight: SEA to OMA
###
Kim is flying from Boise to Los Angeles.
Departure airport code: BOI 
Destination airport code: LAX
Flight: BOI to LAX
###
Ron is flying from Miami to Orlando International Airport.
```

## 箇条書き

Curieの例としてこういうのもあり

```
What are the key points from this text:

"""
Pluto (minor planet designation: 134340 Pluto) is a dwarf planet in the Kuiper belt, a ring of bodies beyond the orbit of Neptune. It was the first and the largest Kuiper belt object to be discovered.

Pluto was discovered by Clyde Tombaugh in 1930 and declared to be the ninth planet from the Sun. After 1992, its status as a planet was questioned following the discovery of several objects of similar size in the Kuiper belt. In 2005, Eris, a dwarf planet in the scattered disc which is 27% more massive than Pluto, was discovered. This led the International Astronomical Union (IAU) to define the term "planet" formally in 2006, during their 26th General Assembly. That definition excluded Pluto and reclassified it as a dwarf planet.

Pluto is the ninth-largest and tenth-most-massive known object directly orbiting the Sun. It is the largest known trans-Neptunian object by volume but is less massive than Eris. Like other Kuiper belt objects, Pluto is primarily made of ice and rock and is relatively small—one-sixth the mass of the Moon and one-third its volume. It has a moderately eccentric and inclined orbit during which it ranges from 30 to 49 astronomical units or AU (4.4–7.4 billion km) from the Sun. This means that Pluto periodically comes closer to the Sun than Neptune, but a stable orbital resonance with Neptune prevents them from colliding. Light from the Sun takes 5.5 hours to reach Pluto at its average distance (39.5 AU).

Pluto has five known moons: Charon (the largest, with a diameter just over half that of Pluto), Styx, Nix, Kerberos, and Hydra. Pluto and Charon are sometimes considered a binary system because the barycenter of their orbits does not lie within either body.
"""

The eight key points are:

1.
```

```python
import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

response = openai.Completion.create(
  engine="curie",
  prompt="What are the key points from this text:\n\n\"\"\"\nPluto (minor planet designation: 134340 Pluto) is a dwarf planet in the Kuiper belt, a ring of bodies beyond the orbit of Neptune. It was the first and the largest Kuiper belt object to be discovered.\n\nPluto was discovered by Clyde Tombaugh in 1930 and declared to be the ninth planet from the Sun. After 1992, its status as a planet was questioned following the discovery of several objects of similar size in the Kuiper belt. In 2005, Eris, a dwarf planet in the scattered disc which is 27% more massive than Pluto, was discovered. This led the International Astronomical Union (IAU) to define the term \"planet\" formally in 2006, during their 26th General Assembly. That definition excluded Pluto and reclassified it as a dwarf planet.\n\nPluto is the ninth-largest and tenth-most-massive known object directly orbiting the Sun. It is the largest known trans-Neptunian object by volume but is less massive than Eris. Like other Kuiper belt objects, Pluto is primarily made of ice and rock and is relatively small—one-sixth the mass of the Moon and one-third its volume. It has a moderately eccentric and inclined orbit during which it ranges from 30 to 49 astronomical units or AU (4.4–7.4 billion km) from the Sun. This means that Pluto periodically comes closer to the Sun than Neptune, but a stable orbital resonance with Neptune prevents them from colliding. Light from the Sun takes 5.5 hours to reach Pluto at its average distance (39.5 AU).\n\nPluto has five known moons: Charon (the largest, with a diameter just over half that of Pluto), Styx, Nix, Kerberos, and Hydra. Pluto and Charon are sometimes considered a binary system because the barycenter of their orbits does not lie within either body.\n\"\"\"\n\nThe eight key points are:\n\n1. The text explains that Pluto is the largest known trans-Neptunian object (TNO) by volume.\n\n2. The text explains that Pluto is the largest known TNO by mass.\n\n3. The text explains that Pluto is the largest known TNO by volume.\n\n4. The text explains that Pluto is the largest known TNO by mass.\n\n5. The text explains that Pluto is the largest known TNO by volume.\n\n6. The text explains that Pluto is the largest known TNO by mass.\n\n7. The text explains that Pluto is the largest known TNO by volume.\n\n8. The text explains that Pluto is the largest known TNO by mass.\n\nThe eighth point is the most important and the one that most people will remember. The text explains that Pluto is the largest known TNO by mass.\n\nThe text is very clear that Pluto is the largest known trans-Neptunian object. The text says in the first paragraph that Pluto was the first and largest (and the only) known trans-Neptunian object. The text says",
  temperature=0.5,
  max_tokens=233,
  top_p=1,
  frequency_penalty=0,
  presence_penalty=0,
  stop=["\"\"\""]
)
```


```bash
1. The text explains that Pluto is the largest known trans-Neptunian object (TNO) by volume.
2. The text explains that Pluto is the largest known TNO by mass.
3. The text explains that Pluto is the largest known TNO by volume.
4. The text explains that Pluto is the largest known TNO by mass.
5. The text explains that Pluto is the largest known TNO by volume.
6. The text explains that Pluto is the largest known TNO by mass.
7. The text explains that Pluto is the largest known TNO by volume.
8. The text explains that Pluto is the largest known TNO by mass.
```

一回の呼び出して複数の質問を投げることができるらしい．
また，連続する質問に関連かあることを示すことで流れを表現できるとか