Preprocessing
freeact.preproc.preprocess_prompt
Main preprocessing entry point. Transforms prompt text into agent-ready content.
Currently delegates to
preprocess_attachment_tags
to resolve image attachments. Other tag types (e.g. <skill>) pass through
unchanged for the agent to handle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Prompt text, potentially containing |
required |
max_image_size
|
int
|
Maximum dimension for images (downscaled if larger). |
1024
|
Returns:
| Type | Description |
|---|---|
str | Sequence[UserContent]
|
The original text if no images are found, or a multimodal content list with resolved image data. |
freeact.preproc.preprocess_attachment_tags
Resolve <attachment path="..."/> tags to multimodal content.
Scans text for attachment tags, collects image files from the referenced
paths (a path may point to a single file or a directory), and loads each
image as binary content. The original text is preserved as the last element
of the returned list.
When no attachment tags are found, or none of the referenced paths contain images, the original text is returned unchanged as a plain string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Prompt text potentially containing |
required |
max_image_size
|
int
|
Maximum dimension in pixels. Images exceeding this are downscaled while preserving aspect ratio. |
1024
|
Returns:
| Type | Description |
|---|---|
str | Sequence[UserContent]
|
The original text when no images are found, or a list of
|
Note
Directory paths include all images in that directory (non-recursive).