Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions litellm/litellm_core_utils/streaming_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import threading
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Union, cast
from typing import Any, AsyncIterator, Callable, Dict, Iterator, List, Optional, Union, cast

import httpx
from pydantic import BaseModel
Expand Down Expand Up @@ -150,10 +150,10 @@ def __init__(
self.is_function_call = self.check_is_function_call(logging_obj=logging_obj)
self.created: Optional[int] = None

def __iter__(self):
def __iter__(self) -> Iterator["ModelResponseStream"]:
return self

def __aiter__(self):
def __aiter__(self) -> AsyncIterator["ModelResponseStream"]:
return self

def check_send_stream_usage(self, stream_options: Optional[dict]):
Expand Down Expand Up @@ -1704,7 +1704,7 @@ def finish_reason_handler(self):
model_response.choices[0].finish_reason = "tool_calls"
return model_response

def __next__(self): # noqa: PLR0915
def __next__(self) -> "ModelResponseStream": # noqa: PLR0915
cache_hit = False
if (
self.custom_llm_provider is not None
Expand Down Expand Up @@ -1878,7 +1878,7 @@ async def fetch_stream(self):

return self.completion_stream

async def __anext__(self): # noqa: PLR0915
async def __anext__(self) -> "ModelResponseStream": # noqa: PLR0915
cache_hit = False
if (
self.custom_llm_provider is not None
Expand Down
5 changes: 4 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ exclude = ["litellm/types/*", "litellm/__init__.py", "litellm/proxy/example_conf
"litellm/llms/anthropic/chat/__init__.py" = ["F401"]
"litellm/llms/azure_ai/embed/__init__.py" = ["F401"]
"litellm/llms/azure_ai/rerank/__init__.py" = ["F401"]
"litellm/llms/bedrock/chat/__init__.py" = ["F401"]
"litellm/llms/bedrock/chat/__init__.py" = ["F401"]
"litellm/proxy/utils.py" = ["F401", "PLR0915"]
"litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py" = ["PLR0915"]
"litellm/proxy/guardrails/guardrail_hooks/guardrail_benchmarks/test_eval.py" = ["PLR0915"]
Loading