Connector API Reference
Complete API reference for theConnector interface and related types.
Connector Interface
All connectors implement this interface:/home/daytona/workspace/source/packages/retrieval/src/lib/connectors/connector.ts:1-28
Properties
sourceId
Type:string
Required: Yes
Unique identifier for the logical source (group of documents) used in the embedding store.
{source-type}:{identifier}:
github:file:{path}- GitHub filegithub:releases:{repo}- GitHub releasesgithub:repo:{url}- GitHub repositoryrss:{url}- RSS feedglob:{pattern}- Local filespdf:{pattern}- PDF fileslinear:workspace- Linear issues
sources
Type:() => AsyncGenerator<Document>
Required: Yes
Async generator function that yields documents to ingest.
ingestWhen
Type:'never' | 'contentChanged' | 'expired'
Required: No
Default: 'contentChanged'
Controls ingestion behavior:
‘never’
Perform ingestion only if the source does NOT yet exist. Once created, never re-ingest.
expiresAfter
Type:number
Required: No
Unit: Milliseconds
Optional expiry duration in milliseconds from now. When set, the source will be considered expired after this duration.
Document Type
Documents yielded bysources():
id
Type:string
Required: Yes
Unique document identifier within the source.
content
Type:() => Promise<string>
Required: Yes
Async function that returns document content.
metadata
Type:Record<string, unknown>
Required: No
Arbitrary per-document metadata stored with embeddings.
Creating Custom Connectors
Basic Example
With Expiry
With Error Handling
Built-in Connectors
github.file()
github.release()
github.repo()
rss()
local()
pdf()
pdfFile()
linear()
Best Practices
Unique Source IDs
Ensure source IDs uniquely identify content:Error Handling in Content
Handle errors gracefully incontent() function:
Lazy Content Loading
Use async functions to defer content loading:Meaningful Metadata
Include metadata that aids filtering or display:Next Steps
Store API
Store interface reference
Core API
ingest() and similaritySearch() reference
Connectors Guide
Learn about connectors