mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-11 03:38:38 +00:00
refactor(streaming): drop explanatory comments
AGENTS.md allows comments only for complex business logic, tool directives or TODOs. These three explained why the two reads are annotated: the values reach get_litellm_params and the handler through untyped kwargs and an extra field on GenericLiteLLMParams, so an unannotated read is an Any and counts against the unknown-argument budget. Declaring the fields would change the proxy OpenAPI spec
This commit is contained in:
parent
9e280426a0
commit
395fed3cb6
2 changed files with 0 additions and 9 deletions
|
|
@ -230,9 +230,6 @@ class CustomStreamWrapper:
|
|||
dict(**self.logging_obj.model_call_details.get("litellm_params", {}))
|
||||
)
|
||||
self.merge_reasoning_content_in_choices: bool = litellm_params.merge_reasoning_content_in_choices or False
|
||||
# GenericLiteLLMParams allows extra fields, so the flag arrives without being
|
||||
# declared on it. The annotation is what keeps this off the unknown-argument
|
||||
# budget; declaring the field would change the proxy OpenAPI spec.
|
||||
request_strict: Final[bool | None] = getattr(litellm_params, "strict_stream_completion", None)
|
||||
self.strict_stream_completion: bool = (
|
||||
bool(litellm.strict_stream_completion) if request_strict is None else bool(request_strict)
|
||||
|
|
@ -1726,10 +1723,6 @@ class CustomStreamWrapper:
|
|||
|
||||
@received_finish_reason.setter
|
||||
def received_finish_reason(self, value: str | None) -> None:
|
||||
# A provider assigning this at all is the provider saying the stream
|
||||
# ended, even when the reason it gives is empty. Recording that here
|
||||
# rather than beside each of the dozen assignments keeps the two from
|
||||
# drifting apart.
|
||||
self._received_finish_reason = value
|
||||
if value is not None:
|
||||
self.stream_reported_finished = True
|
||||
|
|
|
|||
|
|
@ -5658,8 +5658,6 @@ def completion(
|
|||
messages = function_call_prompt(messages=messages, functions=functions_unsupported_model)
|
||||
|
||||
# For logging - save the values of the litellm-specific params passed in
|
||||
# kwargs is untyped, so reading the flag straight into the call makes it an
|
||||
# Any argument; the annotation keeps it off the unknown-argument budget.
|
||||
strict_stream_completion: bool | None = kwargs.get("strict_stream_completion", None)
|
||||
requested_litellm_params: Final = get_litellm_params(
|
||||
acompletion=acompletion,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue