A2A
This module contains the A2A implementation.
ArtifactType
Bases: StrEnum
Common artifact types for A2A artifacts.
This class provides constants for artifact types used in the A2A protocol.
MimeType
Bases: StrEnum
Common MIME types for A2A artifacts.
This class provides constants for commonly used MIME types in artifact generation, ensuring consistency and reducing typos across the codebase.
get_extension_from_mime_type(mime_type)
Get file extension from MIME type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mime_type |
str
|
The MIME type to get the extension for. |
required |
Returns:
Type | Description |
---|---|
str | None
|
The file extension (with dot) or None if not found. |
Example
get_extension_from_mime_type("text/csv") '.csv' get_extension_from_mime_type("image/png") '.png' get_extension_from_mime_type("unknown/type") None
get_mime_type_from_filename(filename)
Get MIME type from filename extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
str
|
The filename to get the MIME type for. |
required |
Returns:
Type | Description |
---|---|
str
|
The MIME type string, or application/octet-stream if unknown. |
Example
get_mime_type_from_filename("data.csv") 'text/csv' get_mime_type_from_filename("image.png") 'image/png' get_mime_type_from_filename("unknown.xyz") 'application/octet-stream'