Principle:Promptfoo Promptfoo External Data Source Integration
| Knowledge Sources | |
|---|---|
| Domains | Integration, Data_Source |
| Last Updated | 2026-02-14 07:45 GMT |
Overview
Principle governing the retrieval of test case data from external cloud services (Google Sheets, Microsoft SharePoint) with automatic authentication handling.
Description
External Data Source Integration defines how promptfoo fetches evaluation data from external cloud services. The principle requires that each integration supports both authenticated and unauthenticated access where applicable, handles URL-based data source resolution (detecting Google Sheets vs SharePoint URLs), and returns data in the standard CsvRow[] format that the test case reader can process. Authentication credentials are sourced from environment variables rather than configuration files.
Usage
Apply this principle when adding new external data source integrations. Each integration should accept a URL, handle authentication, and return standardized CsvRow[] data.
Theoretical Basis
The integration follows the Strategy Pattern where the test case reader selects the appropriate data fetching strategy based on URL pattern:
- Google Sheets URLs → fetchCsvFromGoogleSheet()
- SharePoint URLs → fetchCsvFromSharepoint()
Each strategy handles its own authentication (Google OAuth vs Azure AD certificate-based) but produces the same output format, enabling polymorphic usage in the data loading pipeline.