Motivation
Resources are any piece of unstructured or structured data your AI-driven processes will utilize. This can include documents of any type, webpages, emails, and more. Within re-factor, we provide simple solutions for storing and embedding resources into your LLM workflows so that you can derive the most value for your business processes.Structure
Example Resource
Fields
uuid
required
Unique identifier for the resource (generated by re-factor)
string
required
ID of the account that owns this resource
string
required
Name of the resource, e.g.
"quarterly_report.pdf"string
required
Path to the directory containing the resource, e.g.
/projects/abc/reportsstring
required
MIME type of the resource, e.g.
"application/pdf"string
required
SHA256 hash of the resource content. Set by re-factor when creating a resource.
string | null
Original URI of the resource, if applicable.
string | null
External identifier for the resource, if applicable.
enum<s3, gcs, azure_blob> | null
Type of external storage, if applicable.
string
required
Storage bucket where the resource is stored.
string
required
Key for artifact storage in the storage system
integer
required
Size of the resource in bytes. Set by re-factor when creating a resource.
array<string>
List of tags associated with the resource
object | null
Additional metadata associated with the resource
string | null
ID of the user who created the resource
string
required
Timestamp when the resource was created. Set by re-factor when creating a resource.
string
required
Timestamp when the resource was last updated
Types
ResourcePlaceholder
A placeholder within a Runnable that represents a resource that will be embedded into the runnable at runtime.string
required
Name of the resource, e.g.
screenshot or report. This must be unique within the runnable as it will be used to reference the resource via template variables (e.g. {{screenshot}})string
Description of the resource, e.g.
A screenshot of the dashboardenum<text | file | json>
required
Type of the resource.
array<string>
required
List of valid MIME types that can be embedded into the resource placeholder, e.g.
image/png or application/pdf. Wildcards are supported, e.g. image/*.boolean
required
Whether the resource is required or optional
object
JSON schema for validating the metadata of the resource. This should be
null if no metadata is required. Must be a JSON Schema Draft 7 compliant object.EmbeddedResource
Resources can be embedded into runnables which declareResourcePlaceholders via the EmbeddedResource interface which consists of the following fields:
string
required
The name that the resource will be referenced by within the runnable.
string | Resource
required
The resource that will be embedded into the runnable. This can be a string representing an existing resource’s
id or an instance of a [Resource] object.Features
Storage
Create and manage resources programmatically:
Transformations
Resources can be transformed and processed in various ways:Embedding within Runnables
Resources can be seamlessly integrated into prompts, flows, and agents:Best Practices
When working with resources in re-factor:- Use meaningful names, directory paths, and tags for efficient organization
- Clean up unused resources to save space
Resource Types
re-factor supports various resource types out of the box:- Documents (PDF, Word, Excel, etc.)
- Images (PNG, JPEG, etc.)
- Audio files (MP3, WAV, etc.)
- Video files (MP4, etc.)
- Webpages
- Structured data (JSON, CSV, etc.)
- Custom resource types via plugins

