Skip to content

content_blocks

Class info

Classes

Name Children Inherits
Annotations
aclientp.schema.content_blocks
Optional annotations for the client.
    AudioContentBlock
    aclientp.schema.content_blocks
    Audio data for transcription or analysis.
      BaseContentBlock
      aclientp.schema.content_blocks
      Base content block.
      BaseResourceContents
      aclientp.schema.content_blocks
      Text-based resource contents.
      BlobResourceContents
      aclientp.schema.content_blocks
      Binary resource contents.
        EmbeddedResourceContentBlock
        aclientp.schema.content_blocks
        Complete resource contents embedded directly in the message.
          ImageContentBlock
          aclientp.schema.content_blocks
          Images for visual context or analysis.
            ResourceContentBlock
            aclientp.schema.content_blocks
            References to resources that the agent can access.
              TextContentBlock
              aclientp.schema.content_blocks
              Text content.
                TextResourceContents
                aclientp.schema.content_blocks
                Text-based resource contents.

                  🛈 DocStrings

                  Content block schema definitions.

                  Annotations

                  Bases: AnnotatedObject

                  Optional annotations for the client.

                  The client can use annotations to inform how objects are used or displayed.

                  Source code in src/aclientp/schema/content_blocks.py
                  class Annotations(AnnotatedObject):
                      """Optional annotations for the client.
                  
                      The client can use annotations to inform how objects are used or displayed.
                      """
                  
                      audience: Audience | None = None
                      """Audience for the annotated resource."""
                  
                      last_modified: str | None = None
                      """Last modified timestamp of the annotated resource."""
                  
                      priority: float | None = None
                      """Priority of the annotated resource."""
                  
                      @classmethod
                      def optionally_create(
                          cls,
                          audience: Audience | None = None,
                          last_modified: datetime | str | None = None,
                          priority: float | None = None,
                      ) -> Self | None:
                          """Create an annotations object if any value is given, otherwise return None."""
                          if audience is None and last_modified is None and priority is None:
                              return None
                          if isinstance(last_modified, datetime):
                              last_modified = last_modified.strftime("%Y-%m-%dT%H:%M:%SZ")
                          return cls(audience=audience, last_modified=last_modified, priority=priority)
                  

                  audience class-attribute instance-attribute

                  audience: Audience | None = None
                  

                  Audience for the annotated resource.

                  last_modified class-attribute instance-attribute

                  last_modified: str | None = None
                  

                  Last modified timestamp of the annotated resource.

                  priority class-attribute instance-attribute

                  priority: float | None = None
                  

                  Priority of the annotated resource.

                  optionally_create classmethod

                  optionally_create(
                      audience: Audience | None = None,
                      last_modified: datetime | str | None = None,
                      priority: float | None = None,
                  ) -> Self | None
                  

                  Create an annotations object if any value is given, otherwise return None.

                  Source code in src/aclientp/schema/content_blocks.py
                  @classmethod
                  def optionally_create(
                      cls,
                      audience: Audience | None = None,
                      last_modified: datetime | str | None = None,
                      priority: float | None = None,
                  ) -> Self | None:
                      """Create an annotations object if any value is given, otherwise return None."""
                      if audience is None and last_modified is None and priority is None:
                          return None
                      if isinstance(last_modified, datetime):
                          last_modified = last_modified.strftime("%Y-%m-%dT%H:%M:%SZ")
                      return cls(audience=audience, last_modified=last_modified, priority=priority)
                  

                  AudioContentBlock

                  Bases: BaseContentBlock

                  Audio data for transcription or analysis.

                  Requires the audio prompt capability when included in prompts.

                  Source code in src/aclientp/schema/content_blocks.py
                  class AudioContentBlock(BaseContentBlock):
                      """Audio data for transcription or analysis.
                  
                      Requires the `audio` prompt capability when included in prompts.
                      """
                  
                      type: Literal["audio"] = Field(default="audio", init=False)
                  
                      data: str
                      """Base64-encoded audio data."""
                  
                      mime_type: str
                      """MIME type of the audio."""
                  

                  data instance-attribute

                  data: str
                  

                  Base64-encoded audio data.

                  mime_type instance-attribute

                  mime_type: str
                  

                  MIME type of the audio.

                  BaseContentBlock

                  Bases: AnnotatedObject

                  Base content block.

                  Source code in src/aclientp/schema/content_blocks.py
                  class BaseContentBlock(AnnotatedObject):
                      """Base content block."""
                  
                      annotations: Annotations | None = None
                      """Annotations for the content block."""
                  

                  annotations class-attribute instance-attribute

                  annotations: Annotations | None = None
                  

                  Annotations for the content block.

                  BaseResourceContents

                  Bases: AnnotatedObject

                  Text-based resource contents.

                  Source code in src/aclientp/schema/content_blocks.py
                  class BaseResourceContents(AnnotatedObject):
                      """Text-based resource contents."""
                  
                      mime_type: str | None = None
                      """MIME type of the resource."""
                  
                      uri: str
                      """URI of the resource."""
                  

                  mime_type class-attribute instance-attribute

                  mime_type: str | None = None
                  

                  MIME type of the resource.

                  uri instance-attribute

                  uri: str
                  

                  URI of the resource.

                  BlobResourceContents

                  Bases: BaseResourceContents

                  Binary resource contents.

                  Source code in src/aclientp/schema/content_blocks.py
                  class BlobResourceContents(BaseResourceContents):
                      """Binary resource contents."""
                  
                      blob: str
                      """Base64-encoded binary content of the resource."""
                  

                  blob instance-attribute

                  blob: str
                  

                  Base64-encoded binary content of the resource.

                  EmbeddedResourceContentBlock

                  Bases: BaseContentBlock

                  Complete resource contents embedded directly in the message.

                  Preferred for including context as it avoids extra round-trips.

                  Requires the embeddedContext prompt capability when included in prompts.

                  Source code in src/aclientp/schema/content_blocks.py
                  class EmbeddedResourceContentBlock(BaseContentBlock):
                      """Complete resource contents embedded directly in the message.
                  
                      Preferred for including context as it avoids extra round-trips.
                  
                      Requires the `embeddedContext` prompt capability when included in prompts.
                      """
                  
                      type: Literal["resource"] = Field(default="resource", init=False)
                  
                      resource: ResourceContents
                      """Resource content that can be embedded in a message."""
                  

                  resource instance-attribute

                  resource: ResourceContents
                  

                  Resource content that can be embedded in a message.

                  ImageContentBlock

                  Bases: BaseContentBlock

                  Images for visual context or analysis.

                  Requires the image prompt capability when included in prompts.

                  Source code in src/aclientp/schema/content_blocks.py
                  class ImageContentBlock(BaseContentBlock):
                      """Images for visual context or analysis.
                  
                      Requires the `image` prompt capability when included in prompts.
                      """
                  
                      type: Literal["image"] = Field(default="image", init=False)
                  
                      data: str
                      """Base64-encoded image data."""
                  
                      mime_type: str
                      """MIME type of the image."""
                  
                      uri: str | None = None
                      """URI of the image."""
                  

                  data instance-attribute

                  data: str
                  

                  Base64-encoded image data.

                  mime_type instance-attribute

                  mime_type: str
                  

                  MIME type of the image.

                  uri class-attribute instance-attribute

                  uri: str | None = None
                  

                  URI of the image.

                  ResourceContentBlock

                  Bases: BaseContentBlock

                  References to resources that the agent can access.

                  All agents MUST support resource links in prompts.

                  Source code in src/aclientp/schema/content_blocks.py
                  class ResourceContentBlock(BaseContentBlock):
                      """References to resources that the agent can access.
                  
                      All agents MUST support resource links in prompts.
                      """
                  
                      type: Literal["resource_link"] = Field(default="resource_link", init=False)
                  
                      description: str | None = None
                      """Description of the resource."""
                  
                      mime_type: str | None = None
                      """MIME type of the resource."""
                  
                      name: str
                      """Name of the resource."""
                  
                      size: int | None = Field(default=None, ge=0)
                      """Size of the resource in bytes."""
                  
                      title: str | None = None
                      """Title of the resource."""
                  
                      uri: str
                      """URI of the resource."""
                  

                  description class-attribute instance-attribute

                  description: str | None = None
                  

                  Description of the resource.

                  mime_type class-attribute instance-attribute

                  mime_type: str | None = None
                  

                  MIME type of the resource.

                  name instance-attribute

                  name: str
                  

                  Name of the resource.

                  size class-attribute instance-attribute

                  size: int | None = Field(default=None, ge=0)
                  

                  Size of the resource in bytes.

                  title class-attribute instance-attribute

                  title: str | None = None
                  

                  Title of the resource.

                  uri instance-attribute

                  uri: str
                  

                  URI of the resource.

                  TextContentBlock

                  Bases: BaseContentBlock

                  Text content.

                  May be plain text or formatted with Markdown.

                  All agents MUST support text content blocks in prompts. Clients SHOULD render this text as Markdown.

                  Source code in src/aclientp/schema/content_blocks.py
                  class TextContentBlock(BaseContentBlock):
                      """Text content.
                  
                      May be plain text or formatted with Markdown.
                  
                      All agents MUST support text content blocks in prompts.
                      Clients SHOULD render this text as Markdown.
                      """
                  
                      type: Literal["text"] = Field(default="text", init=False)
                  
                      text: str
                      """Text content of the block."""
                  

                  text instance-attribute

                  text: str
                  

                  Text content of the block.

                  TextResourceContents

                  Bases: BaseResourceContents

                  Text-based resource contents.

                  Source code in src/aclientp/schema/content_blocks.py
                  class TextResourceContents(BaseResourceContents):
                      """Text-based resource contents."""
                  
                      text: str
                      """Text content of the resource."""
                  

                  text instance-attribute

                  text: str
                  

                  Text content of the resource.