tests/manual/test-create_chat_completion.R

create_chat_completion(
   model = "gpt-3.5-turbo",
   messages = list(
       list(
           "role" = "system",
           "content" = "You are a helpful assistant."
       ),
       list(
           "role" = "user",
           "content" = "Who won the world series in 2020?"
       ),
       list(
           "role" = "assistant",
           "content" = "The Los Angeles Dodgers won the World Series in 2020."
       ),
       list(
           "role" = "user",
           "content" = "Where was it played?"
       )
   )
)

Try the openai package in your browser

Any scripts or data that you put into this service are public.

openai documentation built on March 31, 2023, 11:56 p.m.