mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix: context_management
This commit is contained in:
parent
62757ff48f
commit
1908c3a689
1 changed files with 24 additions and 0 deletions
|
|
@ -48,6 +48,8 @@ class LiteLLMCompletionTransformationHandler:
|
|||
**kwargs,
|
||||
)
|
||||
|
||||
kwargs.pop("context_management", None)
|
||||
|
||||
if _is_async:
|
||||
return self.async_response_api_handler(
|
||||
litellm_completion_request=litellm_completion_request,
|
||||
|
|
@ -105,6 +107,28 @@ class LiteLLMCompletionTransformationHandler:
|
|||
litellm_completion_request=litellm_completion_request,
|
||||
)
|
||||
|
||||
kwargs.pop("context_management", None)
|
||||
|
||||
context_management = responses_api_request.get("context_management")
|
||||
if context_management:
|
||||
compaction_model = litellm_completion_request.get("model", "")
|
||||
compaction_provider = litellm_completion_request.get(
|
||||
"custom_llm_provider"
|
||||
)
|
||||
if compaction_provider:
|
||||
compaction_model = f"{compaction_provider}/{compaction_model}"
|
||||
request_input = await LiteLLMCompletionResponsesConfig._transform_context_management(
|
||||
model=compaction_model,
|
||||
input=request_input,
|
||||
context_management=context_management,
|
||||
)
|
||||
litellm_completion_request["messages"] = (
|
||||
LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages(
|
||||
input=request_input,
|
||||
responses_api_request=responses_api_request,
|
||||
)
|
||||
)
|
||||
|
||||
acompletion_args = {}
|
||||
acompletion_args.update(kwargs)
|
||||
acompletion_args.update(litellm_completion_request)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue