Skip to content

Instantly share code, notes, and snippets.

@kennethleungty
Created December 16, 2025 17:40
Show Gist options
  • Select an option

  • Save kennethleungty/0dec0c55659eda34f4abfc15b16874b0 to your computer and use it in GitHub Desktop.

Select an option

Save kennethleungty/0dec0c55659eda34f4abfc15b16874b0 to your computer and use it in GitHub Desktop.
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ModelCallResult:
"""Update the system message to include the todo system prompt."""
if request.system_message is not None:
new_system_content = [
*request.system_message.content_blocks,
{"type": "text", "text": f"\n\n{self.system_prompt}"},
]
else:
new_system_content = [{"type": "text", "text": self.system_prompt}]
new_system_message = SystemMessage(
content=cast("list[str | dict[str, str]]", new_system_content)
)
return handler(request.override(system_message=new_system_message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment