Set a word’s logit_bias to -100 should ban it from appearing in the conversation.
But its not functioning on current gpt-3.5-turbo api call.
[Reproducible code]
import openai
openai.ChatCompletion.create(
model="gpt-3.5-turbo",
logit_bias= {"2590":-100}, # Token 2590 = 'model' in cl100k_base
temperature= 0,
messages=[{"role": "user", "content": "Introduce yourself"}]
)
Response
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "\n\nHello, I am an AI language model created by OpenAI. I am designed to assist with various tasks such as answering questions, generating text, and providing information. As an AI language model, I do not have a physical form, but I am always ready to help with any queries you may have.",
"role": "assistant"
}
}
],
"created": 1678255213,
"id": "chatcmpl-6rh8PWfsBMK0MhbTG5BeL5sm9I6q8",
"model": "gpt-3.5-turbo-0301",
"object": "chat.completion",
"usage": {
"completion_tokens": 63,
"prompt_tokens": 10,
"total_tokens": 73
}
}
We can see the word “model” still appear in assistant’s reply.