mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-12 14:52:11 +02:00
fix: use max_completion_tokens instead of deprecated max_tokens
The OpenAI API deprecated `max_tokens` in favor of `max_completion_tokens` for chat completion endpoints. Newer models (gpt-4o, o1, o3, gpt-5.x) reject `max_tokens` with: "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead." This updates both the OpenAI and Azure OpenAI text completion providers to use the new parameter name. Fixes both streaming and non-streaming code paths.
This commit is contained in:
parent
d30857b5c3
commit
2f23efc269
2 changed files with 4 additions and 4 deletions
|
|
@ -90,7 +90,7 @@ class Processor(LlmService):
|
|||
}
|
||||
],
|
||||
temperature=effective_temperature,
|
||||
max_tokens=self.max_output,
|
||||
max_completion_tokens=self.max_output,
|
||||
top_p=1,
|
||||
)
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class Processor(LlmService):
|
|||
}
|
||||
],
|
||||
temperature=effective_temperature,
|
||||
max_tokens=self.max_output,
|
||||
max_completion_tokens=self.max_output,
|
||||
top_p=1,
|
||||
stream=True,
|
||||
stream_options={"include_usage": True}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class Processor(LlmService):
|
|||
}
|
||||
],
|
||||
temperature=effective_temperature,
|
||||
max_tokens=self.max_output,
|
||||
max_completion_tokens=self.max_output,
|
||||
)
|
||||
|
||||
inputtokens = resp.usage.prompt_tokens
|
||||
|
|
@ -152,7 +152,7 @@ class Processor(LlmService):
|
|||
}
|
||||
],
|
||||
temperature=effective_temperature,
|
||||
max_tokens=self.max_output,
|
||||
max_completion_tokens=self.max_output,
|
||||
stream=True,
|
||||
stream_options={"include_usage": True}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue