Check logit_bias property. It affects the likelihood of specified tokens from appearing in the completion.
...
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
logit_bias: {11759:-100, 4208:-100}
...
where 11759, 4208 are the token ids of the words "politics" and "war",
and -100 means to ban.
Check this tokenizer for the token ids of the words.