I’m using the API to build out a tool for writing content from press releases. However, when I send the text I want summarized to the API, occasionally, I’m getting back fake quotes attributed to real people. And in some cases, fake quotes attributed to fake people. In one case, it sent back a quote attributed to Jane Doe.
I have tried several methods, but I’m still seeing these fake quotes pop up in my work.
First, I’ve tried modifying the prompt, everything from simplifying it down to one sentence to including a list of instructions. Here is my current prompt I send to the API:
Here are instructions for writing a news article: 1. Stay objective 2. Do not modify any direct quotes 3. Do not use fake names 4. Do not write any quotes that are not in the provided text. Now rewrite the following text as a news article using the instructions you have received: { Text Variable }
But even with detailed instructions, it still returns fake quotes, occasionally.
I’ve also reduced the temperature to 0.4 (down from 1). Should I try to go lower than this?
I have not messed with top P, since I’m not too familiar with what it does, and the documentation suggests changing one or the other.
Here’s my openAI call:
OpenAI API call
def openai_call(prompt):
api_key = “my-key”
headers = {
“Content-Type”: “application/json”,
“Authorization”: f"Bearer {api_key}",
}
data = {
“model”: “text-davinci-003”,
“prompt”: prompt,
“max_tokens”: 2048,
“n”: 1,
“stop”: None,
“temperature”: 0.4,
}
response = requests.post(
“https://api.openai.com/v1/completions”,
headers=headers,
json=data,
)
response.raise_for_status()
text = response.json()[“choices”][0][“text”].strip()
text = remove_br_tags(text)
return text
Any advise for adjusting my settings or prompt is appreciated!