framework.data_management.DataSourceProvider#

class framework.data_management.DataSourceProvider[source]#

Bases: ABC

Abstract base class for all data source providers.

Data source providers are responsible for: 1. Determining if they can provide data for the current context 2. Retrieving data from their specific source 3. Returning data in a standardized format

abstract property name: str#

Unique identifier for this data source provider.

abstract property context_type: str#

Context type this provider creates.

Should match a registered context type in the context registry for type validation and LLM prompt formatting.

abstractmethod async retrieve_data(request)[source]#

Retrieve data from this source given the current request.

Parameters:

request (DataSourceRequest) – Data source request containing user info, session context, and requester details

Returns:

DataSourceContext with retrieved data, or None if no data available

Raises:
  • Should handle all internal exceptions and return None rather than raising,

  • unless the exception represents a critical system failure.

Return type:

DataSourceContext | None

abstractmethod should_respond(request)[source]#

Determine if this data source should respond to the given request.

This should be a fast check (no I/O) that determines whether it makes sense to call retrieve_data() for the given request.

Parameters:

request (DataSourceRequest) – Data source request with requester information

Returns:

True if this data source should provide data for this request

Return type:

bool

property description: str#

Human-readable description of this data source.

get_config_requirements()[source]#

Get configuration requirements for this data source.

Returns a dictionary describing what configuration this data source needs. This can be used for validation and documentation.

Return type:

Dict[str, Any]

async health_check()[source]#

Perform a health check for this data source.

This is an optional method that can be implemented by data sources that need to verify connectivity or service availability.

Returns:

True if the data source is healthy and available

Return type:

bool

format_for_prompt(context)[source]#

Format this data source’s context for inclusion in LLM prompts.

Each data source provider can override this to control exactly how their data appears in LLM prompts, including section headers and formatting.

Parameters:

context (DataSourceContext) – The DataSourceContext returned by retrieve_data()

Returns:

Formatted string ready for inclusion in LLM prompts

Return type:

str