Skip to content

Project Overview

In the era of AI explosion, developers often face the following pain points:

  • Fragmented Model Ecosystem: Today you use OpenAI, tomorrow you want to switch to Anthropic (Claude) or DeepSeek, but each vendor's API structure, streaming format, and even Tool Calling specifications are vastly different, resulting in extremely high code refactoring costs.
  • Local Deployment is Too Bulky: Just to do text embedding (Embedding) or simple local inference, you have to deploy Ollama or even heavy Python environments on the server.
  • Complex Business Code Becomes "Spaghetti": When building RAG (Retrieval-Augmented Generation) or Agent systems, a large amount of Prompt stitching, API calls, conditional judgments, and retry logic intertwine, causing code to quickly degrade and become difficult to maintain.

GoChat was born to completely solve these pain points. It is not just an API Wrapper, but a modern, type-safe Go language large language model application development framework. It perfectly integrates multi-model scheduling, local vectorization, and complex workflow orchestration into a lightweight Go library.


Core Killer Features

1. The Ultimate "Write Once, Run Anywhere" (Client Module)

With GoChat, you no longer need to consult cryptic API documentation from different model vendors.

  • Vendor Difference Elimination: Whether it's OpenAI, Anthropic, or domestic models like Qwen, Deepseek, MiniMax, GoChat abstracts them all into a unified core.Client interface.
  • Enhanced Tool Calling: Different LLMs have wildly different underlying JSON structure definitions for function calling (Function Calling). GoChat provides a unified core.Tool and core.ToolCall abstraction - you only need to define a tool once, and you can seamlessly switch between all models that support this feature.
  • Built-in Resilience: Encountering network rate limiting (HTTP 429) or timeouts? Developers don't need to write for loops manually; the underlying automatically triggers retry with jittered Exponential Backoff.

2. "Zero-Configuration" Vectorization Without Ollama Dependency (Embedding Module)

If your core requirement is vector search (RAG), GoChat's Embedding module will be your super weapon:

  • No External Services Required: Execute vectorization locally directly based on ONNX Runtime, completely摆脱对 Ollama or any external Python service dependency. Embed AI capabilities into your monolithic Go binary file, greatly simplifying deployment topology.
  • Built-in Model Downloader: Still troubled by searching, comparing, and downloading models from HuggingFace? GoChat provides foolproof embedding.WithBEG / WithBERT factory methods - just provide the name, and the framework will automatically connect to remote and complete multi-file chunked downloading and loading when local files are missing.
  • Industrial-Grade Batch Processing: Built-in BatchProcessor supports concurrent batch processing for massive texts, and automatically hash-caches identical texts to avoid CPU waste from redundant calculations.

3. Turning Extremely Complex Logic into Elegance (Pipeline Module)

The essence of Agent and RAG systems is "multi-step thinking" and "data flow". GoChat provides a highly expressive generic workflow engine (Pipeline):

  • Goodbye to if err != nil Hell: Through Pipeline.AddStep().AddStep() chain calls, complex business logic is split into single-responsibility Steps.
  • Type-Safe Context: Thanks to Go 1.24+ generic support, you can pass custom strongly-typed struct as context between different Steps, with perfect IDE completion, eliminating type conversion exceptions and typos caused by traditional map[string]any.
  • Programmable Control Flow: Built-in IfStep (conditional branching) and LoopStep (looping), combined with native Hook mechanisms, no matter how complex the "think-act-reflect" chain, it can be organized as elegantly as a work of art.

Typical Use Cases

  • All-in-One AI Aggregation Gateway: Implement a unified standard to connect to mainstream global LLM providers as a service proxy.
  • Heavy RAG (Retrieval-Augmented Generation) Systems: Use Pipeline to chain local Embedding module with remote LLM module, achieving a pure Go knowledge base Q&A system without additional infrastructure deployment.
  • Complex Agent Systems: Utilize unified Tool Calling and loop/conditional nodes in Pipeline to build autonomous agents capable of calling external APIs, performing self-verification and correction.

Technology Stack

  • Language Requirements: Go 1.18+ (Go 1.24+ recommended for cutting-edge generic features in the Pipeline package).
  • Minimal Dependencies: Core protocols are handled mainly by Go standard library; only high-performance ONNX runtime abstraction is used for vector computation.