File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -367,12 +367,31 @@ def __init__(
367367
368368 @property
369369 def system_prompt (self ) -> str | None :
370- """Get the system prompt."""
370+ """Get the system prompt as a string for backwards compatibility.
371+
372+ Returns the system prompt as a concatenated string when it contains text content,
373+ or None if no text content is present. This maintains backwards compatibility
374+ with existing code that expects system_prompt to be a string.
375+
376+ Returns:
377+ The system prompt as a string, or None if no text content exists.
378+ """
371379 return self ._system_prompt
372380
373381 @system_prompt .setter
374382 def system_prompt (self , value : str | list [SystemContentBlock ] | None ) -> None :
375- """Set the system prompt and update internal content representation."""
383+ """Set the system prompt and update internal content representation.
384+
385+ Accepts either a string or list of SystemContentBlock objects.
386+ When set, both the backwards-compatible string representation and the internal
387+ content block representation are updated to maintain consistency.
388+
389+ Args:
390+ value: System prompt as string, list of SystemContentBlock objects, or None.
391+ - str: Simple text prompt (most common use case)
392+ - list[SystemContentBlock]: Content blocks with features like caching
393+ - None: Clear the system prompt
394+ """
376395 self ._system_prompt , self ._system_prompt_content = self ._initialize_system_prompt (value )
377396
378397 @property
You can’t perform that action at this time.
0 commit comments