haive.core.engine.document.loaders.sources.implementation¶

Enhanced Source Implementation for Document Engine.

This module provides enhanced source type implementations adapted from the original project_notes with proper integration into the Haive document engine framework.

Classes¶

CloudStorageSource

Source for cloud storage.

Credential

Credential information for authenticated sources.

CredentialManager

Manages credentials for various source types.

CredentialType

Types of credentials supported.

DatabaseSource

Source for database connections.

EnhancedSource

Enhanced base class for document sources.

LocalDirectorySource

Source for local directories.

LocalFileSource

Source for local files.

SourceRegistry

Registry for managing source types.

SourceType

Enhanced source type classification.

TextInputSource

Source for direct text input.

WebUrlSource

Source for web URLs.

Module Contents¶

class haive.core.engine.document.loaders.sources.implementation.CloudStorageSource(/, **data)[source]¶

Bases: EnhancedSource

Source for cloud storage.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Check if this is a cloud storage path.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Get confidence score for cloud storage.

Parameters:

path (str)

Return type:

float

get_credential_requirements()[source]¶

Cloud storage needs API credentials.

Return type:

list[CredentialType]

requires_authentication()[source]¶

Cloud storage typically requires authentication.

Return type:

bool

class haive.core.engine.document.loaders.sources.implementation.Credential(/, **data)[source]¶

Bases: pydantic.BaseModel

Credential information for authenticated sources.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class haive.core.engine.document.loaders.sources.implementation.CredentialManager[source]¶

Manages credentials for various source types.

Init .

Returns:

Add return description]

Return type:

[TODO

add_credential(source_id, credential)[source]¶

Add a credential for a source.

Parameters:
Return type:

None

get_credential(source_id)[source]¶

Get credential for a source.

Parameters:

source_id (str)

Return type:

Credential | None

has_credential(source_id)[source]¶

Check if credential exists for source.

Parameters:

source_id (str)

Return type:

bool

class haive.core.engine.document.loaders.sources.implementation.CredentialType[source]¶

Bases: str, enum.Enum

Types of credentials supported.

Initialize self. See help(type(self)) for accurate signature.

class haive.core.engine.document.loaders.sources.implementation.DatabaseSource(/, **data)[source]¶

Bases: EnhancedSource

Source for database connections.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Check if this is a database URI.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Get confidence score for database URIs.

Parameters:

path (str)

Return type:

float

get_credential_requirements()[source]¶

Database sources need connection credentials.

Return type:

list[CredentialType]

requires_authentication()[source]¶

Database sources typically require authentication.

Return type:

bool

class haive.core.engine.document.loaders.sources.implementation.EnhancedSource(/, **data)[source]¶

Bases: pydantic.BaseModel, abc.ABC

Enhanced base class for document sources.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

abstractmethod can_handle(path)[source]¶

Check if this source can handle the given path.

Parameters:

path (str)

Return type:

bool

abstractmethod get_confidence_score(path)[source]¶

Get confidence score (0.0-1.0) for handling this path.

Parameters:

path (str)

Return type:

float

get_credential_requirements()[source]¶

Get required credential types.

Return type:

list[CredentialType]

requires_authentication()[source]¶

Check if this source requires authentication.

Return type:

bool

class haive.core.engine.document.loaders.sources.implementation.LocalDirectorySource(/, **data)[source]¶

Bases: EnhancedSource

Source for local directories.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Check if this is a local directory.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Get confidence score for local directories.

Parameters:

path (str)

Return type:

float

class haive.core.engine.document.loaders.sources.implementation.LocalFileSource(/, **data)[source]¶

Bases: EnhancedSource

Source for local files.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Check if this is a local file.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Get confidence score for local files.

Parameters:

path (str)

Return type:

float

class haive.core.engine.document.loaders.sources.implementation.SourceRegistry[source]¶

Registry for managing source types.

Init .

Returns:

Add return description]

Return type:

[TODO

find_all_sources(path)[source]¶

Find all sources that can handle a path with confidence scores.

Parameters:

path (str)

Return type:

list[tuple[EnhancedSource, float]]

find_best_source(path)[source]¶

Find the best source for a given path.

Parameters:

path (str)

Return type:

EnhancedSource | None

register(source)[source]¶

Register a new source type.

Parameters:

source (EnhancedSource)

class haive.core.engine.document.loaders.sources.implementation.SourceType[source]¶

Bases: str, enum.Enum

Enhanced source type classification.

Initialize self. See help(type(self)) for accurate signature.

class haive.core.engine.document.loaders.sources.implementation.TextInputSource(/, **data)[source]¶

Bases: EnhancedSource

Source for direct text input.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Text input can handle anything as fallback.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Low confidence - fallback option.

Parameters:

path (str)

Return type:

float

class haive.core.engine.document.loaders.sources.implementation.WebUrlSource(/, **data)[source]¶

Bases: EnhancedSource

Source for web URLs.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

can_handle(path)[source]¶

Check if this is a valid web URL.

Parameters:

path (str)

Return type:

bool

get_confidence_score(path)[source]¶

Get confidence score for web URLs.

Parameters:

path (str)

Return type:

float