
ChatGPT å€§èŠæš¡æŽæ° 6/14 & å€äžã
ChatGPT ã®å€§èŠæš¡æŽæ°ãšå€äžãã«ã€ããŠç°¡åã«ç«¯çã«çºããŸããã
ä»å¹Žã®åãã«gpt-3.5-turboãšgpt-4ããªãªãŒã¹ãããããæ°ã¶æã®éã«ããããã®ã¢ãã«ã®äžã«éçºè ãäœã£ãçŽ æŽãããã¢ããªã±ãŒã·ã§ã³ãç»å ŽããããšãåããŠãOpenAI ã¯ãã©ããŒã¢ãããçºè¡šããã®å 容ã¯ïŒ
Chat Completions APIã®æ°ãã颿°åŒã³åºãæ©èœ
gpt-4ãšgpt-3.5-turboãã¢ããããŒããããããã«ãŠãŒã¶ã®æåŸ ãããªã¢ã¯ã·ã§ã³ã«æé©å
GPT-4ãšåãæ©èœåŒã³åºããšãã·ã¹ãã ã¡ãã»ãŒãžã«ããããä¿¡é Œæ§ã®é«ãã¹ãã¢ãªã³ã°ãæèŒããéçºè
(APIãŠãŒã¶)ãã¢ãã«ã®åå¿ããã广çã«å°ãããšãã§ãã2ã€ã®æ©èœãåããŠããŸãã
äŸãã°ãããªãã¯å»è
ã§å€ç§æŽ30幎ã®ã¹ãã·ã£ãªã¹ãã§ãããªã©ã®ããã³ãããéçºè
(APIãŠãŒã¶)ãé©åã«åæèšå®ããããšã§ãå»è
ãšã®çžè«å®€ChatãæäŸããããšãå¯èœã«ãªããŸãã
gpt-3.5-turboã®æ°ãã16Kã³ã³ããã¹ãããŒãžã§ã³ïŒåŸæ¥ã¯4KããŒãžã§ã³ïŒ
gpt-3.5-turboã®4åã®ã³ã³ããã¹ãé·ã2åã®äŸ¡æ Œã§æäŸããŸãïŒ1Kå
¥åããŒã¯ã³ããã0.003ãã«ã1KåºåããŒã¯ã³ããã0.004ãã«ã§ãã16kã®ã³ã³ããã¹ãã¯ããã®ã¢ãã«ã1åã®ãªã¯ãšã¹ãã§20ããŒãžçšåºŠã®ããã¹ãããµããŒãã§ããããã«ãªã£ãããšãæå³ããŸãã
äŸ¡æ Œã®å€äžã

text-embedding-ada-002ã¯ãæã人æ°ã®ãããšã³ãããã£ã³ã°ã¢ãã«ã§ããæ¬æ¥ãããã³ã¹ãã75%åæžãã1KããŒã¯ã³ããã0.0001ãã«ã«ããŸããã
gpt-3.5-turboã¯ãç§ãã¡ã®æã人æ°ã®ãããã£ããã¢ãã«ã§ãæ°çŸäžäººã®ãŠãŒã¶ãŒã®ããã®ChatGPTãé§åããŸãã仿¥ãç§ãã¡ã¯gpt-3.5-turboã®å ¥åããŒã¯ã³ã®ã³ã¹ãã25ïŒ åŒãäžããŸãããéçºè ã¯ããã®ã¢ãã«ã1Kå ¥åããŒã¯ã³ããã0.0015ãã«ã1KåºåããŒã¯ã³ããã0.002ãã«ã§äœ¿çšã§ããããã«ãªããŸãããããã¯ã1ãã«ãããããã700ããŒãžåã«çžåœããŸãã
æå 端ã®åã蟌ã¿ã¢ãã«ã§75%ã®ã³ã¹ãåæžãå®çŸ
gpt-3.5-turboã®å ¥åããŒã¯ã³ã®ã³ã¹ãã25%åæž
gpt-3.5-turbo-16kã¯ãgpt-3.5-turboã®4åã®ã³ã³ããã¹ãé·ã2åã®äŸ¡æ Œã§æäŸããŸãïŒ1Kå
¥åããŒã¯ã³ããã0.003ãã«ã1KåºåããŒã¯ã³ããã0.004ãã«ã§ãã16kã®ã³ã³ããã¹ãã¯ããã®ã¢ãã«ã1åã®ãªã¯ãšã¹ãã§20ããŒãžçšåºŠã®ããã¹ãããµããŒãã§ããããã«ãªã£ãããšãæå³ããŸãã
gpt-3.5-turbo-0301ãšgpt-4-0314ã®éæšå¥šæéã®è¡šæ
æ¬æ¥ã3æã«çºè¡šããgpt-4ãšgpt-3.5-turboã®åæããŒãžã§ã³ã«ã€ããŠãã¢ããã°ã¬ãŒããšéæšå¥šã®ããã»ã¹ãéå§ããäºå®ã§ããå®å®ããã¢ãã«åïŒgpt-3.5-turboãgpt-4ãgpt-4-32kïŒã䜿çšããŠããã¢ããªã±ãŒã·ã§ã³ã¯ã6æ27æ¥ã«äžèšã®æ°ã¢ãã«ã«èªåçã«ã¢ããã°ã¬ãŒããããŸããããŒãžã§ã³éã®ã¢ãã«æ§èœãæ¯èŒããããã«ãEvalsã©ã€ãã©ãªã¯ãã¢ãã«ã®å€æŽããŠãŒã¹ã±ãŒã¹ã«ã©ã®ãããªåœ±é¿ãäžãããã瀺ããããªãã¯ããã³ãã©ã€ããŒãEvalsããµããŒãããŠããŸãã
ãã ãç§»è¡ã«æéãå¿
èŠãªéçºè
ã¯ãAPIãªã¯ãšã¹ãã®ãmodelããã©ã¡ãŒã¿ãŒã«gpt-3.5-turbo-0301ãgpt-4-0314ãgpt-4-32k-0314ãæå®ããŠãæ§ã¢ãã«ã®äœ¿çšãç¶ç¶ã§ããŸãããããã®æ§ã¢ãã«ãžã®ã¢ã¯ã»ã¹ã¯9æ13æ¥ãŸã§ã§ããã以éã¯ããããã®ã¢ãã«åãæå®ãããªã¯ãšã¹ãã¯å€±æããŸããã¢ãã«ã®éæšå¥šåã«é¢ããææ°æ
å ±ã¯ãã¢ãã«ã®éæšå¥šåããŒãžã§ã確èªãã ãããããã¯ããããã®ã¢ãã«ã«å¯Ÿããæåã®ã¢ããããŒãã§ãã
ãããã®ã¢ãã«ã«ã¯ã3æ1æ¥ã«å°å
¥ããã®ãšåãããŒã¿ãã©ã€ãã·ãŒãšã»ãã¥ãªãã£ã®ä¿èšŒãä»å±ããŠããããªã¯ãšã¹ãããçæãããåºåã¯ãã¹ãŠãŠãŒã¶ã®ãã®ã§ããŠãŒã¶ãŒã®APIããŒã¿ããã¬ãŒãã³ã°ã«äœ¿çšãããããšã¯ãªããšã®ããšã
éçºè
ã¯ãgpt-4-0613ãšgpt-3.5-turbo-0613ã«é¢æ°ãèšè¿°ããã¢ãã«ããããã®é¢æ°ãåŒã³åºãããã®åŒæ°ãå«ãJSONãªããžã§ã¯ããåºåããããã«ã€ã³ããªãžã§ã³ãã«éžæã§ããããã«ãªããŸãããããã¯ãGPTã®æ©èœãå€éšã®ããŒã«ãAPIãšãã確å®ã«æ¥ç¶ããããã®æ°ããæ¹æ³ã§ãã
ãããã®ã¢ãã«ã¯ãïŒãŠãŒã¶ãŒã®å
¥åã«å¿ããŠïŒé¢æ°ãåŒã³åºãå¿
èŠãããå Žåã«ãããæ€åºãã颿°ã®ã·ã°ããã£ã«æºæ ããJSONã§å¿çããããã«çްãã調æŽãããŠããŸãã颿°ãåŒã³åºãããšã§ãéçºè
ã¯ã¢ãã«ããæ§é åãããããŒã¿ããã確å®ã«ååŸããããšãã§ããŸããäŸãã°ãéçºè
ã¯æ¬¡ã®ãããªããšãã§ããŸãïŒ
å€éšããŒã«ïŒChatGPT Pluginsãªã©ïŒãåŒã³åºããŠè³ªåã«åçãããã£ããããããäœæããã
Anya ã«ã¡ãŒã«ãéã£ãŠã次ã®éææ¥ã«ã³ãŒããŒã飲ã¿ãããã確èªããããšãã£ãã¯ãšãªã send_email(to: string, body: string) ã®ãããªé¢æ°åŒã³åºãã«å€æããããããã¹ãã³ã®å€©æ°ã¯ã©ãã§ãããã get_current_weather(location: string, unit: 'celsius' | 'fahrenheit') ã«å€æããŸãã
èªç¶èšèªãAPIã³ãŒã«ãããŒã¿ããŒã¹ã¯ãšãªã«å€æãã
仿ã®ããã10ã®é¡§å®¢ã¯èª°ãããget_customers_by_revenue(start_date: string, end_date: string, limit: int)ãªã©ã®å éšAPIã³ãŒã«ã«ããå æã¯ã¢ã¯ã¡ç€Ÿã«äœä»¶ã®æ³šæããã£ããããsql_queryïŒquery: stringïŒã䜿ã£ãŠSQLã¯ãšãªãŒã«å€æããŸãã
ããã¹ãããæ§é åããŒã¿ãæœåºãã
extract_people_data(people: [{name: string, birthday: string, location: string}]ïŒ
ãšãã颿°ãå®çŸ©ããŠãWikipediaã®èšäºã§èšåãããŠãããã¹ãŠã®äººç©ãæœåºããã
ãããã®ãŠãŒã¹ã±ãŒã¹ã¯ã/v1/chat/completionsãšã³ããã€ã³ãã®æ°ããAPIãã©ã¡ãŒã¿ãfunctionsãšfunction_callã«ãã£ãŠå¯èœã«ãªããŸããéçºè åãããã¥ã¡ã³ããåç §ãã颿°åŒã³åºããæ¹åãããã±ãŒã¹ãçºèŠããããè©äŸ¡ã远å ããŠãã ããã
Step1. 颿°ãšãŠãŒã¶ãŒã®å ¥åã§ã¢ãã«ãåŒã³åºã
Request:
curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
"model": "gpt-3.5-turbo-0613",
"messages": [
{"role": "user", "content": "What is the weather like in Boston?"}
],
"functions": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
]
}'Response:
{
"id": "chatcmpl-123",
...
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "get_current_weather",
"arguments": "{ \"location\": \"Boston, MA\"}"
}
},
"finish_reason": "function_call"
}]
}
Step2. ã¢ãã«ã®ã¬ã¹ãã³ã¹ã䜿ã£ãŠAPIãåŒã³åºã
Request:
curl https://weatherapi.com/...Response:
{ "temperature": 22, "unit": "celsius", "description": "Sunny" }Step3. ã¬ã¹ãã³ã¹ãã¢ãã«ã«éãè¿ããŠãŸãšãã
Request:
curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
"model": "gpt-3.5-turbo-0613",
"messages": [
{"role": "user", "content": "What is the weather like in Boston?"},
{"role": "assistant", "content": null, "function_call": {"name": "get_current_weather", "arguments": "{ \"location\": \"Boston, MA\"}"}},
{"role": "function", "name": "get_current_weather", "content": "{\"temperature\": "22", \"unit\": \"celsius\", \"description\": \"Sunny\"}"}
],
"functions": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
]
}'Response:
{
"id": "chatcmpl-123",
...
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "The weather in Boston is currently sunny with a temperature of 22 degrees Celsius.",
},
"finish_reason": "stop"
}]
}