Open tonyatml opened 1 year ago
Nice! I didn't get the purpose at first, now that I've read carefully, I understand the usage of sending additional role messages with the prompt.
So I'm thinking, should I include all the chat history on every prompt? That would make prompts incrementally complex and expensive, right?
Below is some excerpt that demonstrates why history/context is needed. Very useful repo, by the way.
(9:02:24 AM) : when was albert einstein born?
(9:02:24 AM) : Albert Einstein was born on March 14, 1879.
(9:02:45 AM) : when did he get the nobel prize?
(9:02:45 AM) : I'm sorry, could you please provide more information about the person you are referring to?
(9:08:05 AM) : what is the largest city in nebraska?
(9:08:05 AM) : The largest city in Nebraska is Omaha, with an estimated population of over 470,000 people as of 2021.
(9:08:23 AM) : which river runs by the city?
(9:08:23 AM) : To provide an accurate answer, please specify which city you are referring to.
Hi,
You did a great job, there is a history promps needed if you look https://platform.openai.com/docs/guides/chat/introduction
Note: you need to be using OpenAI Python v0.27.0 for the code below to work
import openai
openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"}, {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."}, {"role": "user", "content": "Where was it played?"} ] )
This will produce more accurate response. Thanks