feat: context compression (#2173)

* feat: context compression

* fix: ruff
This commit is contained in:
Alex
2025-11-24 10:44:19 +00:00
committed by GitHub
parent 7d1c8c008b
commit 17698ce774
28 changed files with 5393 additions and 93 deletions

View File

@@ -128,6 +128,10 @@ class OpenAILLM(BaseLLM):
):
messages = self._clean_messages_openai(messages)
# Convert max_tokens to max_completion_tokens for newer models
if "max_tokens" in kwargs:
kwargs["max_completion_tokens"] = kwargs.pop("max_tokens")
request_params = {
"model": model,
"messages": messages,
@@ -159,6 +163,10 @@ class OpenAILLM(BaseLLM):
):
messages = self._clean_messages_openai(messages)
# Convert max_tokens to max_completion_tokens for newer models
if "max_tokens" in kwargs:
kwargs["max_completion_tokens"] = kwargs.pop("max_tokens")
request_params = {
"model": model,
"messages": messages,