semantic

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider added in v0.14.0

type Provider interface {
	// Analyze generates semantic understanding for a file.
	// Routes content through appropriate analysis method based on file type:
	// - Images → vision API (if supported)
	// - PDFs → document API (if supported) or text extraction
	// - Office docs → text extraction + analysis
	// - Text files → standard text analysis
	// - Binary files → metadata-only fallback
	Analyze(ctx context.Context, metadata *types.FileMetadata) (*types.SemanticAnalysis, error)

	// Name returns the provider identifier (e.g., "claude", "openai", "gemini")
	Name() string

	// Model returns the model being used (e.g., "claude-sonnet-4-5-20250929")
	Model() string

	// SupportsVision returns whether provider supports image analysis
	SupportsVision() bool

	// SupportsDocuments returns whether provider supports native document (PDF) blocks
	SupportsDocuments() bool
}

Provider defines the interface for semantic analysis providers. Implementations provide AI-powered content understanding for different file types.

type ProviderConfig added in v0.14.0

type ProviderConfig struct {
	// API credentials
	APIKey string

	// Model selection
	Model string

	// Request configuration
	MaxTokens int
	Timeout   int // seconds

	// Feature flags
	EnableVision bool

	// Analysis constraints
	MaxFileSize int64
}

ProviderConfig contains shared configuration for all semantic analysis providers. Provider-specific implementations extract the fields they need.

type ProviderFactory added in v0.14.0

type ProviderFactory func(config ProviderConfig, logger *slog.Logger) (Provider, error)

ProviderFactory creates a Provider instance from configuration. Each provider registers its factory function during initialization.

type Registry added in v0.14.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages all available semantic analysis providers. It provides thread-safe registration, lookup, and listing operations.

func GlobalRegistry added in v0.14.0

func GlobalRegistry() *Registry

GlobalRegistry returns the singleton registry instance

func NewRegistry added in v0.14.0

func NewRegistry() *Registry

NewRegistry creates a new provider registry

func (*Registry) Get added in v0.14.0

func (r *Registry) Get(name string) (ProviderFactory, error)

Get retrieves a provider factory by name. Returns error if the provider is not found.

func (*Registry) List added in v0.14.0

func (r *Registry) List() []string

List returns the names of all registered providers. The returned slice is a copy and safe for concurrent use.

func (*Registry) Register added in v0.14.0

func (r *Registry) Register(name string, factory ProviderFactory)

Register adds a provider factory to the registry. Provider implementations call this in their init() functions. If a provider with the same name already exists, it will be replaced.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL