Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fixed groq type error

Gregor Žuničaa1309131245
diff --git a/browser_use/llm/groq/serializer.py b/browser_use/llm/groq/serializer.py
index c84957dba..8917b7ded 100644
--- a/browser_use/llm/groq/serializer.py
+++ b/browser_use/llm/groq/serializer.py
@@ -72,19 +72,19 @@ class GroqMessageSerializer:
@staticmethod
def _serialize_assistant_content(
content: str | list[ContentPartTextParam | ContentPartRefusalParam] | None,
- ) -> str | list[ChatCompletionContentPartTextParam] | None:
+ ) -> str | None:
"""Serialize content for assistant messages (text and refusal allowed)."""
if content is None:
return None
if isinstance(content, str):
return content
- serialized_parts: list[ChatCompletionContentPartTextParam] = []
+ serialized_parts: list[str] = []
for part in content:
if part.type == 'text':
- serialized_parts.append(GroqMessageSerializer._serialize_content_part_text(part))
+ serialized_parts.append(GroqMessageSerializer._serialize_content_part_text(part)['text'])
- return serialized_parts
+ return '\n'.join(serialized_parts)
@staticmethod
def _serialize_tool_call(tool_call: ToolCall) -> ChatCompletionMessageToolCallParam: