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
Unique identifier for the resource (generated by re-factor)
ID of the account that owns this resource
Name of the resource, e.g.
"quarterly_report.pdf"Path to the directory containing the resource, e.g.
/projects/abc/reportsMIME type of the resource, e.g.
"application/pdf"SHA256 hash of the resource content. Set by re-factor when creating a resource.
Original URI of the resource, if applicable.
External identifier for the resource, if applicable.
Type of external storage, if applicable.
Storage bucket where the resource is stored.
Key for artifact storage in the storage system
Size of the resource in bytes. Set by re-factor when creating a resource.
List of tags associated with the resource
Additional metadata associated with the resource
ID of the user who created the resource
Timestamp when the resource was created. Set by re-factor when creating a resource.
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.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}})Description of the resource, e.g.
A screenshot of the dashboardType of the resource.
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/*.Whether the resource is required or optional
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:
The name that the resource will be referenced by within the runnable.
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

