Custom Sources
This folder contains examples of custom source templates built with SAS Retrieval Agent Manager (RAM). Custom sources let you write Python code that fetches data from external APIs and saves it as documents for vectorization.
Each example documents:
- What data it fetches or generates
- Which dependencies it requires
- What files it writes to the source
Creating a Custom Source
Every custom source follows the same steps to set up.
1. Create the Source Template
- On the
Code Templatespane, clickCustom Source. - Copy the example
run.pyinto the template’srun.py. - If needed, copy the example
requirements.txtinto the template’srequirements.txt. - Configure any required environment variables or LLM aliases (see the example’s README).
- Save and publish the template.
2. Create a Source from the Template
- Go to the Sources pane and create a new source using the template you just published.
- Click Save and open your newly created source.
- On the Files tab, click
Synchronize. - On the Jobs tab, you should see your synchronization executing. This is where you can see its status.
3. Create a Collection
- Go to the Collections pane and create a new collection.
- Add the source you just created to the collection.
- Create a new configuration and set the
Configuration update strategytoAppend, sync, and delete. - Vectorize the collection.
4. Set Up Automation
- Go to the Automation pane.
- Click on the pipeline of your source’s name.
- Hover over the dot on the right side of the yellow rectangle until you see your pointer become a +. Then click and drag your cursor to the right side of the blue rectangle. This tells RAM to re-vectorize your collection every time your custom source updates.
Expected Structure
A custom source example will typically contain:
run.py: source implementationrequirements.txt: optional third-party dependencies
Examples
| Example | Description |
|---|---|
| Financial News Fetcher | A source that fetches daily financial news articles for use in a financial news collection |
| News Source | A parameterized news source that fetches from NYT, Reddit, and Yahoo Finance for a configurable news domain |
| NYT Front Page Source | A source that fetches daily headlines from all 26 NYT Top Stories sections |