Skip to content

Add experimental AI/LLM provider abstraction with local Ollama support - #52

Merged
RedRockerSE merged 1 commit into
mainfrom
claude/refine-local-plan-h14fw8
Jul 14, 2026
Merged

Add experimental AI/LLM provider abstraction with local Ollama support#52
RedRockerSE merged 1 commit into
mainfrom
claude/refine-local-plan-h14fw8

Conversation

@RedRockerSE

Copy link
Copy Markdown
Owner

Summary

This PR introduces an experimental, pluggable LLM provider abstraction to YAFT with a working local backend (Ollama and OpenAI-compatible servers) and full CLI/configuration wiring. AI features are disabled by default and default to local-only execution to ensure forensic case data never leaves the examiner's machine unless explicitly configured.

Key Changes

  • AI Configuration System (src/yaft/core/ai_config.py): Pydantic models for AI provider configuration with validation. Supports Ollama (default, local), Anthropic, and OpenAI (placeholders, not yet implemented). Configuration loaded from config/ai.toml with sensible defaults.

  • Provider Factory & Base Types (src/yaft/ai/factory.py, src/yaft/ai/providers/base.py): Factory function to build configured providers. Base protocol defines is_available() and summarize() interface.

  • OpenAI-Compatible Provider (src/yaft/ai/providers/openai_compatible.py): Working implementation for Ollama, llama.cpp, LM Studio, LocalAI, and vLLM. Includes minimal audit logging (timestamps, latency, success/failure only—never logs prompt/response content).

  • Exception Hierarchy (src/yaft/ai/exceptions.py): Clear error types for disabled features, unimplemented providers, and provider failures.

  • CLI Commands (src/yaft/cli.py):

    • ai-configure: Configure provider, model, base URL, and enable/disable AI features
    • ai-status: Check configuration and test connectivity (no case data sent)
  • CoreAPI Integration (src/yaft/core/api.py):

    • _load_ai_config(): Loads and merges TOML configuration with defaults
    • get_llm_provider(): Public API to retrieve configured provider instance
    • API documentation categorization for AI/LLM methods
  • Configuration File (config/ai.toml): Example configuration with detailed comments explaining the local-first, opt-in design.

  • Comprehensive Tests (tests/test_ai_config.py, tests/test_ai_providers.py):

    • Configuration validation, defaults, and TOML loading
    • Provider availability checks and summarization with mocked HTTP
    • Error paths (disabled features, unimplemented providers)
    • Audit log verification
  • Documentation (docs/YaFT.md, README.md): Usage examples and design rationale.

Notable Implementation Details

  • Local-first design: Ollama is the default provider; cloud providers (Anthropic, OpenAI) have config placeholders but raise AIProviderNotImplementedError if selected, with a clear message directing users to the local backend.
  • Audit logging: Minimal, privacy-preserving logs record only metadata (timestamp, provider, model, latency, success flag)—never prompt or response content.
  • Graceful degradation: Invalid AI config files fall back to defaults with a warning rather than crashing.
  • No case data sent yet: This is plumbing only; no plugin currently sends forensic data to a model.

https://claude.ai/code/session_018MrbNYDqa5eLQdKyvYuTjD

Starter slice for AI features: a provider abstraction, an OpenAI-compatible
local backend, config/CLI wiring, and a safe connectivity check. Defaults to
a local, self-hosted backend since forensic case data often cannot leave
the examiner's machine; cloud providers (Anthropic, OpenAI) are opt-in
placeholders only. No case-data-touching feature ships in this slice.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MrbNYDqa5eLQdKyvYuTjD
@RedRockerSE

Copy link
Copy Markdown
Owner Author

Experimental AI/ML pluggable provider

@RedRockerSE
RedRockerSE merged commit e98c117 into main Jul 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants