Slide 33
Slide 33 text
Chat Completions API
Versatile interface use for all scenarios—not just chat
Model adheres to instructions in “system” message
It sets the behavioral guidelines for the model, including responsible AI steering
Examples go into “User”, “Assistant” fields
import openai
openai.api_type = "azure”
response = openai.ChatCompletion.create(
engine ="gpt-4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The LA Dodgers won the World Series in 2020."},
{"role": "user", "content": "Where was it played?"}
]
)
…