this happens 1 in 10 calls
normally my response content looks like
{
"name": "some data",
"tactic": "some data",
"content": "some data"
}
and it counts around 500 tokens, which is just what I expect from the api, but sometimes it returns
{
"name": "some data",
"tactic": "some data",
"content": "some data"
}
it added a loooooot empty space or newline and the completion token showed that this response used all of my max_token that I set.
using gpt-4-1106-preview, below is the code making calls to the model
response = openai.chat.completions.create(
model=input_model,
response_format={ "type": "json_object" },
messages=[
{"role": "system", "content": "你是一个金牌顾问式销售,帮助构思1000字的话术,不要吹嘘自己的产品,语气不要太活泼也不能太官方,以客户朋友的口吻简洁有效的表达,用话术策略中的数据论证你的观点,不要引用不在策略内的数据,欺骗客户是很严重的问题。You always reply in JSON format"},
{"role": "user", "content": prompt}
],
max_tokens=800,
seed=input_seed,
n=1,
stop=None,
temperature=0.2,
)