Skip to content

prompts

Class info

Classes

Name Children Inherits
UserDocumentPrompt
clawd_code_sdk.models.prompts
A user prompt containing a base64-encoded PDF document.
    UserDocumentURLPrompt
    clawd_code_sdk.models.prompts
    A user prompt containing a PDF document referenced by URL.
      UserFilePrompt
      clawd_code_sdk.models.prompts
      A user prompt referencing a file uploaded via the Anthropic Files API.
        UserImagePrompt
        clawd_code_sdk.models.prompts
        A user prompt containing a single base64-encoded image.
          UserImageURLPrompt
          clawd_code_sdk.models.prompts
          A user prompt containing an image referenced by URL.
            UserPlainTextDocumentPrompt
            clawd_code_sdk.models.prompts
            A user prompt containing a plain text document.
              UserTextPrompt
              clawd_code_sdk.models.prompts
              A text-only user prompt.

                🛈 DocStrings

                Content blocks, message types, and stream events.

                UserPrompt module-attribute

                Union type for all user prompt dataclasses.

                UserDocumentPrompt dataclass

                A user prompt containing a base64-encoded PDF document.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserDocumentPrompt:
                    """A user prompt containing a base64-encoded PDF document."""
                
                    document_data: str
                    """Base64-encoded PDF data."""
                    media_type: DocumentMediaType = "application/pdf"
                    """MIME type of the document."""
                    title: str | None = None
                    """Optional document title."""
                    context: str | None = None
                    """Optional context about the document."""
                
                    def to_content_block(self) -> BetaRequestDocumentBlockParam:
                        """Return the Anthropic API content block dict."""
                        block = BetaRequestDocumentBlockParam(
                            type="document",
                            source=BetaBase64PDFSourceParam(
                                type="base64",
                                media_type=self.media_type,
                                data=self.document_data,
                            ),
                            title=self.title,
                            context=self.context,
                        )
                        return cast(
                            "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                        )
                

                context class-attribute instance-attribute

                context: str | None = None
                

                Optional context about the document.

                document_data instance-attribute

                document_data: str
                

                Base64-encoded PDF data.

                media_type class-attribute instance-attribute

                media_type: DocumentMediaType = 'application/pdf'
                

                MIME type of the document.

                title class-attribute instance-attribute

                title: str | None = None
                

                Optional document title.

                to_content_block

                to_content_block() -> BetaRequestDocumentBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaRequestDocumentBlockParam:
                    """Return the Anthropic API content block dict."""
                    block = BetaRequestDocumentBlockParam(
                        type="document",
                        source=BetaBase64PDFSourceParam(
                            type="base64",
                            media_type=self.media_type,
                            data=self.document_data,
                        ),
                        title=self.title,
                        context=self.context,
                    )
                    return cast(
                        "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                    )
                

                UserDocumentURLPrompt dataclass

                A user prompt containing a PDF document referenced by URL.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserDocumentURLPrompt:
                    """A user prompt containing a PDF document referenced by URL."""
                
                    url: str
                    """Public URL of the PDF document."""
                    title: str | None = None
                    """Optional document title."""
                    context: str | None = None
                    """Optional context about the document."""
                
                    def to_content_block(self) -> BetaRequestDocumentBlockParam:
                        """Return the Anthropic API content block dict."""
                        block = BetaRequestDocumentBlockParam(
                            type="document",
                            source=BetaURLPDFSourceParam(type="url", url=self.url),
                            title=self.title,
                            context=self.context,
                        )
                        return cast(
                            "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                        )
                

                context class-attribute instance-attribute

                context: str | None = None
                

                Optional context about the document.

                title class-attribute instance-attribute

                title: str | None = None
                

                Optional document title.

                url instance-attribute

                url: str
                

                Public URL of the PDF document.

                to_content_block

                to_content_block() -> BetaRequestDocumentBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaRequestDocumentBlockParam:
                    """Return the Anthropic API content block dict."""
                    block = BetaRequestDocumentBlockParam(
                        type="document",
                        source=BetaURLPDFSourceParam(type="url", url=self.url),
                        title=self.title,
                        context=self.context,
                    )
                    return cast(
                        "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                    )
                

                UserFilePrompt dataclass

                A user prompt referencing a file uploaded via the Anthropic Files API.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserFilePrompt:
                    """A user prompt referencing a file uploaded via the Anthropic Files API."""
                
                    file_id: str
                    """Anthropic file identifier (e.g. 'file_abc123')."""
                    title: str | None = None
                    """Optional document title."""
                    context: str | None = None
                    """Optional context about the document."""
                
                    def to_content_block(self) -> BetaRequestDocumentBlockParam:
                        """Return the Anthropic API content block dict."""
                        block = BetaRequestDocumentBlockParam(
                            type="document",
                            source=BetaFileDocumentSourceParam(type="file", file_id=self.file_id),
                            title=self.title,
                            context=self.context,
                        )
                        return cast(
                            "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                        )
                

                context class-attribute instance-attribute

                context: str | None = None
                

                Optional context about the document.

                file_id instance-attribute

                file_id: str
                

                Anthropic file identifier (e.g. 'file_abc123').

                title class-attribute instance-attribute

                title: str | None = None
                

                Optional document title.

                to_content_block

                to_content_block() -> BetaRequestDocumentBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaRequestDocumentBlockParam:
                    """Return the Anthropic API content block dict."""
                    block = BetaRequestDocumentBlockParam(
                        type="document",
                        source=BetaFileDocumentSourceParam(type="file", file_id=self.file_id),
                        title=self.title,
                        context=self.context,
                    )
                    return cast(
                        "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                    )
                

                UserImagePrompt dataclass

                A user prompt containing a single base64-encoded image.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserImagePrompt:
                    """A user prompt containing a single base64-encoded image."""
                
                    image_data: str
                    """Base64-encoded image data."""
                    media_type: ImageMediaType
                    """MIME type of the image."""
                
                    def to_content_block(self) -> BetaImageBlockParam:
                        """Return the Anthropic API content block dict."""
                        return BetaImageBlockParam(
                            type="image",
                            source=BetaBase64ImageSourceParam(
                                type="base64",
                                media_type=self.media_type,
                                data=self.image_data,
                            ),
                        )
                

                image_data instance-attribute

                image_data: str
                

                Base64-encoded image data.

                media_type instance-attribute

                media_type: ImageMediaType
                

                MIME type of the image.

                to_content_block

                to_content_block() -> BetaImageBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaImageBlockParam:
                    """Return the Anthropic API content block dict."""
                    return BetaImageBlockParam(
                        type="image",
                        source=BetaBase64ImageSourceParam(
                            type="base64",
                            media_type=self.media_type,
                            data=self.image_data,
                        ),
                    )
                

                UserImageURLPrompt dataclass

                A user prompt containing an image referenced by URL.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserImageURLPrompt:
                    """A user prompt containing an image referenced by URL."""
                
                    url: str
                    """Public URL of the image."""
                
                    def to_content_block(self) -> BetaImageBlockParam:
                        """Return the Anthropic API content block dict."""
                        return BetaImageBlockParam(
                            type="image",
                            source=BetaURLImageSourceParam(type="url", url=self.url),
                        )
                

                url instance-attribute

                url: str
                

                Public URL of the image.

                to_content_block

                to_content_block() -> BetaImageBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaImageBlockParam:
                    """Return the Anthropic API content block dict."""
                    return BetaImageBlockParam(
                        type="image",
                        source=BetaURLImageSourceParam(type="url", url=self.url),
                    )
                

                UserPlainTextDocumentPrompt dataclass

                A user prompt containing a plain text document.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserPlainTextDocumentPrompt:
                    """A user prompt containing a plain text document."""
                
                    data: str
                    """The plain text content."""
                    media_type: PlainTextMediaType = "text/plain"
                    """MIME type (always text/plain)."""
                    title: str | None = None
                    """Optional document title."""
                    context: str | None = None
                    """Optional context about the document."""
                
                    def to_content_block(self) -> BetaRequestDocumentBlockParam:
                        """Return the Anthropic API content block dict."""
                        block = BetaRequestDocumentBlockParam(
                            type="document",
                            source=BetaPlainTextSourceParam(
                                type="text",
                                media_type=self.media_type,
                                data=self.data,
                            ),
                            title=self.title,
                            context=self.context,
                        )
                        return cast(
                            "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                        )
                

                context class-attribute instance-attribute

                context: str | None = None
                

                Optional context about the document.

                data instance-attribute

                data: str
                

                The plain text content.

                media_type class-attribute instance-attribute

                media_type: PlainTextMediaType = 'text/plain'
                

                MIME type (always text/plain).

                title class-attribute instance-attribute

                title: str | None = None
                

                Optional document title.

                to_content_block

                to_content_block() -> BetaRequestDocumentBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaRequestDocumentBlockParam:
                    """Return the Anthropic API content block dict."""
                    block = BetaRequestDocumentBlockParam(
                        type="document",
                        source=BetaPlainTextSourceParam(
                            type="text",
                            media_type=self.media_type,
                            data=self.data,
                        ),
                        title=self.title,
                        context=self.context,
                    )
                    return cast(
                        "BetaRequestDocumentBlockParam", {k: v for k, v in block.items() if v is not None}
                    )
                

                UserTextPrompt dataclass

                A text-only user prompt.

                Source code in src/clawd_code_sdk/models/prompts.py
                @dataclass
                class UserTextPrompt:
                    """A text-only user prompt."""
                
                    text: str
                
                    def to_content_block(self) -> BetaTextBlockParam:
                        """Return the Anthropic API content block dict."""
                        return BetaTextBlockParam(type="text", text=self.text)
                

                to_content_block

                to_content_block() -> BetaTextBlockParam
                

                Return the Anthropic API content block dict.

                Source code in src/clawd_code_sdk/models/prompts.py
                def to_content_block(self) -> BetaTextBlockParam:
                    """Return the Anthropic API content block dict."""
                    return BetaTextBlockParam(type="text", text=self.text)