MCPcopy Create free account
hub / github.com/CopilotKit/OpenGenerativeUI / _repaired_message

Function _repaired_message

apps/agent/src/anthropic_compat.py:18–32  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

16
17
18def _repaired_message(message):
19 if not isinstance(message, AIMessage) or not isinstance(message.content, list):
20 return message
21 if not any(
22 isinstance(b, dict) and b.get("type") == "thinking" and "thinking" not in b
23 for b in message.content
24 ):
25 return message
26 content = [
27 {**b, "thinking": ""}
28 if isinstance(b, dict) and b.get("type") == "thinking" and "thinking" not in b
29 else b
30 for b in message.content
31 ]
32 return message.model_copy(update={"content": content})
33
34
35def _reordered(request: ModelRequest) -> ModelRequest:

Callers 1

_reorderedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected