go-llm-pipeline

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT

README

go-llm-pipeline

An idiomatic, dependency-free Go toolkit for local-first, deterministic LLM orchestration and structured data extraction.

Product Roadmap

go-llm-pipeline is the primary product: a reusable, domain-agnostic toolkit for deterministic LLM workflows. vmontagh/flickr-organizer is a reference application and one of several target use cases built on top of this toolkit.

Proposal: The go-llm-pipeline Project

  • Objective: Build an idiomatic, dependency-free Go toolkit for local-first, deterministic LLM orchestration and structured data extraction.
  • Stance: Most AI frameworks are centered on Python, dynamic chat interfaces, and live API calls. This project provides a contrasting approach with statically typed pipelines, deterministic VCR-style testing, and batch-processing generic assets using concurrent worker pools.

Core Value Propositions

  • Zero-Cost, Deterministic CI/CD: An LLM-aware cassette testing package that records HTTP interactions and replays them locally, with sensitive token scrubbing by default.
  • Type-Safe Extraction: Force LLM outputs directly into strict Go structs.
  • Local-First: Route natively to local inference engines (Ollama) with configurable concurrency caps.
  • Use-Case Agnostic: Support pipelines across media, document, and operational data workflows; not tied to a single vertical application.

Positioning vs. Workflow Orchestrators like Eino

Eino is an excellent fit for autonomous conversational systems (complex state graphs, ReAct loops, multi-agent delegation, and streaming chat UX). go-llm-pipeline is intentionally optimized for deterministic, production batch workflows.

  • Deterministic testing as a first-class feature: pkg/llmvcr records and replays provider HTTP interactions so CI remains fast, stable, and low-cost.
  • Batch extraction over chat streaming: The core workload is high-throughput, typed enrichment of large asset sets into strict Go structs.
  • Developer-orchestrated execution over autonomous loops: Pipeline flow is explicit and predictable (for example, ensemble generation and judge synthesis), reducing drift and runtime surprises.
  • Resource-aware local concurrency: Local compute-bound workers and remote API-bound workers are tuned independently for practical VRAM/CPU/network constraints.
  • Reliability toolkit, not orchestration sprawl: Parse/retry loops, rate-limit handling, provider portability, and deterministic behavior are prioritized over broad agent abstractions.

Strategic framing: If you are building an open-ended AI assistant, Eino may be a better fit. If you are building ETL-style enrichment, legacy data migration, bulk tagging/classification, or strict structured extraction with CI-grade reproducibility, go-llm-pipeline is the better fit.

Positioning vs. Evaluation/Observability Platforms like Comet Opik

Comet Opik is an open-source LLM evaluation and observability platform: tracing, experiment tracking, dataset management, online/offline evaluators, prompt management, and dashboards for monitoring production LLM applications. go-llm-pipeline solves a different (and largely complementary) problem: it is a Go runtime toolkit for executing deterministic, typed, batch LLM workflows.

Similarities
  • Both target teams that need to take LLM workloads seriously in production rather than as ad-hoc scripts.
  • Both emphasize reproducibility and the ability to iterate confidently on prompts, models, and pipelines.
  • Both are open-source, self-hostable, and avoid lock-in to a single hosted vendor.
  • Both treat provider portability (OpenAI, Gemini, local models, etc.) as a first-class concern.
  • Both acknowledge cost and reliability as primary engineering constraints, not afterthoughts.
Key differences
  • Category: Opik is an observability and evaluation control plane (UI, backend, SDKs in Python/TypeScript/Java/Ruby). go-llm-pipeline is an execution substrate — a Go library for orchestrating batch pipelines.
  • Primary workflow: Opik instruments arbitrary LLM apps to collect traces, score outputs, and compare experiments. go-llm-pipeline runs the pipeline itself: worker pools, typed extraction, retries, and local/remote concurrency tuning.
  • Determinism model: go-llm-pipeline provides offline determinism via pkg/llmvcr cassette record/replay, so CI runs without contacting any provider. Opik provides reproducibility via stored traces, datasets, and versioned experiments against live or recorded calls.
  • Type system: go-llm-pipeline is built around strict Go structs and schema-enforced extraction with validation-driven retry loops. Opik is language-agnostic and treats outputs primarily as evaluable artifacts rather than typed runtime contracts.
  • Local-first posture: go-llm-pipeline is designed around local inference (Ollama) with separate concurrency caps for local compute-bound vs. remote API-bound work. Opik is deployment-flexible (self-hosted or Comet Cloud) but is not principally a local inference orchestrator.
  • Footprint: go-llm-pipeline is a dependency-light Go library with no server component. Opik ships a full platform (backend services, frontend, storage) intended to be run as infrastructure.
  • UX surface: Opik's primary surface is a web UI plus SDK instrumentation. go-llm-pipeline's primary surface is Go package APIs consumed by application code and CI.
How they fit together

The two projects are largely complementary rather than competitive:

  • Use go-llm-pipeline to execute deterministic, typed, high-throughput Go pipelines with reproducible CI via cassette replay.
  • Use Opik (or a similar platform) to observe and evaluate those pipelines in staging and production — collecting traces, scoring outputs, comparing prompt/model variants, and monitoring drift over time.

A team building ETL-style LLM enrichment in Go could reasonably adopt go-llm-pipeline for the runtime and pipe traces or evaluation results into Opik for quality governance.

When to choose which
  • Choose Opik if your priority is visibility into existing LLM applications, structured evaluation workflows, experiment comparison, or production monitoring across heterogeneous stacks.
  • Choose go-llm-pipeline if your priority is a typed, dependency-light Go runtime for batch extraction with deterministic, zero-cost CI.
  • Choose both if you want a reliable Go execution substrate underneath an observability and evaluation control plane.

Phase 1: The Testing Core and Abstraction (Next 1-2 Months)

  • Productize the VCR Package (pkg/llmvcr):
    • Extract the current cassette/proxy workflow into a standalone package.
    • Ensure it natively intercepts requests from standard Go HTTP clients used by OpenAI and Gemini SDKs.
    • Implement automatic redaction for common sensitive headers (for example, Authorization and API keys) before writing YAML/JSON cassettes.
  • Define the Generic Asset Interface:
    • Define and standardize the domain-agnostic Asset contract in the analyzer.
type Asset struct {
    ID       string         // Stable unique identifier (for example, URI, filename, or external ID).
    Payload  io.Reader      // Raw asset bytes consumed by the pipeline.
    Metadata map[string]any // Provider-specific attributes that should not be part of raw payload bytes.
}

This interface should support image raws (for example, .DNG and .ARW), plain-text documents (for example, .txt or .md), and structured payloads (for example, .json) using the same pipeline contract.

  • Reference Implementation Migration: Refactor flickr-organizer to consume these extracted packages as a proof point, without coupling core APIs to Flickr-specific concepts.

Phase 2: Structured Data & Schema Enforcement (Months 3-4)

  • Struct Mapping: Implement utilities using JSON Schema validation or provider-specific structured output features to unmarshal LLM responses directly into Go structs.
  • Domain Applications: Document structured data extraction use cases, such as parsing unstructured clinical notes into FHIR resources or normalizing inconsistent logs into a standard schema.
  • Fallback & Retry Logic: Add automatic retries that feed validation errors back to the LLM (for example, field-level schema failures and JSON formatting corrections).
  • Product Packaging: Publish clear package boundaries (pkg/llmvcr, pkg/analyzer, structured extraction helpers) to support adoption by independent applications.

Phase 3: Operator Ergonomics & Local Execution (Months 5-6)

  • Diagnostic Subcommand (<app> doctor):
    • Check local environment readiness before batch jobs.
    • Verify OS file descriptors.
    • Test network latency to hosted APIs.
    • Validate API keys.
    • Probe local Ollama instances and list loaded models.
  • Local Embeddings (Optional Add-on): Introduce a lightweight in-memory vector store (or SQLite extension) for local semantic similarity, deduplication, and clustering without external network calls.
  • Developer Experience: Add practical onboarding guidance and templates for teams creating new vertical applications on top of go-llm-pipeline.

Phase 4: Platform Stabilization (Month 7+)

  • API Freeze: Lock public APIs for pkg/analyzer and pkg/llmvcr under semantic versioning.
  • Documentation: Add comprehensive GoDoc examples and document concurrency patterns (worker pools, errgroup usage) for mixed local/remote LLM workload orchestration.
  • Ecosystem Validation: Maintain flickr-organizer as a first-party reference app and add at least one additional non-photo domain example to validate cross-domain product fit.

Directories

Path Synopsis
pkg
analyzer
Package analyzer provides the Template Method and Builder patterns for LLM-based analysis.
Package analyzer provides the Template Method and Builder patterns for LLM-based analysis.
httputil
Package httputil contains small, protocol-level HTTP helpers that are independent of any business logic in this repository.
Package httputil contains small, protocol-level HTTP helpers that are independent of any business logic in this repository.
logger
Package logger provides helpers for creating *slog.Logger instances.
Package logger provides helpers for creating *slog.Logger instances.
observ
Package observ provides functionality for observ.
Package observ provides functionality for observ.
pipeline
Package pipeline provides foundational concurrency utilities used by the orchestrator: a generic worker-pool consumer and a dead-letter queue for failed pipeline events.
Package pipeline provides foundational concurrency utilities used by the orchestrator: a generic worker-pool consumer and a dead-letter queue for failed pipeline events.
policy
Package policy holds the foundational, provider-agnostic retry/error taxonomy shared by every layer that needs to make routing decisions on a failure: the analyzer adapters, the orchestrator/tagger pipeline and the CLI composition root.
Package policy holds the foundational, provider-agnostic retry/error taxonomy shared by every layer that needs to make routing decisions on a failure: the analyzer adapters, the orchestrator/tagger pipeline and the CLI composition root.
provider
Package provider — keypool.go implements KeyPool, the concurrency-safe pool of API credentials with per-key cooldown semantics that the per-backend analyzer providers (openai, gemini, ollama) use to rotate keys on quota / rate-limit errors.
Package provider — keypool.go implements KeyPool, the concurrency-safe pool of API credentials with per-key cooldown semantics that the per-backend analyzer providers (openai, gemini, ollama) use to rotate keys on quota / rate-limit errors.
provider/gemini
Package gemini implements the transport half of the analyzer Template Method using Google's Gemini models.
Package gemini implements the transport half of the analyzer Template Method using Google's Gemini models.
provider/ollama
Package ollama implements the transport half of the analyzer Template Method using a locally running Ollama instance with a vision-capable model.
Package ollama implements the transport half of the analyzer Template Method using a locally running Ollama instance with a vision-capable model.
provider/openai
Package openai implements the transport half of the analyzer Template Method for the OpenAI chat-completions API.
Package openai implements the transport half of the analyzer Template Method for the OpenAI chat-completions API.
scrub
Package scrub provides text scrubbing utilities for redacting sensitive patterns from strings.
Package scrub provides text scrubbing utilities for redacting sensitive patterns from strings.
trace
Package trace provides tracing functionality.
Package trace provides tracing functionality.

Jump to

Keyboard shortcuts

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