Use max_completion_tokens for OpenAI and Azure OpenAI providers

The OpenAI API deprecated max_tokens in favor of
max_completion_tokens for chat completions. Newer models
(gpt-4o, o1, o3) reject the old parameter with a 400 error.
This commit is contained in:
Cyber MacGeddon 2026-03-28 11:01:55 +00:00
parent a634520509
commit 4aa540c622
2 changed files with 4 additions and 4 deletions

View file

@ -90,7 +90,7 @@ class Processor(LlmService):
} }
], ],
temperature=effective_temperature, temperature=effective_temperature,
max_tokens=self.max_output, max_completion_tokens=self.max_output,
top_p=1, top_p=1,
) )
@ -159,7 +159,7 @@ class Processor(LlmService):
} }
], ],
temperature=effective_temperature, temperature=effective_temperature,
max_tokens=self.max_output, max_completion_tokens=self.max_output,
top_p=1, top_p=1,
stream=True, stream=True,
stream_options={"include_usage": True} stream_options={"include_usage": True}

View file

@ -86,7 +86,7 @@ class Processor(LlmService):
} }
], ],
temperature=effective_temperature, temperature=effective_temperature,
max_tokens=self.max_output, max_completion_tokens=self.max_output,
) )
inputtokens = resp.usage.prompt_tokens inputtokens = resp.usage.prompt_tokens
@ -152,7 +152,7 @@ class Processor(LlmService):
} }
], ],
temperature=effective_temperature, temperature=effective_temperature,
max_tokens=self.max_output, max_completion_tokens=self.max_output,
stream=True, stream=True,
stream_options={"include_usage": True} stream_options={"include_usage": True}
) )