remove slop comments

This commit is contained in:
STJ 2026-03-13 14:40:30 -07:00
parent d9d6fb2e42
commit b6695cd2e1
2 changed files with 0 additions and 37 deletions

View file

@ -20,23 +20,6 @@ T = TypeVar("T", bound=BaseModel)
@dataclass
class ChatLiteLLM(BaseChatModel):
"""Chat model that routes to any provider via LiteLLM.
Uses litellm's unified ``acompletion`` API to support all providers
(OpenAI, Anthropic, Google, Ollama, OpenRouter, DeepSeek, etc.)
through a single interface.
The ``model`` parameter uses litellm's model format, e.g.::
"gpt-4o"
"anthropic/claude-sonnet-4-20250514"
"openrouter/google/gemini-2.0-flash-001"
"ollama/llama3"
Structured output (``output_format``) is handled via litellm's
``response_format`` parameter which translates across providers.
"""
model: str
api_key: str | None = None
api_base: str | None = None
@ -128,16 +111,6 @@ class ChatLiteLLM(BaseChatModel):
output_format: type[T] | None = None,
**kwargs: Any, # noqa: ARG002
) -> ChatInvokeCompletion[T] | ChatInvokeCompletion[str]:
"""Invoke the model via litellm.
Args:
messages: List of browser-use chat messages.
output_format: Optional Pydantic model class for structured output.
**kwargs: Extra keyword args (``session_id`` etc.) ignored.
Returns:
``ChatInvokeCompletion`` with either a string or parsed Pydantic model.
"""
import litellm
litellm_messages = LiteLLMMessageSerializer.serialize(messages)

View file

@ -11,13 +11,10 @@ from browser_use.llm.messages import (
class LiteLLMMessageSerializer:
"""Serializer for converting browser-use message types to LiteLLM format."""
@staticmethod
def _serialize_user_content(
content: str | list[ContentPartTextParam | ContentPartImageParam],
) -> str | list[dict[str, Any]]:
"""Convert user message content for LiteLLM compatibility."""
if isinstance(content, str):
return content
@ -46,7 +43,6 @@ class LiteLLMMessageSerializer:
def _serialize_system_content(
content: str | list[ContentPartTextParam],
) -> str | list[dict[str, Any]]:
"""Convert system message content for LiteLLM compatibility."""
if isinstance(content, str):
return content
@ -62,7 +58,6 @@ class LiteLLMMessageSerializer:
def _serialize_assistant_content(
content: str | list[Any] | None,
) -> str | list[dict[str, Any]] | None:
"""Convert assistant message content for LiteLLM compatibility."""
if content is None:
return None
if isinstance(content, str):
@ -88,11 +83,6 @@ class LiteLLMMessageSerializer:
@staticmethod
def serialize(messages: list[BaseMessage]) -> list[dict[str, Any]]:
"""Convert browser-use messages to litellm-compatible dicts (OpenAI format).
LiteLLM accepts OpenAI-format message dicts for all providers, handling
provider-specific conversion (e.g. image blocks for Anthropic) internally.
"""
result: list[dict[str, Any]] = []
for msg in messages:
if isinstance(msg, UserMessage):